Beispiel #1
0
 private void hookSetTimeScale1(On.GameManager.orig_SetTimeScale_float orig, GameManager self, float newTimeScale)
 {
     if (runningIG)
     {
         lastTimeScale  = newTimeScale;
         Time.timeScale = ((newTimeScale <= 0.01f) ? 0f : newTimeScale) * actualTimeScale;
     }
     else
     {
         orig(self, newTimeScale);
     }
 }
Beispiel #2
0
        /**
         * If the timescale changes due to the game going to the pause menu, we prevent it from doing so
         */
        private void GameManagerOnSetTimeScale_float(
            On.GameManager.orig_SetTimeScale_float orig,
            global::GameManager self,
            float scale
            )
        {
            // Get the stack trace and check whether a specific frame contains a method that is responsible
            // for pausing the game while going to menu
            var stackTrace = new StackTrace();

            var frames = stackTrace.GetFrames();

            if (frames == null)
            {
                orig(self, scale);
                return;
            }

            var name = frames[2].GetMethod().Name;

            if (!name.Contains("PauseGameToggle"))
            {
                orig(self, scale);
                return;
            }

            if (!_netClient.IsConnected)
            {
                orig(self, scale);
            }
            else
            {
                // Always put the time scale to 1.0, thus never allowing the game to change speed
                // This is to prevent desyncs in multiplayer
                orig(self, 1.0f);
            }
        }
Beispiel #3
0
 private static void GameManager_SetTimeScale_1(On.GameManager.orig_SetTimeScale_float orig, GameManager self, float newTimeScale)
 {
     Time.timeScale = (newTimeScale <= 0.01f ? 0f : newTimeScale) * TimeScale;
 }