private void RemoveItem(Item_Pickupable.ItemType itemType) { IItem item = GetItem(itemType); if (item != null) { itemList.Remove(item); } Debug.Log(itemList.Count); }
//If theres enough space in our inventory // public void PickUp(IItem item) { itemList.Add(item); Item_Pickupable.ItemType itemType = item.GetItemType(); switch (itemType) { case Item_Pickupable.ItemType.Battery: PhotonView pv = item.GetPhotonView(); pv.RPC("OnPickup", RpcTarget.AllBufferedViaServer); break; case Item_Pickupable.ItemType.Knife: PhotonView s = item.GetPhotonView(); s.RPC("OnPickup", RpcTarget.AllBufferedViaServer); fightingController.SelectWeaponModel(Player_FightingController.Weapon.Knife); break; case Item_Pickupable.ItemType.Pistol: PhotonView r = item.GetPhotonView(); r.RPC("OnPickup", RpcTarget.AllBufferedViaServer); fightingController.SelectWeaponModel(Player_FightingController.Weapon.Pistol); break; } }
//Getters private IItem GetItem(Item_Pickupable.ItemType itemType) { //search inventory for itemtype return(itemList.FirstOrDefault(x => x.GetItemType() == itemType)); }