public void FindScript() { Component tempScript = currentObjects[globalIndex].GetComponent(typeof(MonoBehaviour)); if (tempScript.GetType().Equals(typeof(TerroristScript))) { TerroristScript tempTerrorist = (TerroristScript)currentObjects[globalIndex].GetComponent(typeof(TerroristScript)); tempTerrorist.KillToDeath(); } if (tempScript.GetType().Equals(typeof(JungleCommandoScript))) { JungleCommandoScript tempJungle = (JungleCommandoScript)currentObjects[globalIndex].GetComponent(typeof(JungleCommandoScript)); tempJungle.KillToDeath(); } if (tempScript.GetType().Equals(typeof(ZombieScript))) { ZombieScript tempZombie = (ZombieScript)currentObjects[globalIndex].GetComponent(typeof(ZombieScript)); tempZombie.KillToDeath(); } if (tempScript.GetType().Equals(typeof(LightScript))) { LightScript tempLight = (LightScript)currentObjects[globalIndex].GetComponent(typeof(LightScript)); tempLight.KillToDeath(); } if (tempScript.GetType().Equals(typeof(ArmyScript))) { ArmyScript tempArmy = (ArmyScript)currentObjects[globalIndex].GetComponent(typeof(ArmyScript)); tempArmy.KillToDeath(); } if (tempScript.GetType().Equals(typeof(MissileScript))) { MissileScript tempMissile = (MissileScript)currentObjects[globalIndex].GetComponent(typeof(MissileScript)); tempMissile.KillToDeath(); } Killed(currentObjects[globalIndex]); }