Exemplo n.º 1
0
 /// <summary>
 /// 敌人使用某种战术
 /// </summary>
 /// <param name="tactic"></param>
 public static void ForceEnemyTactic(ENEMYTACTIC tactic)
 {
     GetActiveEnemies();
     if (activeEnemies.Count > 0)
     {
         for (int i = 0; i < activeEnemies.Count; i++)
         {
             activeEnemies[i].GetComponent <EnemyAI>().SetEnemyTactic(tactic);
         }
     }
 }
Exemplo n.º 2
0
    public void Attack()
    {
        if (target == null)
        {
            SetTargetToPlayers();
        }

        if (target.GetComponent <Player>().curHealth <= 0)
        {
            enemyTactic = ENEMYTACTIC.KEEPMEDIUMDISTANCE;
        }

        if (Time.time - lastAttackTime > attackInterval)
        {
            enemyState = ENEMYSTATE.ATTACK;
            Move(Vector3.zero, 0);
            LookAtTarget();
            enemyAnimator.SetTrigger("Punch");
            lastAttackTime = Time.time;
        }

        enemyAnimator.SetBool("Walk", false);
    }
Exemplo n.º 3
0
 public override void Reset()
 {
     gameObject = null;
     tactic     = ENEMYTACTIC.ENGAGE;
     everyFrame = false;
 }
Exemplo n.º 4
0
 public void SetEnemyTactic(ENEMYTACTIC tactic)
 {
     enemyTactic = tactic;
 }
Exemplo n.º 5
0
 public void IdleOff()
 {
     SetTargetToPlayers();
     enemyTactic = ENEMYTACTIC.ENGAGE;
 }
Exemplo n.º 6
0
 public void IdleOn()
 {
     enemyTactic = ENEMYTACTIC.STANDSTILL;
     target      = null;
 }