コード例 #1
0
 void Walk()
 {
     if (Vector3.Distance(Player.transform.position, transform.position) > 1.5f)
     {
         // transform.LookAt(Player.transform);
         // transform.Translate(Vector3.forward * Time.deltaTime * mov_speed);
         zombieAnim.ZombieWalk();
         StartCoroutine(Check());
         agent.SetDestination(Player.transform.position);
     }
     else
     {
         if (attack_cooldown <= 0 && isAlive)
         {
             Player.GetComponent <Movement>().take_damage(5.0f);
             Debug.Log("Attacking..");
             zombieAnim.ZombieAttack();
             attack_cooldown = attack_speed;
         }
         agent.ResetPath();
     }
     attack_cooldown -= Time.deltaTime;
 }