void Update() { switch (GameData.gameState) { case GameData.GameState.READY: curveDisplay.ChangeMode(CurveDisplay.Mode.Waiting); break; case GameData.GameState.LAUNCHING: curveDisplay.ChangeMode(CurveDisplay.Mode.Launching); break; case GameData.GameState.PLAYING_NO_WINNER: break; default: if (GameData.players[id].playerState == PlayerData.PlayerState.FINISHED) { curveDisplay.ChangeMode(CurveDisplay.Mode.Finished); } break; } //set head rotation; if (isMonitor) { cameraTrans.localRotation = Quaternion.Lerp(cameraTrans.localRotation, GameData.players[id].headsetRot, Time.deltaTime); Vector3 standardEuler = new Vector3(-34.95f, -1.862f, 4.79f); Quaternion standardLocalRotation = Quaternion.Euler(standardEuler); headTrans.localRotation = Quaternion.Lerp(headTrans.localRotation, standardLocalRotation * GameData.players[id].headsetRot, Time.deltaTime); } else { if (id == StaticData.playerId) { headTrans.localScale = Vector3.zero; } else { Vector3 standardEuler = new Vector3(-34.95f, -1.862f, 4.79f); Quaternion standardLocalRotation = Quaternion.Euler(standardEuler); headTrans.localRotation = Quaternion.Lerp(headTrans.localRotation, standardLocalRotation * GameData.players[id].headsetRot, Time.deltaTime); } } //set position walkerComp.SetSpeed(0); walkerComp.SetProgress(Mathf.Lerp(walkerComp.GetProgress(), GameData.players[id].zPosition, Time.deltaTime)); //set anim speed if (GameData.gameState == GameData.GameState.READY || GameData.gameState == GameData.GameState.LAUNCHING || GameData.players[id].playerState == PlayerData.PlayerState.FINISHED) { animator.speed = 0; } else { animator.speed = Mathf.Lerp(animator.speed, GameData.players[id].zVelocity * 22, Time.deltaTime); } }
void Update() { t += Time.deltaTime; if (t >= 6) { t = 0; } if (t <= 3) { textComp.text = "Player " + (1 + sync.id).ToString() + "\n" + walker.GetProgress().ToString("P1"); } else { textComp.text = "Player " + (1 + sync.id).ToString() + "\n" + (walker.GetProgress() * 18).ToString("F1") + " cal"; } }