public FixPoint GetLowestCountdownTimerRemaining()
        {
            FixPoint lowest_time  = FixPoint.MaxValue;
            FixPoint current_time = GetCurrentTime();

            for (int i = 0; i < SkillTimer.TimerCount; ++i)
            {
                SkillTimer timer = m_timers[i];
                if (timer.Active)
                {
                    FixPoint time_left = timer.GetRemaining(current_time);
                    if (time_left < lowest_time)
                    {
                        lowest_time = time_left;
                    }
                }
            }
            if (lowest_time == FixPoint.MaxValue)
            {
                return(FixPoint.Zero);
            }
            else
            {
                return(lowest_time);
            }
        }
Example #2
0
        public FixPoint GetNextReadyTime()
        {
            SkillTimer timer = m_definition_component.GetTimer(SkillTimer.CooldownTimer);

            if (timer.Active)
            {
                return(timer.GetRemaining(GetCurrentTime()));
            }
            return(FixPoint.Zero);
        }
Example #3
0
        public void ServiceCountdownTimers(FixPoint current_time, FixPoint delta_time)
        {
            bool reschedule = false;

            SkillTimer casting_timer = m_definition_component.GetTimer(SkillTimer.CastingTimer);

            if (casting_timer.Active)
            {
                if (casting_timer.GetRemaining(current_time) == FixPoint.Zero)
                {
                    casting_timer.Reset();
                    PostActivate(current_time);
                }
                reschedule = true;
            }

            SkillTimer inflicting_timer = m_definition_component.GetTimer(SkillTimer.InflictingTimer);

            if (inflicting_timer.Active)
            {
                if (inflicting_timer.GetRemaining(current_time) == FixPoint.Zero)
                {
                    inflicting_timer.Reset();
                    Inflict(current_time);
                }
                reschedule = true;
            }

            SkillTimer expiration_timer = m_definition_component.GetTimer(SkillTimer.ExpirationTimer);

            if (expiration_timer.Active)
            {
                if (expiration_timer.GetRemaining(current_time) == FixPoint.Zero)
                {
                    expiration_timer.Reset();
                    Deactivate(false);
                    NotifySkillExpired();
                }
                else
                {
                    reschedule = true;
                }
            }

            SkillTimer cooldown_timer = m_definition_component.GetTimer(SkillTimer.CooldownTimer);

            if (cooldown_timer.Active)
            {
                if (cooldown_timer.GetRemaining(current_time) == FixPoint.Zero)
                {
                    cooldown_timer.Reset();
                    NotifySkillReady();
                }
                else
                {
                    reschedule = true;
                }
            }

            if (reschedule)
            {
                ScheduleTimers();
            }
        }