Exemplo n.º 1
0
 private void RecoverEnergy(BattleUnitAction battleUnitAction)
 {
     //数值改变
     battleUnitAttribute.energy += EGameConstL.EnergyRecoverPerRound;
     battleUnitAttribute.energy  = battleUnitAttribute.energy > battleUnitAttribute.maxEnergy ? battleUnitAttribute.maxEnergy : battleUnitAttribute.energy;
     //创建一个Action
     if (battleUnitAction != null)
     {
         battleUnitAction.attributeUpdate                         = BattleUnitAttributeUpdate.Get();
         battleUnitAction.attributeUpdate.attribute               = new BattleUnitSyncAttribute();
         battleUnitAction.attributeUpdate.attribute.hpChanged     = 0;
         battleUnitAction.attributeUpdate.attribute.currentHP     = battleUnitAttribute.hp;
         battleUnitAction.attributeUpdate.attribute.energyChanged = EGameConstL.EnergyRecoverPerRound;
         battleUnitAction.attributeUpdate.attribute.currentEnergy = battleUnitAttribute.energy;
     }
 }
Exemplo n.º 2
0
        private void RecoverEnergy()
        {
            //数值改变
            battleUnitAttribute.energy += EGameConstL.EnergyRecoverPerRound;
            battleUnitAttribute.energy  = battleUnitAttribute.energy > battleUnitAttribute.maxEnergy ? battleUnitAttribute.maxEnergy : battleUnitAttribute.energy;

            //创建一个Action
            BattleUnitAttributeUpdate action = BattleUnitActionEvent.CreateEvent <BattleUnitAttributeUpdate>(BattleUnitActionType.AttributeUpdate, this);

            action.attribute               = new BattleUnitSyncAttribute();
            action.attribute.hpChanged     = 0;
            action.attribute.currentHP     = battleUnitAttribute.hp;
            action.attribute.energyChanged = EGameConstL.EnergyRecoverPerRound;
            action.attribute.currentEnergy = battleUnitAttribute.energy;

            battleField.AppendBattleAction(action);
        }
Exemplo n.º 3
0
 //更新数值
 private IEnumerator PlayAttributeUpdateAction(BattleUnitAttributeUpdate action)
 {
     RefreshAttribute(action.attribute);
     yield return(EGameConstL.WaitForDotOneSecond);
 }