// OnTriggerEnter is called when the Collider other enters the trigger void OnTriggerEnter(Collider other) { // If the other collider is the player collect the pickup if (other.gameObject.tag == Tags.playerTag) { // Collect the key - remove minimap icon keyCollected = true; MiniMapController.RemoveMapObject(gameObject); } }
// OnTriggerEnter is called when the Collider other enters the trigger void OnTriggerEnter(Collider other) { // If the other collider is the player collect the pickup if (other.gameObject.tag == Tags.playerTag) { // Collect the pickup - add points - remove minimap icon pickupCollected = true; other.gameObject.GetComponent <PlayerController>().AddToScore(points); MiniMapController.RemoveMapObject(gameObject); } }
// OnTriggerEnter is called when the Collider other enters the trigger void OnTriggerEnter(Collider other) { // If the other collider is the player collect the pickup if (other.gameObject.tag == Tags.playerTag) { // Collect the pickup - add points - remove minimap icon healthCollected = true; other.gameObject.GetComponent <PlayerController>().AddToHealth(health); MiniMapController.RemoveMapObject(gameObject); GameDataManager.instance.HealthCollected(Index()); } }
// OnTriggerEnter is called when the Collider other enters the trigger void OnTriggerEnter(Collider other) { // If the other collider is the player if (other.gameObject.tag == Tags.playerTag) { // If the key has been collected if (keyCollected) { // Open the chest chestOpened = true; anim.SetBool("Key", true); // Aadd points other.gameObject.GetComponent<PlayerController>().AddToScore(points); // Remove minimap icon MiniMapController.RemoveMapObject(gameObject); } // Key not collected else if (!keyCollected && !chestOpened) anim.SetTrigger("NoKey"); } }
void OnDestroy() { MiniMapController.RemoveMapObject(this.gameObject); }
// Update is called once per frame void OnDestroy() { //if the object is destroyed, Remove the object from the list //ex: items the generated by the spawners MiniMapController.RemoveMapObject(gameObject); }