void Awake() { Instance = this; actionsToSync = new Queue <IAction>(); pendingActions = new PendingActions(this); confirmedActions = new ConfirmedActions(this); }
public SampleBass(byte[] data, ConcurrentQueue <Action> customPendingActions = null) { if (customPendingActions != null) { PendingActions = customPendingActions; } PendingActions.Enqueue(() => { sampleId = Bass.SampleLoad(data, 0, data.Length, 8, BassFlags.Default); }); }
public override void Start() { Update(); //ensure state is valid. isPlayed = true; PendingActions.Enqueue(() => { Bass.ChannelPlay(activeStream); }); }
public override bool Seek(double seek) { double clamped = MathHelper.Clamp(seek, 0, Length); PendingActions.Enqueue(() => { if (clamped != CurrentTime) { long pos = Bass.ChannelSeconds2Bytes(activeStream, clamped / 1000d); Bass.ChannelSetPosition(activeStream, pos); } }); return(clamped == seek); }
private void setDirection(bool reverse) { int newDirection = reverse ? -1 : 1; if (direction == newDirection) { return; } direction = newDirection; PendingActions.Enqueue(() => { Bass.ChannelSetAttribute(activeStream, ChannelAttribute.ReverseDirection, direction); }); }
public void PrepGameStart() { log.Debug ("GameStart called. My PlayerID: " + Network.player.ToString()); LockStepTurnID = FirstLockStepTurnID; numberOfPlayers = gameSetup.NumberOfPlayers; pendingActions = new PendingActions(this); confirmedActions = new ConfirmedActions(this); actionsToSend = new Queue<Action>(); gameTurnSW = new Stopwatch(); currentGameFrameRuntime = 0; networkAverage = new RollingAverage(numberOfPlayers, initialLockStepTurnLength); runtimeAverage = new RollingAverage(numberOfPlayers, initialGameFrameTurnLength); InitGameStartLists(); nv.RPC ("ReadyToStart", RPCMode.AllBuffered, Network.player.ToString()); }
void ServerCompletedGame() { _pendingActions = PendingActions.GameComplete; _pendingMainThreadAction = true; }
void ServerLostLevel() { _pendingMainThreadAction = true; _pendingActions = PendingActions.PlayLoose; }
private void ServerLevelWon() { _pendingActions = PendingActions.PlayWin; _pendingMainThreadAction = true; _numLevelsWon++; }
private void ServerGameStarted() { _pendingMainThreadAction = true; _pendingActions = PendingActions.StartGame; _numLevelsWon = 0; }
private void ServerLevelStarted(PatternModel patternModel) { PatternProxyInst.UpdatePattern(patternModel); _pendingMainThreadAction = true; _pendingActions = PendingActions.StartRound; }