Extreme Race Game Unity -
originalPosition = transform.localPosition;
lapCounterText.text = $"Lap currentLap/totalLaps";
void Update()
if (currentCooldown > 0) currentCooldown -= Time.deltaTime; // Recharge boost if (currentBoostCharges < maxBoostCharges && !isBoosting) currentRechargeTimer += Time.deltaTime; if (currentRechargeTimer >= boostRechargeRate) currentBoostCharges++; currentRechargeTimer = 0; extreme race game unity
using UnityEngine; using System.Collections; public class CameraShake : MonoBehaviour
if (other.CompareTag("Checkpoint")) checkpointIndex == currentCheckpoint + 1) currentCheckpoint = checkpointIndex; passedCheckpoints.Add(checkpointIndex); // Visual feedback other.GetComponent<MeshRenderer>().material.color = Color.green;
void Update()
void RaceFinished()
if (Instance == null) Instance = this; else Destroy(gameObject);
MoveVehicle();
using UnityEngine; using System.Collections.Generic; public class CheckpointManager : MonoBehaviour
[Header("Drift Settings")] public float driftTurnMultiplier = 1.5f; public float driftBoostAmount = 0.5f; public float minDriftTimeForBoost = 1f;
int minutes = Mathf.FloorToInt(raceTimer / 60); int seconds = Mathf.FloorToInt(raceTimer % 60); int milliseconds = Mathf.FloorToInt((raceTimer * 100) % 100); timerText.text = $"minutes:00:seconds:00:milliseconds:00"; originalPosition = transform
public int index;
isBoosting = true; currentBoostCharges--; currentCooldown = boostCooldown; float originalSpeed = currentSpeed; float boostSpeed = currentSpeed * boostMultiplier; boostSpeed = Mathf.Clamp(boostSpeed, 0, maxSpeed * 1.5f); // Activate boost effects boostParticles.Play(); boostFlame.SetActive(true); Camera.main.GetComponent<CameraShake>().ShakeCamera(0.3f, 0.5f); float elapsedTime = 0; while (elapsedTime < boostDuration) currentSpeed = Mathf.Lerp(boostSpeed, originalSpeed, elapsedTime / boostDuration); elapsedTime += Time.deltaTime; // Screen effect PostProcessManager.Instance.ApplyBoostEffect(elapsedTime / boostDuration); yield return null; currentSpeed = originalSpeed; isBoosting = false; boostParticles.Stop(); boostFlame.SetActive(false); PostProcessManager.Instance.ResetEffects();