public void PlaceItem(string slotName, Vector3 pos, GameObject newParent) { if (!SlotNotEmpty(slotName)) { return; } GameObject item = _inventory[slotName]; EquipmentPool.DropGameObject(gameObject, _inventory[slotName], pos); ClearInventorySlot(slotName); if (item != null && newParent != null) { item.transform.parent = newParent.transform; World.ReorderGameobjectsOnTile(pos); } // RpcAdjustItemParent(item, newParent); // if ( !SlotNotEmpty(slotName) ) return; // GameObject item = _inventory[slotName]; // EquipmentPool.DropGameObject(gameObject, _inventory[slotName], pos); // _inventory[slotName] = null; // if (item != null && newParent != null) // { // item.transform.parent = newParent.transform; // World.ReorderGameobjectsOnTile(pos); // } // RpcAdjustItemParent(item, newParent); // equipment.ClearItemSprite(slotName); }
[Command] //Remember with the parent you can only send networked objects: public void CmdPlaceItem(string slotName, Vector3 pos, GameObject newParent, bool isTileMap) { if (!SlotNotEmpty(slotName)) { return; } GameObject item = Inventory[slotName]; EquipmentPool.DropGameObject(gameObject, Inventory[slotName], pos); ClearInventorySlot(slotName); if (item != null && newParent != null) { if (isTileMap) { var tileChangeManager = newParent.GetComponent <TileChangeManager>(); item.transform.parent = tileChangeManager.ObjectParent.transform; } else { item.transform.parent = newParent.transform; } // TODO // ReorderGameobjectsOnTile(pos); } }
public void PlaceItem(string slotName, Vector3 pos, GameObject newParent) { if (!SlotNotEmpty(slotName)) { return; } GameObject item = _inventory[slotName]; EquipmentPool.DropGameObject(gameObject, _inventory[slotName], pos); ClearInventorySlot(slotName); if (item != null && newParent != null) { item.transform.parent = newParent.transform; World.ReorderGameobjectsOnTile(pos); } }
public bool ValidateDropItem(string slot, bool forceClientInform /* = false*/) { //decline if not dropped from hands? if (_inventory.ContainsKey(slot) && _inventory[slot]) { EquipmentPool.DropGameObject(gameObject, _inventory[slot]); // RpcAdjustItemParent(_inventory[slot], null); _inventory[slot] = null; equipment.ClearItemSprite(slot); UpdateSlotMessage.Send(gameObject, slot, null, forceClientInform); return(true); } Debug.Log("Object not found in Inventory for: " + gameObject.name); return(false); }
[Command][Obsolete]//see placeitem public void CmdPlaceItemCupB(string eventName, Vector3 pos, GameObject newParent) { if (_inventory.ContainsKey(eventName)) { if (_inventory[eventName] != null) { GameObject item = _inventory[eventName]; EquipmentPool.DropGameObject(gameObject, _inventory[eventName], pos); _inventory[eventName] = null; ClosetControl closetCtrl = newParent.GetComponent <ClosetControl>(); item.transform.parent = closetCtrl.items.transform; RpcAdjustItemParentCupB(item, newParent); equipment.ClearItemSprite(eventName); } } }
public void CmdDropItem(string eventName) { if (_inventory.ContainsKey(eventName)) { if (_inventory[eventName] != null) { GameObject item = _inventory[eventName]; EquipmentPool.DropGameObject(gameObject, _inventory[eventName]); RpcAdjustItemParent(_inventory[eventName], null); _inventory[eventName] = null; equipment.ClearItemSprite(eventName); } else { Debug.Log("Object not found in Inventory"); } } }
public void CmdPlaceItem(string eventName, Vector3 pos, GameObject newParent) { if (ServerCache.ContainsKey(eventName)) { if (ServerCache[eventName] != null) { GameObject item = ServerCache[eventName]; EquipmentPool.DropGameObject(gameObject.name, ServerCache[eventName], pos); ServerCache[eventName] = null; if (item != null && newParent != null) { item.transform.parent = newParent.transform; World.ReorderGameobjectsOnTile(pos); } RpcAdjustItemParent(item, newParent); equipment.ClearItemSprite(eventName); } } }
public void CmdDropItem(string eventName) { if (ServerCache.ContainsKey(eventName)) { if (ServerCache[eventName] != null) { GameObject item = ServerCache[eventName]; EquipmentPool.DropGameObject(gameObject.name, ServerCache[eventName]); RpcAdjustItemParent(ServerCache[eventName], null); ServerCache[eventName] = null; equipment.ClearItemSprite(eventName); } else { Debug.Log("Object not found in ServerCache"); } } }
public void DropItem(string slot = "", bool forceClientInform = true) { //Drop random item if (slot == "") { slot = "uniform"; foreach (var key in Inventory.Keys) { if (Inventory[key]) { slot = key; break; } } } EquipmentPool.DropGameObject(gameObject, Inventory[slot]); Inventory[slot] = null; equipment.ClearItemSprite(slot); UpdateSlotMessage.Send(gameObject, slot, null, forceClientInform); }
public void RemoveFromEquipmentPool(GameObject obj) { EquipmentPool.DropGameObject(gameObject, obj); }
public void CmdDropItemNotInUISlot(GameObject obj) { EquipmentPool.DropGameObject(gameObject, obj); }