Simple question, working in C#

Have a Unity project due on Monday night for a teacher that doesn’t know Unity. Bummer, right?

Anyway, the assignment is a 2d top down dungeon crawler. I have the random maze setup. However, I’m trying to make it turn based. So instead of movement being a matter of acceleration and deceleration, I need to move a single unit on my 2d array. For the life of me I can’t get the code figured out, I’m pretty sure it’s something along the lines of:

if(Input.GetKey(KeyCode.W))
{
this.transform.Translate(Vector3.forwardTime.deltaTimespeed);
}

The problem is that I want it to go a single unit, instead of a distance. I know that I have to put 3 axis coordinates in there (0,0,0) but I’m not sure what else, if anything, I need. I think this is how it goes:

if(Input.GetKey(KeyCode.W))
{
this.transform.Translate(0,0,1);
}

Any help would be appreciated.

Have a few other questions about cameras, specifically getting a high angle 3rd person chase camera with a spotlight.

try to do it by just updating the position of the game object. So, Don’t move it, but change its position by setting a new value.

so somthing like

float x =  player.transform.position.x + TILE_SIZE;
float y =  player.transform.position.y;
float z =  player.transform.position.z;

 player.transform.position = new Vector3( x,y,z);

Once you get the grid “movement” like that, then you can iterate from the old position to the new.

int newPosX = player.transform.position.x+TILE_SIZE;
//loop the following until you get to the newPos:
this.transform.Translate(Vector3.forward*Time.delt aTime*speed);

sorry, gotta get back to work, but this should help

[edit] fixed a few typos and made the snippet make sense in unity3d land.