예제 #1
0
        // EQUIPMENT: -----------------------------------------------------------------------------

        public virtual bool CanEquipItem(GameObject target, int uuid, int itemType)
        {
            CharacterEquipment equipment = this.RequireEquipment(target);

            return(
                equipment.CanEquip(uuid) &&
                this.itemsCatalogue[uuid].equipable &&
                (this.itemsCatalogue[uuid].itemTypes & (1 << itemType)) > 0 &&
                this.itemsCatalogue[uuid].conditionsEquip.Check(target)
                );
        }
예제 #2
0
        public virtual bool Equip(GameObject target, int uuid, int itemType)
        {
            if (this.CanEquipItem(target, uuid, itemType))
            {
                CharacterEquipment equipment = this.RequireEquipment(target);
                if (equipment.CanEquip(uuid) && equipment.EquipItem(uuid, itemType))
                {
                    if (this.eventOnEquip != null)
                    {
                        this.eventOnEquip.Invoke(target, uuid);
                    }
                    if (this.eventChangePlayerInventory != null)
                    {
                        this.eventChangePlayerInventory.Invoke();
                    }
                    return(true);
                }

                return(false);
            }

            return(false);
        }