示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <CarLaps>())
        {
            CarLaps car = other.GetComponent <CarLaps>();

            if (car.checkpoint == cP + 1 || car.checkpoint == cP - 1)
            {
                car.checkpoint = cP;

                Debug.Log(cP);
            }
        }
    }
示例#2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <CarLaps>())
        {
            CarLaps car = other.GetComponent <CarLaps>();

            if (car.checkpoint == lastCheckpoint)
            {
                car.checkpoint = 0;
                car.lap++;
                Debug.Log(car.lap);
            }
        }
    }
示例#3
0
 // Start is called before the first frame update
 void Start()
 {
     carlap = GetComponent <CarLaps>();
 }