Beispiel #1
0
    void Update()
    {
        TimeSinceLastHit += Time.deltaTime;

        if (!IsAlive)
            return;

        if (AbilityQue.Count > 0 && _currentAction == null)
        {
            _currentAction = AbilityQue.Dequeue();

            Character target = _currentAction.DestinationGameObject.GetComponent<Character>();
            if (!target.IsAlive)
            {
                _currentAction = null;
                return;
            }

            _currentAction.Ability.AbilityCompleted += (ability) =>
            {
                _currentAction = null;
            };
            _currentAction.Ability.UseAbility(this.gameObject, _currentAction.DestinationGameObject);
        }

        if (_currentAction != null)
        {
            _currentAction.Ability.Update();
        }

        for (int i = 0; i < _buffs.Count; i++)
        {
            var buff = _buffs[i];

            // Before allows evaluate of finished buffs, that were finished from external influences (dispel)
            if (buff.Finished)
            {
                _buffs.Remove(buff);
                i--;
                continue;
            }

            buff.Update();
        }

        this.Stats[LilithStats.Energy].CurrentValue += this.Stats[LilithStats.EnergyPerSecond].CurrentValue * Time.deltaTime;
    }
Beispiel #2
0
 internal void QueueAbility(IntendedAction intendedAction)
 {
     this.AbilityQue.Enqueue(intendedAction);
 }