Exemplo n.º 1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.CompareTag("Player1") && !changedColor)
        {
            changedColor          = true;
            gameObject.layer      = groundP1;
            spriteRenderer.sprite = sprites[0];
            endPoint.CorrectSound();
        }

        if (collision.gameObject.CompareTag("Player2") && !changedColor)
        {
            changedColor          = true;
            gameObject.layer      = groundP2;
            spriteRenderer.sprite = sprites[1];
            endPoint.CorrectSound();
        }
    }