void Awake() { rigidbody = GetComponent <Rigidbody>(); if (!carManager.cars.Contains(this)) { carManager.cars.Add(this); } wheels = GetComponentsInChildren <WheelCollider>(); AudioSource = GetComponent <AudioSource>(); carAI = GetComponent <carAI>(); spawnPos = transform.position; }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { other.GetComponent <carController>().lastCheckpoint = gameObject; UpdateLead(other.gameObject); carAI ai = other.GetComponent <carAI>(); if (ai) { ai.setNextTarget(NextCheckpoint()); } } }
void Start() { myParent = transform.parent.GetComponent <carAI>(); }