示例#1
0
文件: GameViewer.cs 项目: KaynSD/bbTV
 private void RewindToPoint(int value)
 {
     historicalPlaybackCurrentIndex = value;
     if (historicalPlaybackCurrentIndex != game.HistoryLength)
     {
         BBGameState state = game.GetUpdate(value);
         if (state != null)
         {
             LogUpdate(state);
             ReadyToProcessNewPlay = true;
         }
     }
 }
示例#2
0
文件: GameViewer.cs 项目: KaynSD/bbTV
    void Start()
    {
        game = gameRunner.getFocusedGame();
        if (game == null)
        {
            SceneManager.LoadScene(Constants.SCENE_TITLE);
            return;
        }


        PRNG prng = new ParkMiller(game.GameID);

        PregeneratedRandomValues = new List <float>();
        for (int i = 0; i < 1000; i++)
        {
            PregeneratedRandomValues.Add(prng.next());
        }


        queue = new Queue <BBGameState>();
        queue = new Queue <BBGameState>();
        game.OnUpdateReady   += LogUpdate;
        ReadyToProcessNewPlay = true;

        historicalPlaybackCurrentIndex = game.isRunning ? -1 : 0;
        currentState = game.GetUpdate(historicalPlaybackCurrentIndex);
        if (currentState != null)
        {
            queue.Enqueue(currentState);
        }
        HandleTechnicalDifficulties(null);

        if (game.isRunning)
        {
            Debug.Log("Rewind Off");
            cameraGraphicsMasterControl.DisableRewind();
        }
        else
        {
            Debug.Log("Rewind On");
            cameraGraphicsMasterControl.EnableRewind();
            cameraGraphicsMasterControl.rewindPanel.OnChanged += RewindToPoint;
        }
    }