// Start is called before the first frame update void Start() { //Check if there is already an instance of SoundManager if (instance == null) { //if not, set it to this. instance = this; } //If instance already exists: else if (instance != this) { //Destroy this, this enforces our singleton pattern so there can only be one instance of SoundManager. Destroy(gameObject); BoltConsole.Write("ItemBox copy destroyed"); } gamestate = GameObject.Find("GameState(Clone)").GetComponent <NetworkGameState>(); localPlayer = GameObject.FindGameObjectWithTag("LocalPlayer").GetComponent <Player>(); itemForGrabsStr = gamestate.ItemForGrabs(); if (itemForGrabsStr != null && !itemForGrabsStr.Equals("")) { textStatus.text = yesItemHere; itemObjNetwork = ItemList.instance.GetItemFromName(itemForGrabsStr); itemSlotButton.onClick.AddListener(() => inventory.ShowThirdPartyItemInfo(itemObjNetwork)); itemForGrabsImage.sprite = itemObjNetwork.sprite; itemForGrabsImage.enabled = true; } else { textStatus.text = noItemHere; } }
public void CollectItemFromNetwork() { textStatus.text = noItemHere; ItemObject newItem = ItemList.instance.GetItemFromName(gamestate.ItemForGrabs()); localPlayer.Spellcaster.AddToInventory(newItem); NetworkManager.s_Singleton.PickUpItem(); }