private void AssignInventory(RuntimeInventory runtimeInventory, string inventoryData) { if (runtimeInventory) { runtimeInventory.localItems.Clear(); if (inventoryData.Length > 0) { string[] countArray = inventoryData.Split("|"[0]); foreach (string chunk in countArray) { string[] chunkData = chunk.Split(":"[0]); int _id = 0; int.TryParse(chunkData[0], out _id); int _count = 0; int.TryParse(chunkData[1], out _count); runtimeInventory.Add(_id, _count); } } } }
override public float Run() { RuntimeInventory runtimeInventory = GameObject.FindWithTag(Tags.persistentEngine).GetComponent <RuntimeInventory>(); if (runtimeInventory) { if (giveToPlayer) { runtimeInventory.Add(invID, 1); } runtimeInventory.SelectItemByID(invID); } return(0f); }
override public float Run() { RuntimeInventory runtimeInventory = GameObject.FindWithTag(Tags.persistentEngine).GetComponent <RuntimeInventory>(); if (runtimeInventory) { if (invAction == InvAction.Add) { runtimeInventory.Add(invID, amount); } else { runtimeInventory.Remove(invID, amount); } } return(0f); }