void SetItemToSlot(Item _item, int _ind) { if (_item != null) { var data = _item.Data; //add to data list itemDatas[_ind] = data; curItemProperties[_ind] = itemManager.GetItemProperty(data); //set item owner _item.SetOwner(unit); //positon item and parent _item.transform.position = spawnLoc.position; _item.transform.rotation = spawnLoc.rotation; _item.transform.SetParent(spawnLoc); //add to items prefab list curItems[_ind] = _item.gameObject; if (!setAllItemsActive) { SetCurItem(_ind); } else { SetAllItemsActive(); } } else { curItems[_ind] = null; itemDatas[_ind] = null; curItemProperties[_ind] = null; } }
void SetItemToSlot(Item _item, int _ind) { if (_item != null) { var data = _item.Data; //add to data list itemDatas[_ind] = data; curItemProperties[_ind] = itemManager.GetItemProperty(data); //set item owner _item.SetOwner(unit); //add to items prefab list curItems[_ind] = _item.gameObject; if (!setAllItemsActive) { SetCurItem(_ind); } else { SetAllItemsActive(); } } else { curItems[_ind] = null; itemDatas[_ind] = null; curItemProperties[_ind] = null; } }