Advertisement
jretchy

Untitled

May 16th, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1.  public GameObject singleChar;
  2.     public GameObject bothChar;
  3.  
  4.     public GameObject charOne;
  5.     public GameObject charTwo;
  6.  
  7.     private void Start()
  8.     {
  9.         singleChar.SetActive(true);
  10.         bothChar.SetActive(false);
  11.     }
  12.  
  13.     private void OnTriggerEnter(Collider other)
  14.     {
  15.         if (other.CompareTag("Player") || other.CompareTag("PlayerTwo"))
  16.         {
  17.             singleChar.SetActive(true);
  18.             bothChar.SetActive(false);
  19.         }
  20.     }
  21.  
  22.     private void Update()
  23.     {
  24.         if (charOne.transform.position.x < -430f && charTwo.transform.position.x < -430f)
  25.         {
  26.             singleChar.SetActive(false);
  27.             bothChar.SetActive(true);
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement