Пример #1
0
        private void onReadyToStart()
        {
            // Seek the master clock to the gameplay time.
            // This is chosen as the first available frame in the players' replays, which matches the seek by each individual SpectatorPlayer.
            double startTime = instances.Where(i => i.Score != null)
                               .SelectMany(i => i.Score.Replay.Frames)
                               .Select(f => f.Time)
                               .DefaultIfEmpty(0)
                               .Min();

            masterClockContainer.Seek(startTime);
            masterClockContainer.Start();

            // Although the clock has been started, this flag is set to allow for later synchronisation state changes to also be able to start it.
            canStartMasterClock = true;
        }
Пример #2
0
        private void onMasterStateChanged(ValueChangedEvent <MasterClockState> state)
        {
            switch (state.NewValue)
            {
            case MasterClockState.Synchronised:
                if (canStartMasterClock)
                {
                    masterClockContainer.Start();
                }

                break;

            case MasterClockState.TooFarAhead:
                masterClockContainer.Stop();
                break;
            }
        }