Exemplo n.º 1
0
 public override AIAgent.STATE GetNextStateByRun(bool findedTarget, bool inFinding)
 {
     AIAgent.STATE state = AIAgent.STATE.MAX;
     if (_owner.ACOwner.IsAlived)
     {
         if (findedTarget && _owner.TargetAC != null && _owner.TargetAC.IsAlived)
         {
             state = AIAgent.STATE.ATTACK;
         }
         else if (!inFinding)
         {
             state = AIAgent.STATE.IDLE;
         }
         else if (inFinding)
         {
             if (_owner.CanSeekTarget())
             {
                 _owner.HandleInnerCmd(FCCommand.CMD.MOVE_TO_POINT, null, _owner.TargetAC.ThisTransform.localPosition, null, null);
             }
             else
             {
                 _owner.HandleInnerCmd(FCCommand.CMD.STOP_IS_ARRIVE_POINT, null);
                 state = AIAgent.STATE.IDLE;
             }
         }
         else
         {
             state = AIAgent.STATE.IDLE;
         }
     }
     else
     {
         state = AIAgent.STATE.DEAD;
     }
     return(state);
 }
Exemplo n.º 2
0
 IEnumerator STATE()
 {
     _isOver = false;
     while (_inState)
     {
         if (!_inPause && _owner.TargetAC != null)
         {
             if (_owner.TargetAC.IsAlived)
             {
                 int result = GetSkillID(_owner.ACOwner.ThisTransform.localPosition - _owner.TargetAC.ThisTransform.localPosition, _attackAgent._skillMaps[_attackLevel]._skillConfigs);
                 if (result >= 0)
                 {
                     //get right skill , and set current skill to result
                     _nextSkillID = result;
                     _owner.HandleInnerCmd(FCCommand.CMD.TARGET_IN_ATTACK_DISTANCE, result);
                 }
             }
         }
         yield return(new WaitForSeconds(0.1f));
     }
     _isOver = true;
 }