roomChecker.cs 819 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class roomChecker : MonoBehaviour
  5. {
  6. public GameObject outerGrid;
  7. public GameObject caveGrid;
  8. private void OnTriggerEnter2D(Collider2D other) {
  9. if(other.tag == "Player"){
  10. if(other.transform == playerNetwork.localPlayerTransform){
  11. outerGrid.SetActive(false);
  12. caveGrid.SetActive(true);
  13. }
  14. }
  15. }
  16. private void OnTriggerExit2D(Collider2D other) {
  17. if(other.tag == "Player"){
  18. if(other.transform == playerNetwork.localPlayerTransform){
  19. outerGrid.SetActive(true);
  20. caveGrid.SetActive(false);
  21. }
  22. }
  23. }
  24. void Update()
  25. {
  26. }
  27. }