예제 #1
0
 //when health goes below a limit check for death and trigger events correlating
 public void CheckDeath()
 {
     if (health <= 0)
     {
         anim.SetTrigger("Death");
         EnemyAudioDeath.Play();
         DeathGlow.SetActive(true);
         pos = new Vector3(xPosition, y, z);
         //_timerToAttack = 3.5f;
         Destroy(EnemyS, 3f); //Check this tomorrow
         if (_timerToSpawn > 0f)
         {
             _canSpawn      = false;
             _timerToSpawn -= _time * Time.deltaTime;
         }
         else
         {
             _canSpawn     = true;
             _timerToSpawn = 5f;
         }
         if (_canSpawn == true)
         {
             if (OnEnemyKilled != null)
             {
                 OnEnemyKilled();
             }
             RoundMan.KilledEnemy();
             RoundMan.CheckRound();
         }
     }
 }