Ejemplo n.º 1
0
 // Destroy this gameObject
 private void killThisObj()
 {
     EnemyHP[] EHPs = gameObject.GetComponentsInChildren <EnemyHP> ();
     foreach (EnemyHP EHP in EHPs)
     {
         EHP.die();
     }
     Destroy(gameObject);
 }
Ejemplo n.º 2
0
 // Checks for any attached EnemyHP components (if this is a missile) and kills them if they exist
 private void destroyAttachedEnemyHP()
 {
     if (_type != bulletType.missile)
     {
         return;
     }
     EnemyHP[] EHPs = transform.root.gameObject.GetComponentsInChildren <EnemyHP>();
     foreach (EnemyHP EHP in EHPs)
     {
         EHP.die();
     }
 }
Ejemplo n.º 3
0
 void Update()
 {
     _location = Camera.main.WorldToViewportPoint(transform.position);
     if (not_percent(_location.x) || not_percent(_location.y))
     {
         EnemyHP[] EHPs = transform.root.gameObject.GetComponentsInChildren <EnemyHP>();
         foreach (EnemyHP EHP in EHPs)
         {
             EHP.die();
         }
         Destroy(transform.root.gameObject);             //Scary Bugs!
     }
 }
Ejemplo n.º 4
0
    void Update()
    {
        _location = Camera.main.WorldToViewportPoint(transform.position);
        if (not_percent(_location.x) || not_percent(_location.y))
        {
            GetComponent <BoxCollider2D>().enabled = false;
            float destroy_delay = 3.0f;
            if (GetComponent <seeking_missile>())
            {
                destroy_delay = 0.15f;
            }

            EnemyHP[] EHPs = transform.root.gameObject.GetComponentsInChildren <EnemyHP>();
            foreach (EnemyHP EHP in EHPs)
            {
                EHP.die();
            }
            Destroy(transform.root.gameObject, destroy_delay);             //Scary Bugs!
        }
    }
Ejemplo n.º 5
0
    // Stop all SpawnManager coroutines, and then destroy all enemies
    public void resetEnemies()
    {
        SpawnManager.Instance.reset();
        seeking_missile.destroyAllMissiles();

        while (enemies.Count != 0)
        {
            EnemyHP EHP;
            if (enemies [0] != null && (EHP = enemies [0].GetComponent <EnemyHP> ()))
            {
                enemies.RemoveAt(0);
                EHP.die();
            }
            else
            {
                enemies.RemoveAt(0);
            }
        }
        enemies.Clear();
    }