Exemplo n.º 1
0
        private BattleUnitSyncAttribute BattleSkillCostEnergy(SO_BattleSkill skill)
        {
            battleUnitAttribute.energy -= skill.energyCost;
            battleUnitAttribute.energy  = battleUnitAttribute.energy < 0 ? 0 : battleUnitAttribute.energy;

            BattleUnitSyncAttribute attribute = new BattleUnitSyncAttribute();

            attribute.hpChanged     = 0;
            attribute.currentHP     = battleUnitAttribute.hp;
            attribute.energyChanged = -skill.energyCost;
            attribute.currentEnergy = battleUnitAttribute.energy;
            attribute.currentBP     = battleUnitAttribute.BP;

            return(attribute);
        }
Exemplo n.º 2
0
        //刷新值显示
        private void RefreshAttribute(BattleUnitSyncAttribute attribute)
        {
            if (battleUnit == null || attribute == null)
            {
                return;
            }

            battleUnitInfo.text = battleUnit.battleUnitAttribute.battleUnitName;

            //刷新生命值
            battleUnitHealthBar.UpdateHealth(attribute.currentHP, battleUnit.battleUnitAttribute.maxHp);
            //刷新能量
            battleUnitHealthBar.UpdateEnergy(attribute.currentEnergy, battleUnit.battleUnitAttribute.maxEnergy);
            //刷新BP
            battleUnitHealthBar.UpdateBP(attribute.currentBP, EGameConstL.BPMax);

            //刷新下显示
            if (linkedUnitInfoView != null)
            {
                linkedUnitInfoView.SetArguments(battleUnit.mapGrid, battleUnit.battleUnitAttribute.hp > 0 ? battleUnit : null);
            }
        }
Exemplo n.º 3
0
        //被使用技能
        private void AcceptSkillResult(BattleUnitSyncAttribute sync)
        {
            if (sync != null)
            {
                battleUnitAttribute.hp = sync.currentHP;
                if (sync.newGrid != null)
                {
                    UtilityHelper.LogFormat("change mapgrid from {0} to {1}", battleUnitAttribute.hostBattleUnit.mapGrid, sync.newGrid);
                    //battleUnitAttribute.hostBattleUnit.mapGrid = sync.newGrid;

                    List <GridUnit> path = new List <GridUnit>();
                    MapNavigator.Instance.NewNavigate(battleUnitAttribute.hostBattleUnit, battleUnitAttribute.hostBattleUnit.mapGrid.battleMap,
                                                      battleUnitAttribute.hostBattleUnit.mapGrid, sync.newGrid, path);
                    MoveToTargetGrid(battleUnitAttribute.hostBattleUnit, sync.newGrid, path.ToArray());
                }

                if (battleUnitAttribute.hp <= 0)
                {
                    //被击败了
                    //从格子中移除
                    LeaveGrid();
                }
            }
        }