コード例 #1
0
 // Destroy this gameObject
 private void killThisObj()
 {
     EnemyHP[] EHPs = gameObject.GetComponentsInChildren <EnemyHP> ();
     foreach (EnemyHP EHP in EHPs)
     {
         EHP.die();
     }
     Destroy(gameObject);
 }
コード例 #2
0
ファイル: BulletScript.cs プロジェクト: gantar22/Binary-Star
 // 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();
     }
 }
コード例 #3
0
ファイル: killIfOOB.cs プロジェクト: gantar22/Binary-Star
 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!
     }
 }
コード例 #4
0
ファイル: disableifoob.cs プロジェクト: gantar22/Binary-Star
    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!
        }
    }
コード例 #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();
    }