Problem achieving grid based movement with c#

Hey,
I’m fairly new to both unity and c#. I’m trying to program top-down grid based movement similar to the Pokemon games, moving from one tile to the next. I have a movement script that works, but not in the way I want it to. I found a JavaScript version earlier that does what I want but I can’t figure out how to translate it to c# as I have no experience with JavaScript whatsoever.

Here is my current movement script in c# :

using UnityEngine;
using System.Collections;

public class PlayerScript : MonoBehaviour 
{
	public float speed = 2.5f;
	bool canMove;

	void Start ()
	{
		bool canMove = true;

	}

	void Movement () 
	{
		if (Input.GetKey (KeyCode.W)) 
		{
			transform.Translate(Vector3.up * speed * Time.deltaTime);
		}
		if (Input.GetKey (KeyCode.A)) 
		{
			transform.Translate(Vector3.left * speed * Time.deltaTime);
		}
		if (Input.GetKey (KeyCode.S)) 
		{
			transform.Translate(Vector3.down * speed * Time.deltaTime);
		}
		if (Input.GetKey (KeyCode.D)) 
		{
			transform.Translate(Vector3.right * speed * Time.deltaTime);
		}

	}

	void FixedUpdate () 
	{
		if (canMove = true)
		{
			Movement ();

		}

	}
}

Here is the example I found in JavaScript:

#pragma strict
 
 private var speed = 2.0;
 private var pos : Vector3;
 private var tr : Transform;
 
 function Start() {
     pos = transform.position;
     tr = transform;
 }
 
 function Update() 
 {
 
     if (Input.GetKey(KeyCode.D) && tr.position == pos) 
     {
         pos += Vector3.right;
     }
     else if (Input.GetKey(KeyCode.A) && tr.position == pos) 
     {
         pos += Vector3.left;
     }
     else if (Input.GetKey(KeyCode.W) && tr.position == pos) 
     {
         pos += Vector3.up;
     }
     else if (Input.GetKey(KeyCode.S) && tr.position == pos) 
     {
         pos += Vector3.down;
     }
     
     transform.position = Vector3.MoveTowards(transform.position, pos, Time.deltaTime * speed);
 } 

I would greatly appreciate any help anybody could give me with this problem. Thanks

i was going to explain , but i commented the code … not able to test right now, but i guess that is it …

using UnityEngine;
     using System.Collections;
 
 public class PlayerScript : MonoBehaviour 
 {


     private float speed = 2.0f;
     private Vector3 pos;
     private Transform tr;
 
     void Start ()
     {
//Here we set the Values from the current position
         pos = transform.position;
         tr = transform;
     }
 
     void Update () 
     {
     Movement();
 
     }
 
     private void Movement() 
     {
//If we press any Key we will add a direction to the position ...
//using Vector3.'anydirection' will add 1 to that direction


//But we Check if we are at the new Position, before we can add some more
//it will prevent to move before you are at your next 'tile'
          if (Input.GetKey(KeyCode.D) && tr.position == pos) 
      {
          pos += Vector3.right;
      }
      else if (Input.GetKey(KeyCode.A) && tr.position == pos) 
      {
          pos += Vector3.left;
      }
      else if (Input.GetKey(KeyCode.W) && tr.position == pos) 
      {
          pos += Vector3.up;
      }
      else if (Input.GetKey(KeyCode.S) && tr.position == pos) 
      {
          pos += Vector3.down;
      }

//Here you will move Towards the new position ...
      transform.position = Vector3.MoveTowards(transform.position, pos, Time.deltaTime * speed);
 
 
     }
 }