How to optimize?

Made the jump from wall to wall( wall jump). Long puzzled how to do it, but the result was this.
Tell me how to optimize the code
public class noobscript : MonoBehaviour
 private bool iswallright = false;
 private bool iswallleft = false;
 private bool iswallrightflip = false;
 private bool iswallleftflip = false;
public LayerMask wallright;
 public LayerMask wallleft;
 public Transform rightwall;
 public Transform leftwall;
 public Transform rightwallflip;
 public Transform leftwallflip;
private void FixedUpdate()
iswallright = Physics2D.OverlapCircle(rightwall.position groundRadius, wallright);
 iswallleft = Physics2D.OverlapCircle(leftwall.position groundRadius, wallleft);
 iswallrightflip = Physics2D.OverlapCircle(rightwallflip.position groundRadius, wallright);
 iswallleftflip = Physics2D.OverlapCircle(leftwallflip.position groundRadius, wallleft);
private void Update()
 if (iswallright && Input.GetKeyDown(KeyCode.Space))
{
 rigidbody.AddForce(new Vector2(-300, 600));
Flip();


}

 if (iswallleft && Input.GetKeyDown(KeyCode.Space))
{
 rigidbody.AddForce(new Vector2(300, 600));
Flip();

}
 if (iswallrightflip && Input.GetKeyDown(KeyCode.Space))
{
 rigidbody.AddForce(new Vector2(-300, 600));
Flip();


}

 if (iswallleftflip && Input.GetKeyDown(KeyCode.Space))
{
 rigidbody.AddForce(new Vector2(300, 600));
Flip();

}
 private void Flip()
{

 isFacingRight = !isFacingRight;

 Vector3 theScale = transform.localScale;

 theScale.x *= -1;

 transform.localScale = theScale;
 }
June 5th 19 at 21:39
1 answer
June 5th 19 at 21:41
Why do you need walls?
Just sculpt the player on the wall.
If it is after hitting the wall does not jump, then throw it just in the opposite direction, and there get not get not your concern.

Find more questions by tags 2DC#Unity Game Engine