private void Collision() { GameObject[] data = EventManager.GetData("Collision") as GameObject[]; if (data[1] == trainhead) //other object hit trainhead { string tag = GetTag(data[0]); if (tag == "rock") { controller.Crash(); } if (tag == "coin") { //Destroy(data[0]); //data[0].SetActive(false); data[0].GetComponent <Coin>().ActivateCoin(); EventManager.EmitEvent("CoinCollected"); } if (tag == "cow") { data[0].GetComponent <Cow>().Honk(); } } }