Beispiel #1
0
    // trigger the lap-counter of the associated car
    void OnTriggerEnter2D(Collider2D other)
    {
        CarLapCounter carLapCounter = other.gameObject.GetComponent <CarLapCounter>();

        if (carLapCounter)
        {
            carLapCounter.OnLapTrigger(this);
        }
    }
Beispiel #2
0
    // when an object enters this trigger
    void OnTriggerEnter2D(Collider2D other)
    {
        CarLapCounter carLapCounter = other.gameObject.GetComponent <CarLapCounter>();

        if (carLapCounter)
        {
            carLapCounter.OnLapTrigger(this); // When the player enters, set the next trigger
        }
    }
Beispiel #3
0
    // when a car enters the trigger
    void OnTriggerEnter2D(Collider2D other)
    {
        CarLapCounter carLapCounter = other.gameObject.GetComponent <CarLapCounter>();

        if (carLapCounter)
        {
            Debug.Log("lap trigger " + gameObject.name);
            carLapCounter.OnLapTrigger(this);
        }
    }