예제 #1
0
        private void CmdPickItem(GameObject itemObject, SlotEnum slot)
        {
            Item.Item item = itemObject.GetComponent <Item.Item>();

            switch (slot)
            {
            case SlotEnum.LeftHand:

                LeftHandItem = itemObject;
                item.Holder  = gameObject;
                break;

            case SlotEnum.RightHand:

                RightHandItem = itemObject;
                item.Holder   = gameObject;
                break;

            case SlotEnum.Back:
                break;

            case SlotEnum.Belt:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(slot), slot, null);
            }
        }
예제 #2
0
 public EncounterItem(int Pid, int Min, int Max, int Slot)
 {
     this.Item = new Item(Pid);
     this.Min  = Min;
     this.Max  = Max;
     this.Slot = (SlotEnum)Slot;
 }
예제 #3
0
 public Weapon(SlotEnum Slot, int Weight, int Gold_Value,
               int str_mod, int agi_mod, int dex_mod, int dmg)
     : base(Slot, Weight, Gold_Value)
 {
     this.str_mod = str_mod;
     this.agi_mod = agi_mod;
     this.dex_mod = dex_mod;
     this.dmg     = dmg;
 }
예제 #4
0
 public Armor(SlotEnum Slot, int Weight, int Gold_Value,
              int str_mod, int agi_mod, int dex_mod, int armor, ArmorType type)
     : base(Slot, Weight, Gold_Value)
 {
     this.str_mod = str_mod;
     this.agi_mod = agi_mod;
     this.dex_mod = dex_mod;
     this.armor   = armor;
     this.type    = type;
 }
예제 #5
0
        public override void Click()
        {
            SlotEnum slot = PlayerActionController.Current.ActiveHand;
            Item     item = LocalPlayer.GetItemBySlot(slot);

            if (item != null)
            {
                LocalPlayer.DropItem(slot, LocalPlayer.Cell, Vector2.zero);
            }
        }
예제 #6
0
        private void CmdExchangeItem(SlotEnum source, SlotEnum dest)
        {
            Item.Item sourceItem = GetItemBySlot(source);
            Item.Item destItem   = GetItemBySlot(dest);

            if (Item.Item.CanBePlaced(sourceItem, dest) && Item.Item.CanBePlaced(destItem, source))
            {
                SetItemBySlot(destItem, source);
                SetItemBySlot(sourceItem, dest);
            }
        }
예제 #7
0
        public static bool CanBePlaced(Item item, SlotEnum slot)
        {
            // Empty space can be placed anywhere :)
            if (item == null)
            {
                return(true);
            }

            if (slot == SlotEnum.LeftHand || slot == SlotEnum.RightHand)
            {
                return(true);
            }

            var wearable = item as IWearable;

            return(wearable?.AppropriateSlot == slot);
        }
예제 #8
0
        //public override bool IsLying => IsMobLying;


        public Item.Item GetItemBySlot(SlotEnum slot)
        {
            Item.Item item = null;
            switch (slot)
            {
            case SlotEnum.LeftHand:

                if (LeftHandItem != null)
                {
                    item = LeftHandItem.GetComponent <Item.Item>();
                }
                break;

            case SlotEnum.RightHand:

                if (RightHandItem != null)
                {
                    item = RightHandItem.GetComponent <Item.Item>();
                }
                break;

            case SlotEnum.Back:
                throw new NotImplementedException();

            case SlotEnum.Belt:
                throw new NotImplementedException();

            case SlotEnum.Costume:
                if (CostumeItem != null)
                {
                    item = CostumeItem.GetComponent <Item.Item>();
                }
                break;

            case SlotEnum.Hardsuit:
                break;

            case SlotEnum.Gloves:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(slot), slot, null);
            }

            return(item);
        }
예제 #9
0
        private void CmdDropItem(SlotEnum slot, int cellX, int cellY, Vector2 position)
        {
            Item.Item item = null;

            switch (slot)
            {
            case SlotEnum.LeftHand:
                if (LeftHandItem != null)
                {
                    item = LeftHandItem.GetComponent <Item.Item>();
                }
                LeftHandItem = null;
                break;

            case SlotEnum.RightHand:
                if (RightHandItem != null)
                {
                    item = RightHandItem.GetComponent <Item.Item>();
                }
                RightHandItem = null;
                break;

            case SlotEnum.Back:
                break;

            case SlotEnum.Belt:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(slot), slot, null);
            }

            if (item)
            {
                item.Holder     = null;
                item.Cell       = new Vector2Int(cellX, cellY);
                item.CellOffset = position;
            }
        }
예제 #10
0
        private void SetItemBySlot(Item.Item item, SlotEnum slot)
        {
            GameObject itemGo = null;

            if (item != null)
            {
                itemGo = item.gameObject;
            }

            switch (slot)
            {
            case SlotEnum.LeftHand:
                LeftHandItem = itemGo;
                break;

            case SlotEnum.RightHand:
                RightHandItem = itemGo;
                break;

            case SlotEnum.Back:
                throw new NotImplementedException();

            case SlotEnum.Belt:
                throw new NotImplementedException();

            case SlotEnum.Costume:
                CostumeItem = itemGo;
                break;

            case SlotEnum.Hardsuit:
                break;

            case SlotEnum.Gloves:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(slot), slot, null);
            }
        }
예제 #11
0
 private void CmdApplyItemSlot(SlotEnum activeHand, GameObject interactableGo)
 {
     Item.Item activeItem = GetItemBySlot(activeHand);
     interactableGo.GetComponent <IPlayerInteractable>().ApplyItemServer(activeItem);
 }
예제 #12
0
 // Interaction section
 public void PickItem(Item.Item item, SlotEnum slot)
 {
     CmdPickItem(item.gameObject, slot);
 }
예제 #13
0
 public override void Decode(MinecraftStream stream)
 {
     EntityId = stream.ReadVarInt();
     Slot     = (SlotEnum)stream.ReadVarInt();
     Item     = stream.ReadSlot();
 }
예제 #14
0
 public Item(SlotEnum Slot, int Weight, int Gold_Value)
 {
     this.Slot       = Slot;
     this.Weight     = Weight;
     this.Gold_Value = Gold_Value;
 }
예제 #15
0
 public void DropItem(SlotEnum slot, Vector2Int cell, Vector2 offset)
 {
     CmdDropItem(slot, cell.x, cell.y, offset);
 }
예제 #16
0
 public Equipment(SlotEnum Slot, int Weight, int Gold_Value)
     : base(Slot, Weight, Gold_Value)
 {
     Durability = 100;
     IsBroken   = false;
 }
예제 #17
0
        // TODO Throw item

        public void MoveItem(SlotEnum source, SlotEnum destination)
        {
            CmdExchangeItem(source, destination);
        }
예제 #18
0
 public Consumable(SlotEnum Slot, int Weight, int Gold_Value, int UseCount)
     : base(Slot, Weight, Gold_Value)
 {
     this.UseCount = UseCount;
 }
예제 #19
0
 public void ApplyItem(SlotEnum activeHand, IPlayerInteractable interactable)
 {
     CmdApplyItemSlot(activeHand, interactable.gameObject);
 }
예제 #20
0
 public void SetSlot(int Slot)
 {
     this.Slot = (SlotEnum)Slot;
 }
예제 #21
0
 public void SetSlot(int Slot)
 {
     this.Slot = (SlotEnum)Slot;
 }