Example #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        int collisionId = 0;

        if (collision.gameObject.tag == "Wall")
        {
            collisionId = collision.gameObject.GetComponent <Wall>().GetId();
            SoundManager.instance.PlayBounceSFX();

            if (id != collisionId)
            {
                changeOwnerNextUpdate = true;
            }
            else
            {
            }
        }
        else if (collision.gameObject.tag == "Grey Wall")
        {
            SoundManager.instance.PlayBounceSFX();
        }
        else if (collision.gameObject.tag == "Puck")
        {
            if (!idle)
            {
                SoundManager.instance.PlayPengouinBounceSFX();
            }
            Puck collidedpuck = collision.gameObject.GetComponent <Puck>();
            collisionId = collidedpuck.GetId();
            //PHYSICS
            collidedpuck.PuckCollision(idle);
            //

            if (id != collisionId)
            {
                changeOwnerNextUpdate = true;
            }
            else
            {
            }
        }
        else
        {
            return;
        }
    }