Exemple #1
0
        private static void SetTintTime()
        {
            DateTime time = Program.LogicTickTime;

            _tintHour   = OverworldTime.GetHour(time.Hour);
            _tintMinute = OverworldTime.GetMinute(time.Minute);
        }
Exemple #2
0
        public static void LogicTick(bool skipTransition)
        {
            DateTime time       = Program.LogicTickTime;
            int      realMinute = OverworldTime.GetMinute(time.Minute);
            int      realHour   = OverworldTime.GetHour(time.Hour);
            int      tintHour;

            if (skipTransition)
            {
                _tintHour = tintHour = realHour;
            }
            else
            {
                tintHour = _tintHour;
            }
            GetHourTint(tintHour, out float rMod, out float gMod, out float bMod);
            // Do minute transition
            int tintMinute;

            if (skipTransition)
            {
                _tintMinute = tintMinute = realMinute;
            }
            else
            {
                tintMinute = _tintMinute;
            }
            float minuteMod      = tintMinute / 60f;
            int   nextTintMinute = tintMinute;

            if (tintMinute != realMinute || tintHour != realHour)
            {
                nextTintMinute++;
            }
            int nextTintHour = tintHour + 1;

            if (nextTintHour >= 24)
            {
                nextTintHour = 0;
            }
            GetHourTint(nextTintHour, out float nextRMod, out float nextGMod, out float nextBMod);
            rMod += (nextRMod - rMod) * minuteMod;
            gMod += (nextGMod - gMod) * minuteMod;
            bMod += (nextBMod - bMod) * minuteMod;
            if (nextTintMinute >= 60)
            {
                _tintMinute = 0;
                _tintHour   = nextTintHour;
            }
            else
            {
                _tintMinute = nextTintMinute;
            }
            _rMod = rMod;
            _gMod = gMod;
            _bMod = bMod;
        }