Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class WeaponManager : MonoBehaviour {
- public List<Gun> Weapons = new List<Gun>();
- public int CurWeapon;
- public static WeaponManager Instance;
- // Use this for initialization
- void Start () {
- Instance = this;
- }
- // Update is called once per frame
- void Update () {
- CurWeapon = GUIManager.Instance.CurWeapon;
- }
- public void Spawn()
- {
- CurWeapon = GUIManager.Instance.CurWeapon;
- transform.root.GetComponent<Character> ().Server_GetGun (Weapons [CurWeapon].Name);
- ApplyWeapon();
- }
- public void ApplyWeapon()
- {
- foreach (Gun gu in Weapons)
- {
- if(gu == Weapons[CurWeapon])
- {
- gu.gameObject.SetActive(true);
- }
- else
- {
- gu.gameObject.SetActive(false);
- }
- }
- }
- public static Gun FindWeapon(string Name)
- {
- foreach (Gun Gu in Instance.Weapons)
- {
- if(Name == Gu.Name)
- return Gu;
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement