private void UpdateGameInfo(Protocol.GameLoop.Actions gameAction, int time) { // update the timer if (timerCourt == null) { timerCourt = StartCoroutine(Timer(time)); } else { StopCoroutine(timerCourt); timerCourt = StartCoroutine(Timer(time)); } // Lerp in the change and end turn pannel. switch (gameAction) { case Protocol.GameLoop.Actions.End: // lerp in on end StartCoroutine(LerpTimerHold(true)); // togle the correct text timesUpTextHold.SetActive(true); upNextTextHold.SetActive(false); break; case Protocol.GameLoop.Actions.Change: // togle the text // togle the correct text nextPlayerText.text = GameCtrl.Inst.CurrentPlayerName; timesUpTextHold.SetActive(false); upNextTextHold.SetActive(true); break; case Protocol.GameLoop.Actions.Start: StartCoroutine(LerpTimerHold(false)); break; } }
private void UpdateGameLoop(Protocol.BaseProtocol proto) { Protocol.GameLoop gameLoop = proto.AsType <Protocol.GameLoop>(); currentGameLoopState = gameLoop.Action; if (gameLoop.Action == Protocol.GameLoop.Actions.Change) { for (int i = 0; i < clientData.Length; i++) { if (clientData[i].playerId == gameLoop.player_id) { currentClientId = i; } } } gameLoopEvent?.Invoke(gameLoop.Action, gameLoop.t); }
private void UpdateGameInfo(Protocol.GameLoop.Actions action, int ttl) { ReceivedClients(GameCtrl.Inst.clientData); CurrentPlayerChanged(); }