Advertisement
VenaSean

Inventory System v1

Nov 13th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class InventoryManager : MonoBehaviour {
  5.  
  6.     [Header("These stats change")]
  7.     public int invCapacity;
  8.  
  9.     [Header("These stats are STATic xD")]
  10.     public int maxCapacity = 32;
  11.  
  12.     [Header("These are item scripts")]
  13.     public bool gotMagazine = false;
  14.     public int magazineCount = 0;
  15.     public int magazineCapacity = 1;
  16.     public bool gotBat = false;
  17.     public int batCapacity = 5;
  18.     public bool gotGun = false;
  19.     public int gunCapacity = 3;
  20.  
  21.     [Header("These just make it work")]
  22.     public bool gunCounted = false;
  23.     public bool magazineCounted = false;
  24.     public bool batCounted = false;
  25.  
  26.     // Use this for initialization
  27.     void Start () {
  28.         invCapacity = maxCapacity;
  29.         GameObject theGun = GameObject.Find("TheGun");
  30.         GameObject thePlayer = GameObject.Find("Player");
  31.         GameObject theMagazine = GameObject.Find ("Magazine");
  32.     }
  33.    
  34.     // Update is called once per frame
  35.     void Update () {
  36.         if (gotGun == true && gunCounted == false) {
  37.             invCapacity -= gunCapacity;
  38.             gunCounted = true;
  39.         }
  40.         if (magazineCount > 0 && gotMagazine == true && magazineCounted == false) {
  41.             invCapacity -= magazineCount * magazineCapacity;
  42.             magazineCount = 0;
  43.             magazineCounted = true;
  44.             gotMagazine = false;
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement