public AbstractLockstep(float deltaTime, ICommunicator communicator, IPhysicsManagerBase physicsManager, int syncWindow, int panicWindow, int rollbackWindow, TrueSyncEventCallback OnGameStarted, TrueSyncEventCallback OnGamePaused, TrueSyncEventCallback OnGameUnPaused, TrueSyncEventCallback OnGameEnded, TrueSyncPlayerDisconnectionCallback OnPlayerDisconnection, TrueSyncUpdateCallback OnStepUpdate, TrueSyncInputDataProvider InputDataProvider) { AbstractLockstep.instance = this; this.deltaTime = deltaTime; this.syncWindow = syncWindow; this.panicWindow = panicWindow; this.rollbackWindow = rollbackWindow; this.totalWindow = syncWindow + rollbackWindow; this.StepUpdate = OnStepUpdate; this.OnGameStarted = OnGameStarted; this.OnGamePaused = OnGamePaused; this.OnGameUnPaused = OnGameUnPaused; this.OnGameEnded = OnGameEnded; this.OnPlayerDisconnection = OnPlayerDisconnection; this.InputDataProvider = InputDataProvider; this.ticks = 0; this.players = new Dictionary <byte, TSPlayer>(4); this.activePlayers = new List <TSPlayer>(4); this.auxPlayersSyncedData = new List <SyncedData>(4); this.auxPlayersInputData = new List <InputDataBase>(4); this.communicator = communicator; this.physicsManager = physicsManager; this.compoundStats = new CompoundStats(); this.bufferSyncedInfo = new GenericBufferWindow <SyncedInfo>(3); this.checksumOk = true; this.simulationState = AbstractLockstep.SimulationState.NOT_STARTED; this.bodiesToDestroy = new Dictionary <int, List <IBody> >(); this.playersDisconnect = new Dictionary <int, List <byte> >(); this.ReplayMode = ReplayRecord.replayMode; }
public AbstractLockstep(FP deltaTime, ICommunicator communicator, IPhysicsManager physicsManager, int syncWindow, int panicWindow, int rollbackWindow, TrueSyncEventCallback OnGameStarted, TrueSyncEventCallback OnGamePaused, TrueSyncEventCallback OnGameUnPaused, TrueSyncEventCallback OnGameEnded, TrueSyncPlayerDisconnectionCallback OnPlayerDisconnection, TrueSyncUpdateCallback OnStepUpdate, TrueSyncInputCallback GetLocalData) { this.deltaTime = deltaTime; this.syncWindow = syncWindow; this.panicWindow = panicWindow; this.rollbackWindow = rollbackWindow; this.totalWindow = syncWindow + rollbackWindow; this.StepUpdate = OnStepUpdate; this.OnGameStarted = OnGameStarted; this.OnGamePaused = OnGamePaused; this.OnGameUnPaused = OnGameUnPaused; this.OnGameEnded = OnGameEnded; this.OnPlayerDisconnection = OnPlayerDisconnection; this.GetLocalData = GetLocalData; this.ticks = 0; this.players = new SortedDictionary <byte, TSPlayer>(); this.communicator = communicator; bool flag = communicator != null; if (flag) { this.communicator.AddEventListener(new OnEventReceived(this.OnEventDataReceived)); } this.physicsManager = physicsManager; this.compoundStats = new CompoundStats(); this.bufferSyncedInfo = new GenericBufferWindow <SyncedInfo>(3); this.checksumOk = true; this.simulationState = AbstractLockstep.SimulationState.NOT_STARTED; this.bodiesToDestroy = new Dictionary <int, List <IBody> >(); this.delegatesToExecute = new Dictionary <int, List <Delegate> >(); this.ReplayRecord = ReplayRecord.replayToLoad; this.ReplayMode = ReplayRecord.replayMode; this.time = FP.Zero; StateTracker.AddTracking(this, "time"); }