Exemplo n.º 1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        string tag = collision.collider.tag;

        switch (tag)
        {
        case "敵人法術":
            if (gm.HurtAndCheckDead())
            {
                Dead();
                gm.ShowGameMenu(false);
            }
            break;

        case "Key":
            gm.addKey();
            Destroy(collision.collider.transform.gameObject);
            break;

        case "Speedup":
            speed += 2;
            Destroy(collision.collider.transform.gameObject);
            break;

        case "addLive":
            gm.addLive();
            Destroy(collision.collider.transform.gameObject);
            break;

        default:
            break;
        }
    }