Esempio n. 1
0
    public void ReturnToOrigin()
    {
        // CHIF NOIT INVININICCBLE
        if (gameObject.layer != 9)
        {
            lives--;
            scoreTimer.AddTimePenalty();

            foreach (LifeCounter lifeCounter in FindObjectsOfType <LifeCounter>())
            {
                lifeCounter.LifeUpdate();
            }

            TurnInvincablele();
        }
        else
        {
            TurnInvincablele();
        }

        if (lives > 0)
        {
            GetComponent <Rigidbody> ().position = origin + new Vector3(0, 2);
            GetComponent <Rigidbody> ().rotation = rotation;
            GetComponent <Rigidbody> ().velocity = GetComponent <Rigidbody> ().angularVelocity = Vector3.zero;
        }
        else if (lives == 0)
        {
            lives = -666;
            FindObjectOfType <ChangeScene>().StartAnimation("mainMenu");
            scoreTimer.StopTimer(false);
        }

        ResetTrails();
        Invoke("ResetTrails", 0.1f);
    }