示例#1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "DeathWall")
     {
         ResetSelf();
     }
     if (other.tag == "Hostile")
     {
         if (other.GetComponent <Chaser>() != null)
         {
             Chaser otherscript = other.GetComponent <Chaser>();
             otherscript.ResetEnemy();
         }
         if (other.GetComponent <Roamer>() != null)
         {
             Roamer otherscript = other.GetComponent <Roamer>();
             otherscript.ResetEnemy();
         }
         if (other.GetComponent <AsteroidSpawner>() != null)
         {
             AsteroidSpawner otherscript = other.GetComponent <AsteroidSpawner>();
             otherscript.ResetEnemy();
         }
         if (other.GetComponent <Shooter>() != null)
         {
             Shooter otherscript = other.GetComponent <Shooter>();
             otherscript.ResetEnemy();
         }
         if (other.GetComponent <Diver>() != null)
         {
             Diver otherscript = other.GetComponent <Diver>();
             otherscript.ResetEnemy();
         }
     }
     if (other.tag == "Player")
     {
         if (other.GetComponent <PlayerController>() != null)
         {
             PlayerController otherscript = other.GetComponent <PlayerController>();
             otherscript.TakeDamage();
         }
     }
 }