void OnTriggerExit(Collider other) { if (other.gameObject.name == "Health Leaf") { Destroy(other.gameObject); kartStatus.AddLeaf(); healthPickupAudio.Play(); } if (other.gameObject.name == "Mine") { Destroy(other.gameObject); kartStatus.Hit(); } /*if (other.gameObject.name == "SpeedBoost") * { * Destroy(other.gameObject); * AddItem(Item.SpeedBoost); * }*/ if (other.GetComponent <ItemSpawner>()) { Item item = (Item)other.GetComponent <ItemSpawner>().GetItem(); other.GetComponent <ItemSpawner>().PickUp(); shieldPickupAudio.Play(); AddItem(item); } }
void AddItem(Item item) { if (item == Item.Leaf) { kartStatus.AddLeaf(); } else if (currentItem == Item.NULL) { currentItem = item; } }