コード例 #1
0
        public static void SetLogicTimer(LogicJSONObject jsonObject, LogicTimer timer, LogicLevel level, string key)
        {
            if (timer != null)
            {
                int remainingSeconds = timer.GetRemainingSeconds(level.GetLogicTime());

                if (remainingSeconds > 0)
                {
                    jsonObject.Put(key, new LogicJSONNumber(remainingSeconds));
                }
            }
        }
コード例 #2
0
        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);
        }