/// <summary> /// /// </summary> public static void RotateLine(LineArray horiz, LineArray vertical, int nodeX, int nodeY, GameLine.LineDirection dirFrom, GameLine.LineDirection dirTo) { if (dirFrom == dirTo) return; GameLine line; if (dirFrom == GameLine.LineDirection.Up) line = vertical.RemoveLine(nodeX, nodeY); else if (dirFrom == GameLine.LineDirection.Left) line = horiz.RemoveLine(nodeX - 1, nodeY); else if (dirFrom == GameLine.LineDirection.Right) line = horiz.RemoveLine(nodeX, nodeY); else line = vertical.RemoveLine(nodeX, nodeY - 1); if (dirTo == GameLine.LineDirection.Up) vertical.SetLine(nodeX, nodeY, line); else if (dirTo == GameLine.LineDirection.Up) vertical.SetLine(nodeX, nodeY - 1, line); else if (dirTo == GameLine.LineDirection.Right) horiz.SetLine(nodeX, nodeY, line); else horiz.SetLine(nodeX - 1, nodeY, line); }
public void SetLine(int xindex, int yindex, GameLine line) { Debug.Log("Array: Trying to set " + xindex + "," + yindex); if (lines[xindex,yindex] != null) throw new InvalidOperationException("Cannot add a line: A line already exists in that location."); Debug.Log("Array: Successfully set."); lines[xindex,yindex] = line; }
public void AddLine(int xindex, int yindex, GameLine.LineDirection direction) { GameLine line = new GameLine(xindex, yindex, direction, gameObject.transform); Debug.Log("Adding line: " + xindex + "," + yindex + " " + direction.ToString()); if (direction == GameLine.LineDirection.Up) vertLines.SetLine(xindex, yindex, line); else if (direction == GameLine.LineDirection.Down) vertLines.SetLine(xindex, yindex - 1, line); else if (direction == GameLine.LineDirection.Left) horLines.SetLine(xindex - 1, yindex, line); else horLines.SetLine(xindex, yindex, line); }
public bool DoesLineExist(int xindex, int yindex, GameLine.LineDirection dir) { switch (dir) { case GameLine.LineDirection.Up: return vertLines.ExistsLine(xindex, yindex); case GameLine.LineDirection.Down: return vertLines.ExistsLine(xindex, yindex - 1); case GameLine.LineDirection.Right: return horLines.ExistsLine(xindex, yindex); case GameLine.LineDirection.Left: return horLines.ExistsLine(xindex - 1, yindex); default: throw new InvalidOperationException(); } }
public void RotateLine(int xindex, int yindex, GameLine.LineDirection dirFrom, GameLine.LineDirection dirTo) { LineArray.RotateLine(horLines, vertLines, xindex, yindex, dirFrom, dirTo); }