Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Sphere")
        {
            if (sphere == null)
            {
                sphere = other.gameObject.GetComponent <SphereControl> ();
            }

            if (code == 1)
            {
                bikeRun.SetRunOn();
                sphere.SetMaxSpeed(maxSpeedBike);
                pointsManager.SetBikeBlue();
                pointsManager.SetBikeGreen();
                particleManager.SetParticles(true);
            }
            else if (code == 2 && bikeRun.GetRun())
            {
                bikeRun.SetRunOff();
                sphere.SetMaxSpeed(maxSpeed);
                pointsManager.SetBikeBlue();
                particleManager.SetParticles(false);
                gameManager.winGame("1");
            }
        }
    }