How do i change this code to switch statement format:
if(Input.GetKey("up") && Input.GetKey("right"))
{
direction = "upright";
// Debug.Log("upright");
}
else if(Input.GetKey("up") && Input.GetKey("left"))
{ direction = "upleft";
// Debug.Log("upleft");
}
else if(Input.GetKey("down") && Input.GetKey("right"))
{ direction = "downright";
// Debug.Log("downright");
}
else if(Input.GetKey("down") && Input.GetKey("left"))
{ direction = "downleft";
// Debug.Log("downleft");
}
else if(Input.GetKey("up"))
{ direction = "up";
// Debug.Log("up");
}
else if(Input.GetKey("right"))
{ direction = "right";
// Debug.Log("right");
}
else if(Input.GetKey("down"))
{ direction = "down";
// Debug.Log("down");
}
else if(Input.GetKey("left"))
{ direction = "left";
// Debug.Log("left");
}