Example #1
0
    public Equip(int id, int lv = 1)
    {
        ItemData.RootObject  itemData  = ItemData.GetData(id);
        EquipData.RootObject equipData = EquipData.GetData(id);

        if (itemData != null && equipData != null)
        {
            ID   = id;
            Name = itemData.GetName();
            Lv   = lv;
            if (lv > 1)
            {
                Name += "+" + (Lv - 1);
            }
            Comment      = itemData.GetComment();
            Icon         = itemData.Icon;
            Volume       = itemData.Volume;
            Price        = itemData.Price;
            Amount       = 1;
            CanCook      = itemData.CanCook;
            CanBeStacked = itemData.CanBeStacked;
            Type         = itemData.Type;

            EquipType    = equipData.Type;
            ATK          = Mathf.RoundToInt(equipData.ATK * (1 + (Lv - 1) * 0.1f));
            DEF          = Mathf.RoundToInt(equipData.DEF * (1 + (Lv - 1) * 0.1f));
            MTK          = Mathf.RoundToInt(equipData.MTK * (1 + (Lv - 1) * 0.1f));
            MEF          = Mathf.RoundToInt(equipData.MEF * (1 + (Lv - 1) * 0.1f));
            UpgradePrice = equipData.UpgradePrice;
        }
        else
        {
            Debug.Log("裝備資料不存在!");
        }
    }
Example #2
0
    public List <Equip> GetEquipListByType(Type type, EquipData.TypeEnum equipType)
    {
        Equip        equip;
        List <Item>  itemList;
        List <Equip> equipList = new List <Equip>();

        if (type == Type.Bag)
        {
            itemList = _bagTypeDic[ItemData.TypeEnum.Equip];
        }
        else
        {
            itemList = _warehouseTypeDic[ItemData.TypeEnum.Equip];
        }

        for (int i = 0; i < itemList.Count; i++)
        {
            equip = (Equip)itemList[i];
            if (equip.EquipType == equipType)
            {
                equipList.Add(equip);
            }
        }

        if (equipType == EquipData.TypeEnum.Weapon)
        {
            equipList.Insert(0, _defaultWeapon);
        }
        else if (equipType == EquipData.TypeEnum.Armor)
        {
            equipList.Insert(0, _defaultArmor);
        }

        return(equipList);
    }
Example #3
0
    public void TakeOffEquip(EquipData.TypeEnum type, out Equip oldEquip)
    {
        oldEquip = null;
        if (type == EquipData.TypeEnum.Weapon)
        {
            //Weapon = _defaultWeapon;
            SetEquip(_defaultWeapon, out oldEquip);
        }
        else if (type == EquipData.TypeEnum.Armor)
        {
            //Armor = _defaultArmor;
            SetEquip(_defaultArmor, out oldEquip);
        }

        //ItemManager.Instance.AddEquip(type, equip);
    }
Example #4
0
    public Equip(Equip equip)
    {
        ID           = equip.ID;
        Name         = equip.Name;
        Lv           = equip.Lv;
        Comment      = equip.Comment;
        Icon         = equip.Icon;
        Volume       = equip.Volume;
        Price        = equip.Price;
        Amount       = 1;
        CanCook      = equip.CanCook;
        CanBeStacked = equip.CanBeStacked;
        Type         = equip.Type;

        EquipType    = equip.EquipType;
        ATK          = equip.ATK;
        DEF          = equip.DEF;
        MTK          = equip.MTK;
        MEF          = equip.MEF;
        UpgradePrice = equip.UpgradePrice;
    }
Example #5
0
 public Equip(EquipData.TypeEnum type) //default equip
 {
     Type      = ItemData.TypeEnum.Equip;
     EquipType = type;
     Name      = "無";
 }