public GridComponent(float x, float y, float width, float height, float renderLayer, string path) { X = x; Y = y; Width = width; Height = height; RenderLayer = renderLayer; int minX = 0; int minY = 0; int maxX = 0; int maxY = 0; int xTile = 0; int yTile = 0; Action[] actions = ActionFunctions.PathToActions(path); Dictionary <(int, int), byte[]> tiles = new Dictionary <(int, int), byte[]>() { { (0, 0), Colors[Action.Down] }, }; foreach (Action action in actions) { switch (action & ~Action.A) { case Action.Left: xTile--; break; case Action.Right: xTile++; break; case Action.Up: yTile--; break; case Action.Down: yTile++; break; } tiles[(xTile, yTile)] = Colors[action];
public void ChangePath(string path) { int minX = 0; int minY = 0; int maxX = 0; int maxY = 0; int xTile = 0; int yTile = 0; Action[] actions = ActionFunctions.PathToActions(path); Dictionary <(int, int), byte[]> tiles = new Dictionary <(int, int), byte[]>() { { (0, 0), Colors[Action.Down] }, }; foreach (Action action in actions) { switch (action & ~Action.A) { case Action.Left: xTile--; break; case Action.Right: xTile++; break; case Action.Up: yTile--; break; case Action.Down: yTile++; break; } tiles[(xTile, yTile)] = Colors[action];