Beispiel #1
0
    void OnCollisionEnter2D(Collision2D obj)
    {
        Debug.Log("Colision!");

        if (obj.gameObject.name.StartsWith("spike"))
        {
            Debug.Log("Colision is spike!");
            life -= 1;

            print("Life now is " + life);

            if (life <= 0)
            {
                Debug.Log("morreu");
                menu.ExibirMenuFim();
            }
        }
    }