void OnTriggerEnter(Collider other) { //var enemy = ObjectFilter.RelativesHasTags(other.gameObject, ObjectFilter.Tag.Foreground); var enemy = other.gameObject; if (enemy != null) { Object.Destroy(enemy.transform.root.gameObject); wm.removeFromList(enemy.transform.root.gameObject); } }
//Pickup collectable, add value and destroy when done void OnTriggerEnter(Collider col) { if (ObjectFilter.EntityHasTags(col.gameObject, ObjectFilter.Tag.Collectable)) { string nameOfCollectables = col.gameObject.name; GameObject pckup = col.gameObject; if (nameOfCollectables == "Coinx5(Clone)" || nameOfCollectables == "Coinx2(Clone)") { FindObjectOfType <AudioManager> ().play("Coin"); } else { FindObjectOfType <AudioManager> ().play("FoodSound"); } score += pckup.GetComponent <Collectables>().value; _multis.Add(_multis.Count, new MulStruct(pckup.GetComponent <Collectables>()._time, pckup.GetComponent <Collectables>()._mult, Time.frameCount)); _foodFactor += pckup.GetComponent <Collectables>()._sizeMultiplier; _totalFoodForRun += pckup.GetComponent <Collectables>()._sizeMultiplier; _mv.removeFromList(pckup); Destroy(pckup); } }
public void unlimitedPower(GameObject toDestroy) { worldMover.removeFromList(toDestroy); Destroy(toDestroy); }