EnergyOrb.cs 499 B

1234567891011121314151617181920
  1. using UnityEngine;
  2. public class EnergyOrb : MonoBehaviour
  3. {
  4. [Header("Orb Save Data")]
  5. public string ID; // unique ID for each of this orb
  6. public bool Collected = false;
  7. private void OnTriggerEnter(Collider other)
  8. {
  9. if (other.CompareTag("Player") && !Collected)
  10. {
  11. Collected = true;
  12. gameObject.SetActive(false);
  13. // Send the GameManager that its been collected
  14. GameManager.Instance.CollectOrb();
  15. }
  16. }
  17. }