Bouncer.ApplyBounce C# (CSharp) Method

ApplyBounce() public method

public ApplyBounce ( GameObject otherObject, Collision2D coll ) : void
otherObject GameObject
coll Collision2D
return void
    void ApplyBounce(GameObject otherObject, Collision2D coll)
    {
        Rigidbody2D rgbd2D = otherObject.GetComponent<Rigidbody2D>();

        rgbd2D.velocity = Vector2.zero;
        Transform trajectory;
        if (BallController.instance.gravityVector.x > 0 && trajectoryObjectEast != null)
            trajectory = trajectoryObjectEast;
        else if (BallController.instance.gravityVector.x < 0 && trajectoryObjectWest != null)
            trajectory = trajectoryObjectWest;
        else if (BallController.instance.gravityVector.y > 0 && trajectoryObjectNorth != null)
            trajectory = trajectoryObjectNorth;
        else
            trajectory = trajectoryObjectSouth;

		bounceAnimator.SetTrigger("Hit");

        rgbd2D.AddForce((trajectory.position - transform.position) * force, ForceMode2D.Impulse);

    }