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); } }
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; }
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; }
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; }
public override void Click() { SlotEnum slot = PlayerActionController.Current.ActiveHand; Item item = LocalPlayer.GetItemBySlot(slot); if (item != null) { LocalPlayer.DropItem(slot, LocalPlayer.Cell, Vector2.zero); } }
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); } }
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); }
//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); }
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; } }
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); } }
private void CmdApplyItemSlot(SlotEnum activeHand, GameObject interactableGo) { Item.Item activeItem = GetItemBySlot(activeHand); interactableGo.GetComponent <IPlayerInteractable>().ApplyItemServer(activeItem); }
// Interaction section public void PickItem(Item.Item item, SlotEnum slot) { CmdPickItem(item.gameObject, slot); }
public override void Decode(MinecraftStream stream) { EntityId = stream.ReadVarInt(); Slot = (SlotEnum)stream.ReadVarInt(); Item = stream.ReadSlot(); }
public Item(SlotEnum Slot, int Weight, int Gold_Value) { this.Slot = Slot; this.Weight = Weight; this.Gold_Value = Gold_Value; }
public void DropItem(SlotEnum slot, Vector2Int cell, Vector2 offset) { CmdDropItem(slot, cell.x, cell.y, offset); }
public Equipment(SlotEnum Slot, int Weight, int Gold_Value) : base(Slot, Weight, Gold_Value) { Durability = 100; IsBroken = false; }
// TODO Throw item public void MoveItem(SlotEnum source, SlotEnum destination) { CmdExchangeItem(source, destination); }
public Consumable(SlotEnum Slot, int Weight, int Gold_Value, int UseCount) : base(Slot, Weight, Gold_Value) { this.UseCount = UseCount; }
public void ApplyItem(SlotEnum activeHand, IPlayerInteractable interactable) { CmdApplyItemSlot(activeHand, interactable.gameObject); }
public void SetSlot(int Slot) { this.Slot = (SlotEnum)Slot; }
public void SetSlot(int Slot) { this.Slot = (SlotEnum)Slot; }