maintain ball bounce height/better scripting techniques

working on a simple pang like game with my son and we want to control the bounce of the balls , so a ball which is 64x64 in size bounces a fixed x and y distance. At the moment if there is a collision we just simply modify the velocity. it seems s little clunky, is there a better method to maintain a constant x,y bounce? We tried applying the bounce only once but the ball does not behave in a consistent manner. This is the last thing we need to try and fix.
void OnCollisionEnter2D(Collision2D collisionObject){
if (ybounce == 0f) {
ybounce = 5f;
}
if (xbounce == 0f) {
xbounce = 2f;
}
//walls and floor
if (collisionObject.gameObject.tag == “LWall”) {
xbounce = 2f;
Debug.Log (“hit the left wall” );
// bounce = false;
}
if (collisionObject.gameObject.tag == “RWall”) {
xbounce = -2f;
Debug.Log (“hit the Right wall”);
// bounce = false;
}
if (collisionObject.gameObject.tag == “Floor”) {
this.rigidbody2D.velocity = new Vector2 (xbounce, ybounce);
Debug.Log (“hit ths floor” );
// bounce = false;
}
}

Try moving the ybounce == 5f down inside the if collided with “floor” block.
And remove that top block entirely… the if (ybounce == 0f)