예제 #1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (isTransitioning || collisionAreDisabled)
        {
            return;
        }

        switch (collision.gameObject.tag)
        {
        case "Friendly":
            print("OK");
            break;

        case "Finish":
            // Stoping Timer...
            timer.StopTimer();

            //Checking if Highsore...
            if (PlayerPrefs.HasKey(currentsceneName) == false)
            {
                PlayerPrefs.SetFloat(currentsceneName, timer.Returnmsec());
            }
            else if (PlayerPrefs.GetFloat(currentsceneName) > timer.Returnmsec())
            {
                PlayerPrefs.SetFloat(currentsceneName, timer.Returnmsec());
            }
            deathHandler.StartSuccessSequence();
            break;

        default:
            // Stoping Timer...
            timer.StopTimer();

            deathHandler.StartDeathSequence();
            break;
        }
    }