public void DropItemIntoWorld(ItemData item, Vector3 dropPosition, GameObject dropModelDefault) { if (item != null) { List <ItemData> items = new List <ItemData>(); items.Add(item); List <GameObject> dropItems = ItemConverter.ConvertToItemDropObject(items, true); if (dropParentObject == null) { dropParentObject = new GameObject("DroppedItems"); } foreach (GameObject dropItem in dropItems) { item.AssetBundle( (UnityEngine.Object bundleObj) => { GameObject dropObject; if (bundleObj != null) { dropObject = GameObjectInitilizer.initilizer.InitilizeGameObject(bundleObj); } else { dropObject = GameObjectInitilizer.initilizer.InitilizeGameObject(dropModelDefault); } ItemData itemData = dropObject.AddComponent <ItemData>(); itemData.SetItemData(item); ItemComponentInitalizer.InitializeItemWithComponents(dropObject.GetComponent <ItemData>(), AddComponetTo.prefab); dropObject.transform.position = dropPosition; dropObject.transform.parent = dropParentObject.transform; if (postDropObjectAction != null) { postDropObjectAction.DoGameObjectAction(dropObject); } } ); Destroy(dropItem); } } }
public void DropItemIntoWorld(ItemData item, Vector3 dropPosition, GameObject dropModelDefault) { if (item != null) { List<ItemData> items = new List<ItemData>(); items.Add(item); List<GameObject> dropItems = ItemConverter.ConvertToItemDropObject(items, true); if(dropParentObject == null) dropParentObject = new GameObject("DroppedItems"); foreach (GameObject dropItem in dropItems) { item.AssetBundle( (UnityEngine.Object bundleObj) => { GameObject dropObject; if (bundleObj != null) dropObject = GameObjectInitilizer.initilizer.InitilizeGameObject(bundleObj); else dropObject = GameObjectInitilizer.initilizer.InitilizeGameObject(dropModelDefault); ItemData itemData = dropObject.AddComponent<ItemData>(); itemData.SetItemData(item); ItemComponentInitalizer.InitializeItemWithComponents(dropObject.GetComponent<ItemData>(), AddComponetTo.prefab); dropObject.transform.position = dropPosition; dropObject.transform.parent = dropParentObject.transform; if (postDropObjectAction != null) postDropObjectAction.DoGameObjectAction(dropObject); } ); Destroy(dropItem); } } }
public void DropItemIntoWorld(ItemData item, Vector3 dropPosition, GameObject dropModelDefault, bool isDropSingleAmount) { if (item != null) { Debug.Log("Loading asset :" + item.assetURL.ToRichColor(Color.white)); item.AssetBundle((UnityEngine.Object bundleObj) => { if (isDropSingleAmount) { for (int i = 0; i < item.stackSize; i++) { dropPosition = DropItem(item, dropPosition, dropModelDefault, bundleObj, 1); } } else { dropPosition = DropItem(item, dropPosition, dropModelDefault, bundleObj, item.stackSize); } } ); } }
void equipment_AddedItem(ItemData item, bool isSave) { item.AssetBundle(GetItemCallback); currentItem = item; }
void equipment_AddedItem(ItemData item, bool isSave) { item.AssetBundle(GetItemCallback); currentItem = item; }