示例#1
0
 public BehaviorReturnCode LookAtTarget()
 {
     try
     {
         if (debug)
         {
             Debug.Log("LookAtTarget");
         }
         if ((Target.position.x > aiTransform.position.x && !aiMovement.FacingRight()) || (Target.position.x < aiTransform.position.x && aiMovement.FacingRight()))
         {
             aiMovement.Flip();
             return(BehaviorReturnCode.Success);
         }
         return(BehaviorReturnCode.Failure);
     }
     catch (TargetDespawnedException)
     {
         return(BehaviorReturnCode.Failure);
     }
 }