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 PlacingObject(string itemid, Vector3 position, Vector3 normal) { 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, Quaternion.identity); if (obj) { ObjectPlacing objplaced = obj.GetComponent <ObjectPlacing>(); objplaced.transform.forward = normal; objplaced.SetItemID(itemid); } } } } }
//直接放置物品 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); } } } } }