コード例 #1
0
ファイル: EnemyHP.cs プロジェクト: ragnaroksixx/Artifact51
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "bullet")
        {
            TakeDamage();
        }
        AlienBullet b = collision.transform.GetComponent <AlienBullet>();

        if (b != null)
        {
            b.Death();
        }
    }
コード例 #2
0
ファイル: EnemyHP.cs プロジェクト: ragnaroksixx/Artifact51
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "bullet")
        {
            TakeDamage();
        }
        AlienBullet b = other.transform.GetComponent <AlienBullet>();

        if (b != null)
        {
            b.Death();
        }
    }
コード例 #3
0
ファイル: Shield.cs プロジェクト: ragnaroksixx/Artifact51
 public void DestroyShield()
 {
     foreach (GameObject obj in caughtObject)
     {
         AlienBullet a = obj.GetComponent <AlienBullet>();
         if (a != null)
         {
             a.Death();
         }
         else
         {
             Destroy(obj);
         }
     }
     Destroy(this.gameObject);
 }