//--------------------------------------------------- // ExecuteSetItemState //--------------------------------------------------- void ExecuteSetItemState(ItemData.ITEM_TYPE itemType, Func <ItemSpawnData, int> DecisionFunc) { List <ItemSpawnData> itemList = GetSpawnStageItemList(itemType); if (itemList.Count <= 0) { return; } foreach (ItemSpawnData item in itemList) { int executeActorId = -1; StateMachine <CHARACTER_MOVE_STATE> stateMachine; if (_getReservItemList.ContainsKey(item.ActorId)) { continue; } executeActorId = DecisionFunc(item); if (executeActorId >= 0) { stateMachine = _characterStateList [executeActorId]; stateMachine.SetNextState(CHARACTER_MOVE_STATE.GET_ITEM, Common.CreateHashTable("itemActorId", item.ActorId)); _getReservItemList.Add(item.ActorId, executeActorId); } } }
public void RemoveEquipmentFromCharacter(ItemData.ITEM_TYPE aItemType) { if (IsEquipSlotFull(aItemType)) { m_Equipment[aItemType] = ItemData.ITEM_ID.NONE; } else { Debug.Log("Warning: aItemType:" + aItemType.ToString() + " does not have equipment."); } }
public bool IsEquipSlotFull(ItemData.ITEM_TYPE aItemType) { bool bIsSlotFull = false; if (m_Equipment[aItemType] != ItemData.ITEM_ID.NONE) { bIsSlotFull = true; } return(bIsSlotFull); }
//--------------------------------------------------- // GetSpawnStageItemList //--------------------------------------------------- List <ItemSpawnData> GetSpawnStageItemList(ItemData.ITEM_TYPE itemType) { List <ItemSpawnData> list = new List <ItemSpawnData>(); foreach (ItemSpawnData item in _stageItemDataList) { if (item.ItemType == itemType) { list.Add(item); } } return(list); }
//TODO: If, is player, take the previous equip item, and put it in inventory public void AddEquipmentToCharacter(ItemData.ITEM_ID aItemID) { if (aItemID != ItemData.ITEM_ID.NONE) { ItemData.ITEM_TYPE itemType = ItemData.ITEM_DICTIONARY[aItemID].GetItemType(); if (IsEquipSlotFull(itemType) == false) { m_Equipment[itemType] = aItemID; } else { Debug.Log("Warning: aItemID: " + aItemID + " cannot be added, the slot is already filled"); } } }
public ItemSpawnData(ItemData.ITEM_TYPE type, Vector2 blockPos, int actorId) { this.ItemType = type; this.BlockPos = blockPos; this.ActorId = actorId; }