void OnTriggerEnter(Collider collision) { if (collision.gameObject.name == "Earth") { EarthLife lifeScript = collision.gameObject.GetComponent <EarthLife>(); lifeScript.dealDamage(); Destroy(gameObject); } else if (collision.gameObject.name.Equals("shield")) { Destroy(gameObject); } else if (collision.gameObject.name.Equals("Player")) { /*Energy energy = collision.gameObject.GetComponent<Energy>(); * energy.dealDamage(); * Split();*/ } else { Split(); } }
void Update() { EarthLife lifeScript = earth.GetComponent <EarthLife>(); barDisplay = lifeScript.getMyLife(); }