public void CmdRequestSpawnObject(Vector3 position, Quaternion rotation, string itemID, string itemData) { ItemData itemdata = UnitZ.itemManager.GetItemDataByID(itemID); if (itemdata) { if (itemdata.ItemFPS) { FPSItemPlacing fpsplacer = itemdata.ItemFPS.GetComponent <FPSItemPlacing>(); if (fpsplacer) { if (fpsplacer.Item) { GameObject obj = UnitZ.gameNetwork.RequestSpawnObject(fpsplacer.Item, position, rotation); if (obj) { ObjectPlacing objplaced = obj.GetComponent <ObjectPlacing>(); objplaced.SetItemUID(objplaced.GetUniqueID()); objplaced.SetItemID(itemID); objplaced.SetItemData(itemData); } } } } } }
//直接放置物品 public void DirectPlacingObject(string itemid, string itemuid, Vector3 position, Quaternion rotation) { //Debug.Log("Direct place "+itemid); ItemData itemdata = GetItemDataByID(itemid); if (itemdata.ItemFPS) { FPSItemPlacing fpsplacing = itemdata.ItemFPS.GetComponent <FPSItemPlacing>(); if (fpsplacing) { if (fpsplacing.Item) { GameObject obj = UnitZ.gameNetwork.RequestSpawnObject(fpsplacing.Item, position, rotation); if (obj) { ObjectPlacing objplaced = obj.GetComponent <ObjectPlacing>(); objplaced.SetItemID(itemid); objplaced.SetItemUID(itemuid); } } } } }