Movement help

Hi, so I am wondering how to make the movement in my game like pacman. I got the 90 degree angles down but it just does not feel like pacman. How do I make it so it rotates based on what your rotation is at that time. For ex, I want it to be if you click the left arrow button you rotate 180 degrees, but only if your y axis was 0 before you clicked the left arrow button, and if it is not 0 on the y axis then rotate 90 degrees toward the left only. I hope my made this clear enough and sorry if it is not. Thanks for all the help!

Here is my code

[SerializeField] float Speed = 3.5f;

// Use this for initialization
void Start () {
	
}

float Right = 90f;

// Update is called once per frame
void Update () {

    Invoke("RotateAndMovement", 2f);
}



void RotateAndMovement()
{
    if (Input.GetKeyDown(KeyCode.LeftArrow))
    {
        transform.Rotate(0, 90, 0);
    }
    else if (Input.GetKeyDown(KeyCode.RightArrow))
    {
        transform.Rotate(0, 90, 0);
    }
    else if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        transform.Rotate(0, -90, 0);
    }
    else if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        transform.Rotate(0, 90, 0);
    }
    transform.Translate(Vector3.forward * Speed * Time.deltaTime);
}

}

Should do it
Quaternion rotation = Quaternion.identity;
void RotateAndMovement()
{
if (Input.GetKeyDown (KeyCode.LeftArrow)) {
rotation = Quaternion.Euler (new Vector3 (0, 90, 0));
transform.rotation = Quaternion.Euler(new Vector3(0, 90, 0));
} else if (Input.GetKeyDown (KeyCode.RightArrow)) {
rotation = Quaternion.Euler (new Vector3 (0, -90, 0));
transform.rotation = Quaternion.Euler(new Vector3(0, -90, 0));
} else if (Input.GetKeyDown (KeyCode.UpArrow)) {
rotation = Quaternion.Euler (new Vector3 (0, 0, 0));
} else if (Input.GetKeyDown (KeyCode.DownArrow)) {
rotation = Quaternion.Euler (new Vector3 (0, 180, 0));
}
transform.Translate (rotation * Vector3.forward * Speed * Time.deltaTime);
}