Trying to Implement 3x3 grid based movement in unity

I Initially did a grid based movement for a game I am working on using If-else Statement.
The source code is here:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public enum GRIDY { left, mid, right, topleft, topmid, topright, botleft, botmid, botright }
public class PlayerMove : MonoBehaviour
{

public GRIDY pos = GRIDY.mid;
float newXpos = 0f ,newYpos = 0f; //New Position of grid

bool Moveleft, Moveright, Moveup, Movedown;
[SerializeField] float xvalue=3f;
[SerializeField] float yvalue=2f;
float x;
float y;
[SerializeField] float gridMoveSpeed = 1.5f; //Grid to Grid Speed
[SerializeField] float flightSpeed = 400f; //FlightSpeed

CharacterController controller;
Rigidbody rb;

//float FSpeed = 5f;
// Start is called before the first frame update

void Start()
{

rb = GetComponent();
controller = GetComponent();
//transform.position = Vector3.zero;
//bool movingUp , movingDown, movingLeft, movingRight = false; //Touch
}

// Update is called once per frame
void Update()
{
Moveleft = Input.GetKeyDown(KeyCode.A);
Moveright = Input.GetKeyDown(KeyCode.D);
Moveup =Input.GetKeyDown(KeyCode.W);
Movedown =Input.GetKeyDown(KeyCode.S);

if(Moveleft)
{

if (pos == GRIDY.mid)
{
newXpos = -xvalue;
pos = GRIDY.left;
}
else if (pos == GRIDY.topmid)
{
newXpos = -xvalue;
pos = GRIDY.topleft;

}
else if (pos == GRIDY.botmid)
{
newXpos = -xvalue;
pos = GRIDY.botleft;

}

else if (pos == GRIDY.right)
{
newXpos = 0;
pos = GRIDY.mid;
}
else if (pos == GRIDY.topright)
{
newXpos = 0;
pos = GRIDY.topmid;
}
else if (pos == GRIDY.botright)
{
newXpos = 0;
pos = GRIDY.botmid;

}
}
if (Moveright)
{
if (pos == GRIDY.mid)
{
newXpos = xvalue;
pos = GRIDY.right;

}
else if (pos == GRIDY.topmid)
{
newXpos = xvalue;
pos = GRIDY.topright;

}
else if (pos == GRIDY.botmid)
{
newXpos = xvalue;
pos = GRIDY.botright;

}
else if (pos == GRIDY.left)
{
newXpos = 0;
pos = GRIDY.mid;

}
else if (pos == GRIDY.topleft)
{
newXpos = 0;
pos = GRIDY.topmid;

}
else if (pos == GRIDY.botleft)
{
newXpos = 0;
pos = GRIDY.botmid;

}
}
if (Moveup)
{
if (pos == GRIDY.mid)
{
newYpos = yvalue;
pos = GRIDY.topmid;

}
else if (pos == GRIDY.botmid)
{
newYpos = 0;
pos = GRIDY.mid;

}
else if (pos == GRIDY.left)
{
newYpos = yvalue;
pos = GRIDY.topleft;

}

else if (pos == GRIDY.botleft)
{
newYpos = 0;
pos = GRIDY.left;

}
else if (pos == GRIDY.right)
{
newYpos = yvalue;
pos = GRIDY.topright;

}

else if (pos == GRIDY.botright)
{
newYpos = 0;
pos = GRIDY.right;

}
}
if (Movedown)
{
if (pos == GRIDY.mid)
{
newYpos = -yvalue;
pos = GRIDY.botmid;

}
else if (pos == GRIDY.topmid)
{
newYpos = 0;
pos = GRIDY.mid;

}
else if (pos == GRIDY.left)
{
newYpos = -yvalue;
pos = GRIDY.botleft;

}
else if (pos == GRIDY.topleft)
{
newYpos = 0;
pos = GRIDY.left;
}
else if(pos==GRIDY.right)
{
newYpos = -yvalue;
pos = GRIDY.botright;
}
else if (pos == GRIDY.topright)
{
newYpos = 0;
pos = GRIDY.right;
}

}

x = Mathf.Lerp(x, newXpos, Time.deltaTime * gridMoveSpeed);
y = Mathf.Lerp(y, newYpos, Time.deltaTime * gridMoveSpeed);
controller.Move((x - transform.position.x) * Vector3.right * gridMoveSpeed);
controller.Move((y - transform.position.y) * Vector3.up * gridMoveSpeed);

rb.velocity = transform.forward * flightSpeed * Time.deltaTime;

}

}

I wanna know is there any other way I can try and achieve this 3x3 matric grid based movement and encapsulate my code. Thanks in advance for the help.

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

There are an infinite number of ways to do anything. Does this way work? Why would you care about another way except academically? In that case, try out a bunch of other tutorials for this motion.

What does this mean? Does the code work? Ship it! If you think there’s a problem, then define the problem and set about fixing that problem. If you don’t define the problem, nobody here can help you.

Beyond that, how to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220