Пример #1
0
    IEnumerator Dead()
    {
        yield return(new WaitForSeconds(0.5f));

        SpawnExplosion(transform.position, 1);
        yield return(new WaitForSeconds(0.5f));

        SpawnExplosion(new Vector3(transform.position.x + 1, transform.position.y, transform.position.z + 1), 1);
        yield return(new WaitForSeconds(0.5f));

        SpawnExplosion(new Vector3(transform.position.x + 1, transform.position.y, transform.position.z - 1), 1);
        yield return(new WaitForSeconds(0.5f));

        SpawnExplosion(new Vector3(transform.position.x - 1, transform.position.y, transform.position.z + 1), 1);
        yield return(new WaitForSeconds(0.5f));

        SpawnExplosion(new Vector3(transform.position.x - 1, transform.position.y, transform.position.z - 1), 1);
        spawnEnemies.DecreseEnemyAlive(this.gameObject);
        Destroy(gameObject);
    }
Пример #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Bullet"))
     {
         if (positionReach)
         {
             health -= 10;
         }
         if (health == 0)
         {
             SpawnBonus();
             score.UpdateScore(1);
             spawnEnemies.DecreseEnemyAlive(this.gameObject);
             Destroy(this.gameObject);
             SpawnExplosion(transform.position, 1);
         }
         SpawnExplosion(other.transform.position, 0);
         Destroy(other.gameObject);
     }
 }