public static GameItemCategory GetItemCategory(GameItemType itemType) { GameItemCategory itemCategory = GameItemCategory.None; _bindedItems.TryGetValue(itemType, out itemCategory); return(itemCategory); }
//TODO: Should use a builder - unrealistic to have all this in a single constructor, maybe a simpler dictionary-based set of properties? //TODO: This doesn't make sense to have a command passed that is specific to a weapon, maybe generalize to "Use"?? public GameItem(GameItemCategory category, int id, string name, int price, bool isUnique = false, IAction action = null) { Category = category; Id = id; Name = name; Price = price; IsUnique = isUnique; Action = action; }
private void DropItem(GameItemCategory category, Vector3 pos) { var dropItem = new DropItemInfo { CatalogId = GameItemTypeExtentions.GetRandomItem(category), Pos = pos, WorldId = Storage.GetUniqueWorldId() }; Model.AddItem(dropItem); var dropItemMessage = new CreateDropItemMsg { DropInfo = dropItem }; Server.SendToAll(dropItemMessage); }
private void DropItem(GameItemCategory category, Vector3 pos, int itemSpawnPointIndex = -1) { var dropItem = new DropItemInfo() { CatalogId = GameItemTypeExtensions.GetRandomItem(category), Pos = pos, ItemSpawnPointIndex = itemSpawnPointIndex, WorldId = Storage.GetUniqueWorldId() }; Model.AddItem(dropItem); var dropItemMessage = new CreateDropItemMsg() { DropInfo = dropItem }; Server.SendToAll(dropItemMessage); }
public static bool IsValidCategory(GameItemType itemType, GameItemCategory category) { return(GetItemCategory(itemType) == category); }
public static GameItemType GetRandomItem(GameItemCategory category) { return(_itemByCategory[category][UnityEngine.Random.Range(0, _itemByCategory[category].Count)]); }
public void TakeOffEquipItems(GameItemCategory category) { EquippedItems.RemoveAll(c => GetItem(c).ItemCategory == category); }