Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
    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());
            }
        }
    }
Ejemplo n.º 3
0
 void Start()
 {
     myParent = transform.parent.GetComponent <carAI>();
 }