using System.Collections; using System.Collections.Generic; using UnityEngine; public class RecoverUp : MonoBehaviour { public bool healthMode = true; public HealthController HC; public TimeController TC; // Use this for initialization void Start () { HC = GameObject.FindGameObjectWithTag("Player").GetComponent(); TC = GameObject.FindGameObjectWithTag("Player").GetComponent(); } // Update is called once per frame void Update () { } private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { if (healthMode) { HC.health = 100; Destroy(this.gameObject); } else { TC.Stamina = TC.MaxStamina; Destroy(this.gameObject); } } } }