Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class WeaponManager : MonoBehaviour
  6. {
  7.     //Singleton instance so the weapons can be given to / taken away from the player easily from any script in the project
  8.     public static WeaponManager Instance = null;
  9.     void Awake() { Instance = this; }
  10.  
  11.     //Tracks and Toggles players access to the Shotgun weapon
  12.     public GameObject Shotgun;
  13.     public bool ShotgunAcquired = true;
  14.     public void ToggleShotgun(bool Enabled)
  15.     {
  16.         //Enable the Shotgunweapon
  17.         Debug.Log("Player has " + (Enabled ? "acquired" : "lost") + " the Shotgun.");
  18.         ShotgunAcquired = Enabled;
  19.         Shotgun.SetActive(Enabled);
  20.     }
  21.  
  22.     //Tracks and Toggles if the player has access to the PulseRifle weapon
  23.     public GameObject PulseRifle;
  24.     public bool PulseRifleAcquired = false;
  25.     public void TogglePulseRifle(bool Enabled)
  26.     {
  27.         Debug.Log("Player has " + (Enabled ? "acquired" : "lost") + " the PulseRifle.");
  28.         PulseRifleAcquired = Enabled;
  29.         PulseRifle.SetActive(Enabled);
  30.     }
  31.    
  32.     //Tracks and Toggles if the player has access to the RocketLauncher weapon
  33.     public GameObject RocketLauncher;
  34.     public bool RocketLauncherAcquired = false;
  35.     public void ToggleRocketLauncher(bool Enabled)
  36.     {
  37.         Debug.Log("Player has " + (Enabled ? "acquired" : "lost") + " the RocketLauncher.");
  38.         RocketLauncherAcquired = Enabled;
  39.         RocketLauncher.SetActive(Enabled);
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement