Пример #1
0
    void OnTriggerEnter(Collider other)
    {
        CarController carController = other.transform.parent.gameObject.GetComponent <CarController>();

        if (carController != null && !passed && (carController.lastCheckpoint == null || Mathf.Abs(carController.lastCheckpoint.checkpointIndex - checkpointIndex) == 1))
        {
            carController.lastCheckpoint = this;
            passed = true;
            GameViewController gameViewController = GameViewController.Instance;
            if (gameViewController != null)
            {
                gameViewController.SetCheckpoint(checkpointIndex);
            }
        }
    }