Example #1
0
 private void DamageEnemy()
 {
     if (lives > 0)
     {
         lives--;
     }
     if (lives <= 0)
     {
         SpawnManagerBehavior spawnManager = GameObject.FindGameObjectWithTag("SpawnManager").GetComponent <SpawnManagerBehavior>();
         spawnManager.UpdateDestroyedEnemies();
         Instantiate(_death, this.transform.position, Quaternion.identity);
         Destroy(this.gameObject);
     }
 }
Example #2
0
 private void DamageEnemy()
 {
     if (_lives > 0)
     {
         _lives--;
     }
     if (_lives <= 0)
     {
         SpawnManagerBehavior spawnManager = GameObject.FindGameObjectWithTag("SpawnManager").GetComponent <SpawnManagerBehavior>();
         spawnManager.UpdateDestroyedEnemies();
         Instantiate(_death, this.transform.position, Quaternion.identity);
         Instantiate(_death, this.transform.position + new Vector3(-.5f, .5f, 0), Quaternion.identity);
         Instantiate(_death, this.transform.position + new Vector3(.5f, -.5f, 0), Quaternion.identity);
         Instantiate(_death, this.transform.position + new Vector3(-.5f, -.5f, 0), Quaternion.identity);
         Instantiate(_death, this.transform.position + new Vector3(.5f, .5f, 0), Quaternion.identity);
         SpawnManagerBehavior sm = GameObject.Find("SpawnManager").GetComponent <SpawnManagerBehavior>();
         sm.NextLevel();
         Destroy(this.gameObject);
     }
 }