using System.Collections; using System.Collections.Generic; using UnityEngine; public class PowerDrop : MonoBehaviour { public float powerAmount = -100.0f; [SerializeField] private UnityEngine.UI.Text textField; private bool popped = false; void OnTriggerEnter(Collider other) { if (!popped) { if (other.tag == "Player") { other.GetComponent().PowerLevel += powerAmount; popped = true; Pop(); } } } // Use this for initialization void Start() { textField.text = powerAmount.ToString(); } // Update is called once per frame void Update() { } private void Pop() { GameObject.Destroy(gameObject); } }