Advertisement
dronkowitz

ChangeGate.cs

May 19th, 2021 (edited)
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class ChangeGate : MonoBehaviour
  6. {
  7.     public CHARACTERTYPES gateType = CHARACTERTYPES.Speed;
  8.     public GameObject speed, fly, power;
  9.     // Start is called before the first frame update
  10.     void Start()
  11.     {
  12.         switch (gateType)
  13.         {
  14.             case CHARACTERTYPES.Speed:
  15.                 speed.SetActive(true);
  16.                 break;
  17.             case CHARACTERTYPES.Fly:
  18.                 fly.SetActive(true);
  19.                 break;
  20.             case CHARACTERTYPES.Power:
  21.                 power.SetActive(true);
  22.                 break;
  23.         }
  24.     }
  25.  
  26.     // Update is called once per frame
  27.     void Update()
  28.     {
  29.  
  30.     }
  31.  
  32.     private void OnTriggerEnter(Collider other)
  33.     {
  34.         if (other.gameObject.CompareTag("Player"))
  35.         {
  36.             FindObjectOfType<CharacterSwitch>().SetCharacter(gateType);
  37.         }
  38.     }  
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement