Beispiel #1
0
        public void ToggleSlowNew()
        {
            switch (gameSpeed)
            {
            case GameSpeedState.TEN:
                this.TimeScale       = 6.0f;
                gameSpeed            = GameSpeedState.SIX;
                UltraFastModeEngaged = false;
                break;

            case GameSpeedState.SIX:
                this.TimeScale = 2.0f;
                gameSpeed      = GameSpeedState.DOUBLE;
                break;

            case GameSpeedState.DOUBLE:
                this.TimeScale = 1.0f;
                gameSpeed      = GameSpeedState.NORMAL;
                break;

            case GameSpeedState.NORMAL:
                this.TimeScale = 0.2f;
                gameSpeed      = GameSpeedState.SLOW;
                break;

            default:
                break;
            }
            this.UpdateTimeScale();
        }
Beispiel #2
0
        public void ToggleFastNew()
        {
            switch (gameSpeed)
            {
            case GameSpeedState.SLOW:
                this.TimeScale = 1.0f;
                gameSpeed      = GameSpeedState.NORMAL;
                break;

            case GameSpeedState.NORMAL:
                this.TimeScale = 2.0f;
                gameSpeed      = GameSpeedState.DOUBLE;
                break;

            case GameSpeedState.DOUBLE:
                this.TimeScale = 6.0f;
                gameSpeed      = GameSpeedState.SIX;
                break;

            default:
                break;
            }

            this.UpdateTimeScale();
        }
        public void OnyxUpdateNew()
        {
            this.RealtimeSinceStartupThisFrame = Time.realtimeSinceStartup;
            this.GameTimeSinceStartup         += Time.deltaTime;
            float num = 0.2f;

            TimeController.m_smoothUnscaledDeltaTime         = num * TimeController.UnscaledDeltaTime + (1f - num) * TimeController.m_previousSmoothUnscaledDeltaTime;
            TimeController.m_previousSmoothUnscaledDeltaTime = TimeController.m_smoothUnscaledDeltaTime;

            if (!GameState.IsLoading)
            {
                this.UpdateTimeScale();
            }
            if (UIWindowManager.KeyInputAvailable)
            {
                if (GameInput.GetControlDown(MappedControl.RESTORE_SPEED, true))
                {
                    this.TimeScale = this.NormalTime;
                }
                else if (GameInput.GetControlDown(MappedControl.COMBAT_SPEED_DOWN, true))
                {
                    this.ToggleSlow();
                    //Debug.LogError("TOGGLE SLOW");
                }
                else if (GameInput.GetControlDown(MappedControl.COMBAT_SPEED_UP, true))
                {
                    this.ToggleFast();
                    //Debug.LogError("TOGGLE SLOW");
                }
                else if (GameInput.GetControlDown(MappedControl.FAST_TOGGLE, true))
                {
                    if (!UltraFastModeEngaged)
                    {
                        this.TimeScale       = 6.0f;
                        gameSpeed            = GameSpeedState.SIX;
                        UltraFastModeEngaged = true;
                    }
                    else
                    {
                        this.TimeScale       = 1.0f;
                        gameSpeed            = GameSpeedState.NORMAL;
                        UltraFastModeEngaged = false;
                    }
                }
            }
        }
Beispiel #4
0
 static bool Prefix(Heart __instance)
 {
     try
     {
         float          usualInterval     = (float)AccessTools.Field(typeof(Heart), "BEAT_INTERVAL_SECONDS").GetValue(__instance);
         float          timerBetweenBeats = (float)AccessTools.Field(typeof(Heart), "timerBetweenBeats").GetValue(__instance);
         GameSpeedState gameSpeedState    = (GameSpeedState)AccessTools.Field(typeof(Heart), "gameSpeedState").GetValue(__instance);
         if (fastmodemultiplier.speedMultiplier.Value < 1f)
         {
             NoonUtility.Log("Speed Multiplier was less than one, which is not yet supported. Defaulting to 1f.", 0, VerbosityLevel.Essential);
             fastmodemultiplier.speedMultiplier.Value = 1f;
         }
         timerBetweenBeats += Time.deltaTime;
         AccessTools.Field(typeof(Heart), "timerBetweenBeats").SetValue(__instance, timerBetweenBeats);
         if (timerBetweenBeats > 0.05f)
         {
             timerBetweenBeats -= 0.05f;
             AccessTools.Field(typeof(Heart), "timerBetweenBeats").SetValue(__instance, timerBetweenBeats);
             if (gameSpeedState.GetEffectiveGameSpeed() == GameSpeed.Fast)
             {
                 // NoonUtility.Log("Beat for: " + (0.15f * fastmodemultiplier.speedMultiplier.Value).ToString(), 0, VerbosityLevel.Essential);
                 // __instance.Beat(0.15f);
                 __instance.Beat(0.15f * fastmodemultiplier.speedMultiplier.Value);
             }
             else if (gameSpeedState.GetEffectiveGameSpeed() == GameSpeed.Normal)
             {
                 __instance.Beat(0.05f);
             }
             else if (gameSpeedState.GetEffectiveGameSpeed() == GameSpeed.Paused)
             {
                 __instance.Beat(0f);
             }
             else
             {
                 NoonUtility.Log("Unknown game speed state: " + gameSpeedState.GetEffectiveGameSpeed(), 0, VerbosityLevel.Trivia);
             }
         }
     }
     catch (Exception e)
     {
         NoonUtility.LogException(e);
         throw;
     }
     return(false);
 }
Beispiel #5
0
 static void Postfix(SpeedControlUI __instance)
 {
     try
     {
         GameSpeedState uiShowsGameSpeed = (GameSpeedState)AccessTools.Field(typeof(SpeedControlUI), "uiShowsGameSpeed").GetValue(__instance);
         if (uiShowsGameSpeed.GetEffectiveGameSpeed() == GameSpeed.Fast)
         {
             // GameSpeed is already fast, so that means we need to make it faster!
             fastmodemultiplier.speedMultiplier.Value += 1f;
             // NoonUtility.Log("GetEffectiveGameSpeed() == GameSpeed.Fast, multiplier value set to: " + fastmodemultiplier.speedMultiplier.Value);
         }
         else if (uiShowsGameSpeed.GetEffectiveGameSpeed() == GameSpeed.Normal)
         {
             // decrease speed multiplier to baseline
             fastmodemultiplier.speedMultiplier.Value = 1f;
             // NoonUtility.Log("Set Normal Speed Multiplier");
         }
     }
     catch (Exception e)
     {
         NoonUtility.LogException(e);
     }
 }