void Update() { if (BRGameController.CurrentRaceState() == RaceState.RACING) { placeText.enabled = true; timerText.enabled = true; } else { placeText.enabled = false; timerText.enabled = false; } }
void FixedUpdate() { RaceState state = BRGameController.CurrentRaceState(); bool canStart = false; bool canStop = false; switch (state) { case RaceState.LOBBY: canStart = true; break; case RaceState.RACING: canStop = true; break; } startObj.SetActive(canStart); stopObj.SetActive(canStop); }
// Update is called once per frame void FixedUpdate() { if (BRGameController.gameOver) { target = null; return; } BaseCar c = BRGameController.GetCurrentLeader(); if (!c) { return; } target = c.transform; targetPos = target.position - target.forward * distance + Vector3.up * height; thisTransform.position = Vector3.Lerp(thisTransform.position, targetPos, Time.deltaTime * speed); Vector3 targetDir = target.position - thisTransform.position; Quaternion desiredRot = Quaternion.LookRotation(targetDir, Vector3.up); thisTransform.rotation = Quaternion.Slerp(thisTransform.rotation, desiredRot, Time.deltaTime * speed); }
public Race(BRGameController ctrl) { gameController = ctrl; }