private void SwitchCheck(InventoryText player, Item theItem, GameObject obj) { switch (theItem.ItemType) { case ItemType.None: break; case ItemType.Wood: RemoveItem(player.woodAmount, player.WoodAmounttext, theItem); CheckForGameObject(obj); break; case ItemType.Stone: RemoveItem(player.stoneAmount, player.StoneAmounttext, theItem); CheckForGameObject(obj); break; case ItemType.Metal: RemoveItem(player.metalAmount, player.MetalAmounttext, theItem); CheckForGameObject(obj); break; case ItemType.Goop: RemoveItem(player.goopAmount, player.GoopAmounttext, theItem); CheckForGameObject(obj); break; default: throw new ArgumentOutOfRangeException(); } }
private void Start() { _trashBagText = transform.GetChild(0).GetChild(0).GetChild(2).GetChild(0).GetComponent <InventoryText>(); //_trashBagText = transform.Find("TrashBagScore").gameObject.GetComponent<InventoryText>(); _paperText = transform.GetChild(0).GetChild(0).GetChild(2).GetChild(1).GetComponent <InventoryText>(); //_paperText = transform.Find("PaperScore").gameObject.GetComponent<InventoryText>(); _bagStateText = transform.GetChild(0).GetChild(0).GetChild(2).GetChild(2).GetComponent <InventoryText>(); //_bagStateText = transform.Find("BagStateScore").gameObject.GetComponent<InventoryText>(); }
public void RemoveAllFromInventory(GameObject obj, InventoryText player) { // CheckForGameObject(obj); // inventory.CurrentInventory.Clear(); // player.woodAmount = 0; // player.WoodAmounttext.text = player.woodAmount.ToString(); // player.stoneAmount = 0; // player.StoneAmounttext.text = player.stoneAmount.ToString(); // player.metalAmount = 0; // player.MetalAmounttext.text = player.metalAmount.ToString(); // player.goopAmount = 0; // player.GoopAmounttext.text = player.goopAmount.ToString(); }
void SwitchCheck(InventoryText player) { if (player == null) { return; } switch (Item.ItemType) { case ItemType.None: break; case ItemType.Wood: player.woodAmount++; player.WoodAmounttext.text = player.woodAmount.ToString(); var tweenItWood = player.WoodAmounttext.GetComponent <TweenScaleBehaviour>(); tweenItWood.TweenScale(); StartCoroutine(tweenItWood.TweenItBackward()); break; case ItemType.Stone: player.stoneAmount++; player.StoneAmounttext.text = player.stoneAmount.ToString(); var tweenItStone = player.StoneAmounttext.GetComponent <TweenScaleBehaviour>(); tweenItStone.TweenScale(); StartCoroutine(tweenItStone.TweenItBackward()); break; case ItemType.Metal: player.metalAmount++; player.MetalAmounttext.text = player.metalAmount.ToString(); var tweenItMetal = player.MetalAmounttext.GetComponent <TweenScaleBehaviour>(); tweenItMetal.TweenScale(); StartCoroutine(tweenItMetal.TweenItBackward()); break; case ItemType.Goop: player.goopAmount++; player.GoopAmounttext.text = player.goopAmount.ToString(); var tweenItGoop = player.GoopAmounttext.GetComponent <TweenScaleBehaviour>(); tweenItGoop.TweenScale(); StartCoroutine(tweenItGoop.TweenItBackward()); break; default: throw new ArgumentOutOfRangeException(); } }
private void Start() { objectList = new Dictionary <string, GameObject>(); objectList1 = new Dictionary <string, GameObject>(); objectList2 = new Dictionary <string, GameObject>(); objectList3 = new Dictionary <string, GameObject>(); inventory.StartingInventory = new List <Item>(); if (inventory.InventoryCap <= 0) { Debug.LogWarning("Inventory Size must be Greater than 0"); inventory.InventoryCap = 1; } switch (GetComponent <Transform>().tag) { case "P1": P1 = gameObject.transform.parent.GetComponentInChildren <InventoryText>(); P2 = null; P3 = null; P4 = null; break; case "P2": P1 = null; P2 = gameObject.transform.parent.GetComponentInChildren <InventoryText>(); P3 = null; P4 = null; break; case "P3": P1 = null; P2 = null; P3 = gameObject.transform.parent.GetComponentInChildren <InventoryText>(); P4 = null; break; case "P4": P1 = null; P2 = null; P3 = null; P4 = gameObject.transform.parent.GetComponentInChildren <InventoryText>(); break; default: break; } }
void Awake() { inv_text = FindObjectOfType <InventoryText>(); }
// Use this for initialization void Awake() { inventory = new GameObject[inventorySpace]; inventoryText = GameObject.FindGameObjectWithTag("InventoryText").GetComponent <InventoryText>(); }