Beispiel #1
0
 private void CheckDistance()
 {
     if (target)
     {
         if (Vector3.Distance(target.position, transform.position) > 1.5f)
         {
             movement.Move(target);
         }
         else
         {
             if (canAttack)
             {
                 anim.Attack();
             }
         }
     }
 }
Beispiel #2
0
 void CheckDistance()
 {
     if (targetTransform)
     {
         if (Vector3.Distance(targetTransform.position, transform.position) > 1.5f)
         {
             zombie_Movement.Move(targetTransform);
         }
         else
         {
             if (canAttack)
             {
                 zombie_Animation.Attack();
                 timerAttack += Time.deltaTime;
                 if (timerAttack > 0.45f)
                 {
                     timerAttack = 0f;
                     AudioManager.instance.ZombieAttackSound();
                 }
             }
         }
     }
 }