public void Execute()
 {
     if (owner.GetTargetInTerritory())
     {
         owner.GetStateMachineEnemy().SetState(new EnemyMovingState(owner));
     }
     else if (owner.InRangeToAttack())
     {
         owner.GetStateMachineEnemy().SetState(new EnemyAttackState(owner));
     }
 }
Ejemplo n.º 2
0
 public void Execute()
 {
     if (owner.GetTargetInTerritory())
     {
         if (owner.InRangeToAttack())
         {
             owner.GetStateMachineEnemy().SetState(new EnemyAttackState(owner));
         }
         else if (owner.GetDistanceFromTarget() > 1f)
         {
             owner.GetAgent().SetDestination(owner.GetTarget().transform.position);
         }
     }
     else if (!owner.GetTargetInTerritory() && owner.GetDistanceFromInitialPos() > 1f)
     {
         owner.GetAgent().SetDestination(owner.GetInitialPosition());
     }
     else
     {
         owner.GetStateMachineEnemy().SetState(new EnemyIdleState(owner));
     }
 }
Ejemplo n.º 3
0
 public void Execute()
 {
     if (owner.InRangeToAttack())
     {
         if (owner.GetTimeToAttack() > 0)
         {
             owner.DecreaseTimeToAttack(Time.deltaTime);
             owner.GetAnimator().SetBool("attack", false);
         }
         else
         {
             owner.GetAnimator().SetBool("attack", true);
             owner.PerformAttack();
             owner.ResetTimeToAttack();
         }
     }
     else
     {
         owner.GetStateMachineEnemy().SetState(new EnemyMovingState(owner));
     }
 }