Newer
Older
TheVengeance-Project-IADE-Unity2D / Assets / Scripts / UI / Upgrades / UpgradesArea.cs
@Rackday Rackday on 18 Aug 737 bytes Project Added
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class UpgradesArea : MonoBehaviour
  5. {
  6. public GameObject openUpgrades;
  7. [HideInInspector] public bool playerInRange;
  8. // Start is called before the first frame update
  9. void Start()
  10. {
  11. playerInRange = false;
  12. }
  13. private void OnTriggerEnter2D(Collider2D col)
  14. {
  15. if (col.CompareTag("Player"))
  16. {
  17. playerInRange = true;
  18. openUpgrades.gameObject.SetActive(true);
  19. }
  20. }
  21. private void OnTriggerExit2D(Collider2D col)
  22. {
  23. if (col.CompareTag("Player"))
  24. {
  25. playerInRange = false;
  26. openUpgrades.gameObject.SetActive(false);
  27. }
  28. }
  29. }