BehaveResult Tick(Tree sender) { if (attackEnemy == null || attackEnemy.entityTarget == null || attackEnemy.entityTarget.target == null) { return(BehaveResult.Failure); } Enemy TargetEnemy = attackEnemy.entityTarget.target.GetAttackEnemy(); if (TargetEnemy == null) { return(BehaveResult.Failure); } if (!NpcTypeDb.CanRun(NpcCmdId, ENpcControlType.Dodge)) { return(BehaveResult.Failure); } if (attackEnemy.SqrDistanceXZ < 1.0f && attackEnemy.entityTarget.IsAttacking && TargetEnemy.entityTarget == entity) //) //&& Random.value >= 0.3f { float value = Random.value > 0.5f ? -1.0f : 1.0f; Vector3 ward = Random.value > 0.5f ? value * transform.right : -transform.forward; if (Random.value >= 0.3f && attackEnemy.entityTarget.IsAttacking) { PEActionParamV param = PEActionParamV.param; param.vec = ward; DoAction(PEActionType.Step, param); } return(BehaveResult.Success); } return(BehaveResult.Failure); }
bool CanStep() { Vector3 dir = position - selectattackEnemy.position; PEActionParamV param = PEActionParamV.param; param.vec = dir; return(InRadiu(position, selectattackEnemy.position, 3.0f) && IsInEnemyFoward(selectattackEnemy, entity) && CanDoAction(PEActionType.Step, param)); }
void DoStep() { Vector3 dir = position - selectattackEnemy.position; PEActionParamV paramV = PEActionParamV.param; paramV.vec = dir; DoAction(PEActionType.Step, paramV); }
BehaveResult Tick(Tree sender) { if (!GetData <Data>(sender, ref m_Data)) { return(BehaveResult.Failure); } if (Enemy.IsNullOrInvalid(attackEnemy) || attackEnemy.entityTarget == null || attackEnemy.entityTarget.animCmpt == null) { return(BehaveResult.Failure); } m_Data.m_AttackCheck = (EAttackCheck)attackEnemy.entityTarget.animCmpt.GetInteger("attackCheck"); if (m_Data.m_AttackCheck == EAttackCheck.All) { m_Data.m_AttackCheck = Random.value > 0.5f ? m_Data.m_AttackCheck = EAttackCheck.RunAway : m_Data.m_AttackCheck = EAttackCheck.Roll; } if (m_Data.m_AttackCheck != EAttackCheck.Roll) { return(BehaveResult.Failure); } if (m_Data.m_HasRoll) { return(BehaveResult.Failure); } if (!InRadiu(position, attackEnemy.position, 3.0f)) { return(BehaveResult.Failure); } if (!IsInEnemyFoward(attackEnemy, entity)) { return(BehaveResult.Failure); } Vector3 dir = position - attackEnemy.position; PEActionParamV param = PEActionParamV.param; param.vec = dir; if (!CanDoAction(PEActionType.Step, param)) { return(BehaveResult.Failure); } PEActionParamV paramV = PEActionParamV.param; paramV.vec = dir; m_Data.m_HasRoll = DoAction(PEActionType.Step, paramV); return(BehaveResult.Running); }
private void RPC_SKDAV(uLink.BitStream stream, uLink.NetworkMessageInfo info) { PEActionType proType = stream.Read <PEActionType> (); PEActionParamV param = PEActionParamV.param; param.vec = stream.Read <Vector3> (); if (MtCmpt != null) { MtCmpt.DoActionImmediately((PEActionType)proType, param); } }
BehaveResult Tick(Tree sender) { if (Enemy.IsNullOrInvalid(attackEnemy)) { return(BehaveResult.Failure); } if (attackEnemy.entityTarget == null || attackEnemy.entityTarget.animCmpt == null || attackEnemy.entityTarget.target == null) { return(BehaveResult.Success); } Vector3 dir = position - attackEnemy.position; PEActionParamV param = PEActionParamV.param; param.vec = dir; if (!CanDoAction(PEActionType.Step, param)) { return(BehaveResult.Success); } if (Weapon != null && Weapon.GetAttackMode() != null) { AttackMode[] atts = Weapon.GetAttackMode(); if (atts.Length > 0 && atts[0].type == AttackType.Ranged) { return(BehaveResult.Success); } } Enemy TargetEnemy = attackEnemy.entityTarget.target.GetAttackEnemy(); if (TargetEnemy == null) { return(BehaveResult.Success); } EAttackCheck check = (EAttackCheck)attackEnemy.entityTarget.animCmpt.GetInteger("attackCheck"); if (TargetEnemy.entityTarget == entity && check != EAttackCheck.None) { return(BehaveResult.Failure); } else { return(BehaveResult.Success); } }
private void SendSKDADig(PEActionType type, PEActionParam obj) { PEActionParamV param = obj as PEActionParamV; RPCServer(EPacketType.PT_InGame_SKDAV, type, param.vec); //,(Vector3)obj[0],(Vector3)obj[1],param.q[2]); }
private void SendSKDAStep(PEActionType type, PEActionParam obj) { PEActionParamV param = obj as PEActionParamV; RPCServer(EPacketType.PT_InGame_SKDAV, type, param.vec); }