public void AdjustEndSubtick(LogicLevel level)
        {
            if (this.m_endTimestamp != -1)
            {
                int currentTime = LogicDataTables.GetGlobals().AdjustEndSubtickUseCurrentTime()
                    ? level.GetGameMode().GetServerTimeInSecondsSince1970()
                    : level.GetGameMode().GetStartTime();

                if (currentTime != -1)
                {
                    int remainingSecs = this.m_endTimestamp - currentTime;
                    int clamp         = LogicDataTables.GetGlobals().GetClampLongTimeStampsToDays();

                    if (clamp * 86400 > 0)
                    {
                        if (remainingSecs > 86400 * clamp)
                        {
                            remainingSecs = 86400 * clamp;
                        }
                        else if (remainingSecs < -86400 * clamp)
                        {
                            remainingSecs = -86400 * clamp;
                        }
                    }

                    this.m_remainingTime = level.GetLogicTime().GetTick() + LogicTime.GetSecondsInTicks(remainingSecs);
                }
            }
        }
        public void StartTimer(int totalSecs, LogicTime time, bool setEndTimestamp, int currentTimestamp)
        {
            this.m_remainingTime = LogicTime.GetSecondsInTicks(totalSecs) + time.GetTick();

            if (currentTimestamp != -1 && setEndTimestamp)
            {
                this.m_endTimestamp = currentTimestamp + totalSecs;
            }
        }
        public static LogicTimer GetLogicTimer(LogicJSONObject jsonObject, LogicTime time, string key, int maxTime)
        {
            LogicJSONNumber number = (LogicJSONNumber)jsonObject.Get(key);

            if (number != null)
            {
                LogicTimer timer = new LogicTimer();

                int remainingSeconds = LogicMath.Min(number.GetIntValue(), maxTime);
                int tick             = time.GetTick();

                timer.m_remainingTime = tick + LogicTime.GetSecondsInTicks(remainingSeconds);

                return(timer);
            }

            return(null);
        }
 public void FastForward(int totalSecs)
 {
     this.m_remainingTime -= LogicTime.GetSecondsInTicks(totalSecs);
 }