Exemplo n.º 1
0
 void Awake()
 {
     if (gunCheck == null)
     {
         gunCheck = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     health     = 1.0f;
     shake      = gameObject.GetComponent <CameraShake>();
     source     = GameObject.Find("AudioSource").GetComponent <AudioSource>();
     gunCheck   = GunCheck.gunCheck;
     weaponList = GameObject.FindGameObjectsWithTag("Weapon");
     foreach (GameObject weapon in weaponList)
     {
         weapon.SetActive(false);
         if (weapon.name == gunCheck.currentPrimary)
         {
             weapons.Add(weapon);
             weapon.SetActive(true);
         }
         else if (weapon.name == gunCheck.currentSecondary)
         {
             weapons.Add(weapon);
         }
     }
     jokeWeapon = GameObject.FindGameObjectWithTag("JokeGun");
     jokeWeapon.SetActive(false);
     GameObject.Find("GunName").GetComponent <Text>().text = weapons[currentWeapon].name;
 }