void Start() { if (instance == null) { instance = this; } else { Destroy(gameObject); } if (!car) { car = FindObjectOfType <CND.Car.ArcadeCarController>().GetComponent <CarGhost>(); state = car.GetComponent <CND.Car.CarStateManager>(); } oldGhost = null; newGhost = null; GameManager.instance.ResetVar(true); if (practise || GameManager.instance.practise) { AllowMoves(); } else { StartCoroutine(StartCountDown()); } }
IEnumerator ReStart(bool resetTime) { ResetVar(resetTime); CND.Car.CarStateManager car = MapManager.instance.state; car.Explode(); yield return(new WaitForSeconds(car.fadeDuration * 0.9f)); CheckPoint.Data data = CheckPoint.data; if (resetTime) { MapManager.instance.ReStart(); } else { CheckBack(); defile = true; } car.Spawn(data.position, data.rotation); yield return(new WaitForSeconds(car.fadeDuration * 0.1f)); }
void Awake() { if (!car) { car = GetComponent <BaseCarController>(); } wheels = GetComponentsInChildren <Wheel>(); carState = car.GetComponent <CarStateManager>(); }