示例#1
0
    protected override void onUpdate()
    {
        if (mode != GameBattleUnitActionItemMode.Equip)
        {
            return;
        }

        if (slots[selection].Item == null)
        {
            return;
        }

        if (!slots[selection].Enabled)
        {
            return;
        }

        if (slots[selection].Item.ItemType == GameItemType.Item)
        {
            return;
        }

        time += Time.deltaTime;

        if (time > 1.0f)
        {
            time = -9999;
            if (!GameEquipInfoUI.instance.IsShow)
            {
                GameEquipInfoUI.instance.showItem(unit.getUnitBase(), slots[selection].Item);

                RectTransform trans = slots[selection].GetComponent <RectTransform>();

                if (selection > 4)
                {
                    GameEquipInfoUI.instance.setPos(trans.anchoredPosition.x - 37.0f, trans.anchoredPosition.y - 71.0f);
                }
                else
                {
                    GameEquipInfoUI.instance.setPos(trans.anchoredPosition.x + 27.0f, trans.anchoredPosition.y - 71.0f);
                }

                GameEquipInfoUI.instance.show();
                GameEquipInfoUI.instance.showFade();
            }
        }
    }
示例#2
0
    public GameBattleUnit summonUnit(GameBattleUnit u, int id, int x, int y)
    {
        GameBattleUnit battleUnit = getUnitByID(id);

        if (battleUnit == null)
        {
            return(null);
        }

        if (battleUnit.IsShow || battleUnit.IsKilled)
        {
            return(null);
        }

        GameUnit unit = GameUnitData.instance.getData(battleUnit.UnitID);

        battleUnit.IsShow   = true;
        battleUnit.IsSummon = true;

        GameUnitBase unitBaseU = u.getUnitBase();
        GameUnitBase unitBase  = battleUnit.getUnitBase();

        unitBase.LV = unitBaseU.LV;

        unitBase.HP  = (short)(unitBaseU.HP * unit.HP / 100.0f);
        unitBase.MP  = (short)(unitBaseU.MP * unit.MP / 100.0f);
        unitBase.Str = (short)(unitBaseU.Str * unit.Str / 100.0f);
        unitBase.Vit = (short)(unitBaseU.Vit * unit.Vit / 100.0f);
        unitBase.Avg = (short)(unitBaseU.Avg * unit.Avg / 100.0f);
        unitBase.Int = (short)(unitBaseU.Int * unit.Int / 100.0f);
        unitBase.Luk = (short)(unitBaseU.Luk * unit.Luk / 100.0f);

        battleUnit.updateUnitData();

        battleUnit.initHPMP();
        battleUnit.clearMove();

        battleUnit.setPos(x, y);
        battleUnit.updateAnimation(GameAnimationDirection.South);
        battleUnit.updateAlive();

        return(battleUnit);
    }
示例#3
0
    public void levelUp(GameBattleUnit unit)
    {
        GameUnit     gameUnit = unit.getGameUnit();
        GameUnitBase unitBase = unit.getUnitBase();

        GameUnitLevelUp d = getData(unitBase.UnitID);

        if (d == null)
        {
            return;
        }

        if (unitBase.Exp < GameDefine.MAX_EXP)
        {
            return;
        }

        unitBase.Exp -= GameDefine.MAX_EXP;
        unitBase.LV++;

        if (unitBase.LV == GameDefine.MAX_LEVEL)
        {
            unitBase.Exp = 0;
        }

        lastData = new GameUnitLevelUp();

        lastData.HP = gameUnit.HPGrow;
        lastData.MP = gameUnit.MPGrow;

        lastData.StrBase = d.StrBase;
        lastData.StrRand = (short)UnityEngine.Random.Range(1, d.StrRand);
        lastData.VitBase = d.VitBase;
        lastData.VitRand = (short)UnityEngine.Random.Range(1, d.VitRand);
        lastData.IntBase = d.IntBase;
        lastData.IntRand = (short)UnityEngine.Random.Range(1, d.IntRand);
        lastData.AvgBase = d.AvgBase;
        lastData.AvgRand = (short)UnityEngine.Random.Range(1, d.AvgRand);
        lastData.LukBase = d.LukBase;
        lastData.LukRand = (short)UnityEngine.Random.Range(1, d.LukRand);

        lastData.HP += (short)(unitBase.Vit / 35.0f + UnityEngine.Random.Range(1, d.HP + 1));
        lastData.MP += (short)(unitBase.Int / 35.0f + UnityEngine.Random.Range(1, d.MP + 1));

        unitBase.HP  += lastData.HP;
        unitBase.MP  += lastData.MP;
        unitBase.Str += lastData.StrBase;
        unitBase.Str += lastData.StrRand;
        unitBase.Vit += lastData.VitBase;
        unitBase.Vit += lastData.VitRand;
        unitBase.Int += lastData.IntBase;
        unitBase.Int += lastData.IntRand;
        unitBase.Avg += lastData.AvgBase;
        unitBase.Avg += lastData.AvgRand;
        unitBase.Luk += lastData.LukBase;
        unitBase.Luk += lastData.LukRand;

        unitBase.BaseSpiritPower += 2;

        for (int i = 0; i < GameDefine.MAX_SLOT; i++)
        {
            if (d.Skill[i].SkillID == GameDefine.INVALID_ID)
            {
                continue;
            }

            if (unitBase.hasSkill(d.Skill[i].SkillID))
            {
                continue;
            }

            if (unit.SpiritPower[0] < d.Skill[i].SpiritRequest[0] ||
                unit.SpiritPower[1] < d.Skill[i].SpiritRequest[1] ||
                unit.SpiritPower[2] < d.Skill[i].SpiritRequest[2] ||
                unit.SpiritPower[3] < d.Skill[i].SpiritRequest[3] ||
                unit.SpiritPower[4] < d.Skill[i].SpiritRequest[4])
            {
                continue;
            }

            if (unit.LV < d.Skill[i].LV)
            {
                continue;
            }

            unitBase.addSkill(d.Skill[i].SkillID);

            lastData.Skill[0]         = new GameUnitLevelUpSkillLearn();
            lastData.Skill[0].SkillID = d.Skill[i].SkillID;
        }

        unit.updateUnitData();
    }