/// <summary> /// Update is called once per frame. /// Updates the wait timer, if the controller is waiting. /// </summary> private void Update() { if (ClientScene.localPlayer && !ClientScene.localPlayer.isServer) { return; } if (currentState.Equals(RoundState.WAIT_FOR_NEXT_ROUND)) { if (waitTimer > 0f) { host.RpcUpdateWaitTimer("Next Round: " + (int)waitTimer); waitTimer -= Time.deltaTime; if (waitTimer <= 0f) { currentState = stateAfterWait; winStatus = -1; valIdx = -1; playerACardId = -1; playerBCardId = -1; host.RpcUpdateWaitTimer(""); SentGameUpdate(); } } } }
/// <summary> /// ROUND EVENTS /// </summary> public void StateChanged(IMachineStateComponent <RoundState> component, RoundState previous) { if (_round.State.Equals(RoundState.WaitingForBallServe)) { Paddle servingPaddle = Components.OfType <Paddle>().Where((x) => x.Team == _round.ServingTeam).Single(); ServeBallHandler.AssignRequiredEntities(Ball, servingPaddle); } else if (previous.Equals(RoundState.WaitingForBallServe)) { ServeBallHandler.FreeRequiredEntities(); } }