예제 #1
0
        public static GameItemCategory GetItemCategory(GameItemType itemType)
        {
            GameItemCategory itemCategory = GameItemCategory.None;

            _bindedItems.TryGetValue(itemType, out itemCategory);

            return(itemCategory);
        }
예제 #2
0
        //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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 public static bool IsValidCategory(GameItemType itemType, GameItemCategory category)
 {
     return(GetItemCategory(itemType) == category);
 }
예제 #6
0
 public static GameItemType GetRandomItem(GameItemCategory category)
 {
     return(_itemByCategory[category][UnityEngine.Random.Range(0, _itemByCategory[category].Count)]);
 }
예제 #7
0
 public void TakeOffEquipItems(GameItemCategory category)
 {
     EquippedItems.RemoveAll(c => GetItem(c).ItemCategory == category);
 }