本文整理汇总了C#中GameFramework.EntityInfo.GetSkillStateInfo方法的典型用法代码示例。如果您正苦于以下问题:C# EntityInfo.GetSkillStateInfo方法的具体用法?C# EntityInfo.GetSkillStateInfo怎么用?C# EntityInfo.GetSkillStateInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameFramework.EntityInfo
的用法示例。
在下文中一共展示了EntityInfo.GetSkillStateInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CombatHandler
private void CombatHandler(EntityInfo npc, long deltaTime)
{
if (npc.GetSkillStateInfo().IsSkillActivated()) {
return;
}
AiStateInfo info = npc.GetAiStateInfo();
Vector3 targetPos = info.HomePos;
ScriptRuntime.Vector3 srcPos = npc.GetMovementStateInfo().GetPosition3D();
float distSqrToHome = Geometry.DistanceSquare(srcPos, info.HomePos);
if (distSqrToHome > npc.GohomeRange * npc.GohomeRange) {
NotifyAiStopPursue(npc);
ChangeToState(npc, (int)AiStateId.GoHome);
return;
}
///
EntityInfo attackTarget = null;
SkillStateInfo currSkInfo = npc.GetSkillStateInfo();
///找到可以使用的技能
SkillInfo skInfo = AiLogicUtility.NpcFindCanUseSkill(npc, this.GetAiData(npc), true);
NotifyAiSelectSkill(npc, skInfo);
if (skInfo == null) {
//没有可以使用的技能就切换到Idle状态
ChangeToState(npc, (int)AiStateId.Idle);
return;
}
CharacterRelation relation =
(skInfo.TargetType == SkillTargetType.Friend ||
skInfo.TargetType == SkillTargetType.RandFriend) ?
CharacterRelation.RELATION_FRIEND :
CharacterRelation.RELATION_ENEMY;
attackTarget = AiLogicUtility.GetNearstTargetHelper(
npc, skInfo.Distance, relation);
if (attackTarget != null && null != skInfo) //攻击范围内找到可攻击目标
{
info.Target = attackTarget.GetId();
NotifyAiStopPursue(npc);
NotifyAiSkill(npc, skInfo.SkillId); //攻击目标
return;
}
attackTarget = AiLogicUtility.GetNearstTargetHelper(
npc, npc.ViewRange, relation);
if (attackTarget != null) //视野范围内找到可攻击目标
{
NotifyAiPursue(npc, attackTarget.GetMovementStateInfo().GetPosition3D()); // 追赶目标
return;
}
currSkInfo.SetCurSkillInfo(0);
NotifyAiStopPursue(npc);
ChangeToState(npc, (int)AiStateId.GoHome);
}
示例2: CombatHandler
private void CombatHandler(EntityInfo npc, long deltaTime)
{
AiStateInfo aiInfo = npc.GetAiStateInfo();
AiData_Leader aiData = GetAiData(npc);
if (npc.GetSkillStateInfo().IsSkillActivated()) {
return;
}
///
SkillStateInfo currSkInfo = npc.GetSkillStateInfo();
///找到可以使用的技能
SkillInfo skInfo = AiLogicUtility.NpcFindCanUseSkill(npc, this.GetAiData(npc), aiData.IsAutoOperate);
NotifyAiSelectSkill(npc, skInfo);
if (skInfo == null) {
//没有可以使用的技能就切换到Idle状态
ChangeToState(npc, (int)AiStateId.Idle);
return;
}
CharacterRelation relation =
(skInfo.TargetType == SkillTargetType.Friend ||
skInfo.TargetType == SkillTargetType.RandFriend) ?
CharacterRelation.RELATION_FRIEND :
CharacterRelation.RELATION_ENEMY;
EntityInfo attackTarget = AiLogicUtility.GetNearstAttackerHelper(npc, relation, aiData);
if (null != attackTarget) {
NotifyAiTarget(npc, attackTarget);
if (Geometry.DistanceSquare(npc.GetMovementStateInfo().GetPosition3D(), attackTarget.GetMovementStateInfo().GetPosition3D()) < skInfo.Distance * skInfo.Distance) {
aiInfo.Target = attackTarget.GetId();
NotifyAiStopPursue(npc);
NotifyAiSkill(npc, skInfo.SkillId);
return;
}
}
attackTarget = AiLogicUtility.GetNearstTargetHelper(npc, skInfo.Distance, relation);
if (attackTarget != null && null != skInfo) { //攻击范围内找到可攻击目标
NotifyAiTarget(npc, attackTarget);
aiInfo.Target = attackTarget.GetId();
NotifyAiStopPursue(npc);
NotifyAiSkill(npc, skInfo.SkillId); //攻击目标
return;
}
if (aiData.IsAutoOperate) {
attackTarget = AiLogicUtility.GetNearstTargetHelper(npc, npc.ViewRange, relation);
if (attackTarget != null && null != skInfo) { //视野内找到可攻击目标
NotifyAiPursue(npc, attackTarget.GetMovementStateInfo().GetPosition3D());
return;
}
}
///退出战斗模式清理一下手动技能
currSkInfo.SetCurSkillInfo(0);
aiData.ManualSkillId = 0;
NotifyAiStopPursue(npc);
ChangeToState(npc, (int)AiStateId.Idle);
}
示例3: RefixAttrByImpact
public static void RefixAttrByImpact(EntityInfo obj)
{
List<ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact();
for (int i = 0; i < impacts.Count; ++i) {
ImpactInfo impact = impacts[i];
impact.RefixCharacterProperty(obj);
}
}
示例4: OnAiAddImpact
private void OnAiAddImpact(EntityInfo entity, int impactId)
{
ImpactInfo impactInfo = new ImpactInfo(impactId);
impactInfo.StartTime = TimeUtility.GetLocalMilliseconds();
impactInfo.ImpactSenderId = entity.GetId();
impactInfo.SkillId = 0;
if (null != impactInfo.ConfigData) {
entity.GetSkillStateInfo().AddImpact(impactInfo);
int seq = impactInfo.Seq;
if (GfxSkillSystem.Instance.StartSkill(entity.GetId(), impactInfo.ConfigData, seq)) {
}
}
}
示例5: OnAiAddImpact
private void OnAiAddImpact(EntityInfo npc, int impactId)
{
Scene scene = npc.SceneContext.CustomData as Scene;
if (null != scene) {
ImpactInfo impactInfo = new ImpactInfo(impactId);
impactInfo.StartTime = TimeUtility.GetLocalMilliseconds();
impactInfo.ImpactSenderId = npc.GetId();
impactInfo.SkillId = 0;
if (null != impactInfo.ConfigData) {
npc.GetSkillStateInfo().AddImpact(impactInfo);
int seq = impactInfo.Seq;
if (scene.SkillSystem.StartSkill(npc.GetId(), impactInfo.ConfigData, seq)) {
Msg_RC_AddImpact addImpactBuilder = new Msg_RC_AddImpact();
addImpactBuilder.sender_id = npc.GetId();
addImpactBuilder.target_id = npc.GetId();
addImpactBuilder.impact_id = impactId;
addImpactBuilder.skill_id = -1;
addImpactBuilder.duration = impactInfo.DurationTime;
scene.NotifyAllUser(RoomMessageDefine.Msg_RC_AddImpact, addImpactBuilder);
}
}
}
}
示例6: SyncBuffListToUser
internal static void SyncBuffListToUser(EntityInfo obj, User user)
{
List<ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact();
foreach (ImpactInfo info in impacts) {
}
}
示例7: SyncBuffListToObservers
internal static void SyncBuffListToObservers(EntityInfo obj, Scene scene)
{
List<ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact();
foreach (ImpactInfo info in impacts) {
}
}
示例8: SyncBuffListToCaredUsers
internal static void SyncBuffListToCaredUsers(EntityInfo obj)
{
Scene scene = obj.SceneContext.CustomData as Scene;
if (null != scene) {
List<ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact();
foreach (ImpactInfo info in impacts) {
}
}
}
示例9: OnAiRemoveImpact
private void OnAiRemoveImpact(EntityInfo npc, int impactId)
{
Scene scene = npc.SceneContext.CustomData as Scene;
if (null != scene) {
ImpactInfo impactInfo = npc.GetSkillStateInfo().FindImpactInfoById(impactId);
if (null != impactInfo) {
Msg_RC_RemoveImpact removeImpactBuilder = new Msg_RC_RemoveImpact();
removeImpactBuilder.obj_id = npc.GetId();
removeImpactBuilder.impact_id = impactId;
scene.NotifyAllUser(RoomMessageDefine.Msg_RC_RemoveImpact, removeImpactBuilder);
scene.SkillSystem.StopSkill(npc.GetId(), impactId, impactInfo.Seq, false);
}
}
}
示例10: OnAiStopSkill
private void OnAiStopSkill(EntityInfo npc)
{
Scene scene = npc.SceneContext.CustomData as Scene;
if (null != scene) {
SkillInfo skillInfo = npc.GetSkillStateInfo().GetCurSkillInfo();
if (null == skillInfo || skillInfo.IsSkillActivated) {
scene.SkillSystem.StopAllSkill(npc.GetId(), true);
}
Msg_RC_NpcStopSkill skillBuilder = DataSyncUtility.BuildNpcStopSkillMessage(npc);
LogSystem.Info("Send Msg_RC_NpcStopSkill, EntityId={0}",
npc.GetId());
scene.NotifyAllUser(RoomMessageDefine.Msg_RC_NpcStopSkill, skillBuilder);
}
}
示例11: OnAiSelectSkill
private void OnAiSelectSkill(EntityInfo npc, SkillInfo skill)
{
if (skill == null)
npc.GetSkillStateInfo().SetCurSkillInfo(0);
else
npc.GetSkillStateInfo().SetCurSkillInfo(skill.SkillId);
}
示例12: DestroyEntity
private void DestroyEntity(EntityInfo ni)
{
m_SkillSystem.StopAllSkill(ni.GetId(), true, true, true);
ni.GetSkillStateInfo().RemoveAllImpact();
OnDestroyEntity(ni);
if (ni.IsCombatNpc()) {
ni.DeadTime = 0;
}
DestroyEntityById(ni.GetId());
}
示例13: OnAiSkill
private void OnAiSkill(EntityInfo entity, int skillId)
{
if (null != entity) {
SkillInfo skillInfo = entity.GetSkillStateInfo().GetSkillInfoById(skillId);
if (null != skillInfo) {
if (GfxSkillSystem.Instance.StartSkill(entity.GetId(), skillInfo.ConfigData, 0)) {
Utility.EventSystem.Publish("ui_skill_cooldown", "ui", entity.GetId(), skillId, skillInfo.ConfigData.cooldown / 1000.0f);
}
}
}
}
示例14: OnAiRemoveImpact
private void OnAiRemoveImpact(EntityInfo entity, int impactId)
{
ImpactInfo impactInfo = entity.GetSkillStateInfo().FindImpactInfoById(impactId);
if (null != impactInfo) {
GfxSkillSystem.Instance.StopSkill(entity.GetId(), impactId, impactInfo.Seq, false);
}
}
示例15: DoSkillCommandState
internal static void DoSkillCommandState(EntityInfo entity, long deltaTime, AbstractAiStateLogic logic, int skillId)
{
if (entity.GetMovementStateInfo().IsMoving) {
logic.NotifyAiStopPursue(entity);
}
if (skillId > 0) {
AiStateInfo aiInfo = entity.GetAiStateInfo();
SkillInfo skillInfo = entity.GetSkillStateInfo().GetSkillInfoById(skillId);
if (null != skillInfo) {
if (aiInfo.Target <= 0) {
EntityInfo info;
if (skillInfo.ConfigData.targetType == (int)SkillTargetType.Enemy || skillInfo.ConfigData.targetType == (int)SkillTargetType.RandEnemy) {
info = GetNearstTargetHelper(entity, CharacterRelation.RELATION_ENEMY);
} else {
info = GetNearstTargetHelper(entity, CharacterRelation.RELATION_FRIEND);
}
if (null != info) {
aiInfo.Target = info.GetId();
}
}
if (aiInfo.Target > 0) {
logic.NotifyAiSkill(entity, skillId);
}
}
} else if(!entity.GetSkillStateInfo().IsSkillActivated()) {
logic.AiSendStoryMessage(entity, "npc_skill_finish:" + entity.GetUnitId(), entity.GetId());
logic.AiSendStoryMessage(entity, "obj_skill_finish", entity.GetId());
logic.ChangeToState(entity, (int)AiStateId.Idle);
}
}