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);
            }
        }
        public void ClearTimer(int skill_timer_type)
        {
            SkillTimer timer = m_timers[skill_timer_type];

            if (timer.Active)
            {
                timer.Reset();
            }
        }
Esempio n. 3
0
        public FixPoint GetNextReadyTime()
        {
            SkillTimer timer = m_definition_component.GetTimer(SkillTimer.CooldownTimer);

            if (timer.Active)
            {
                return(timer.GetRemaining(GetCurrentTime()));
            }
            return(FixPoint.Zero);
        }
        public void StartExpirationTimer(FixPoint start_time, SkillManagerComponent manager)
        {
            SkillTimer timer       = m_timers[SkillTimer.ExpirationTimer];
            FixPoint   update_rate = FixPoint.One;

            if (m_normal_attack)
            {
                update_rate = manager.AttackSpeedRate;
            }
            timer.Start(start_time, ExpirationTime, update_rate);
        }
        public override void InitializeComponent()
        {
            if (m_mana_type == 0)
            {
                m_mana_type = ManaComponent.DEFAULT_MANA_TYPE_ID;
            }

            m_timers.Clear();
            for (int i = 0; i < SkillTimer.TimerCount; ++i)
            {
                SkillTimer timer = RecyclableObject.Create <SkillTimer>();
                m_timers.Add(timer);
            }
        }
        public void StartCooldownTimer(FixPoint start_time, SkillManagerComponent manager)
        {
            SkillTimer timer = m_timers[SkillTimer.CooldownTimer];
            FixPoint   update_rate;

            if (m_normal_attack)
            {
                update_rate = manager.AttackSpeedRate;
            }
            else
            {
                update_rate = manager.CoolDownSpeedUpRate;
            }
            timer.Start(start_time, CooldownTime, update_rate);
        }
Esempio n. 7
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();
            }
        }