Exemplo n.º 1
0
 public static LittleBossAttackState GetInstance()
 {
     if (_instance == null)
     {
         _instance = new LittleBossAttackState();
     }
     return(_instance);
 }
 public override void Update(LittleBossAgent agent)
 {
     agent.SetPlayerAsDestination();
     Debug.Log("Player still in reach");
     if (Vector3.Distance(agent.GetDestination(), agent.transform.position) < agent.GetAttackRange())
     {
         Debug.Log("Attack");
         agent.SetState(LittleBossAttackState.GetInstance());
     }
     if (agent.GetDistanceBtwPlayerAndReturn() > agent.GetRange())
     {
         Debug.Log("Return");
         agent.SetState(LittleBossReturnState.GetInstance());
     }
 }