internal static bool OnSameLine(Theseus theTheseus, Minotaur theMinotaur) { if (theTheseus.Coordinate.Y == theMinotaur.Coordinate.Y) { return(true); } return(false); }
public void LoadUserMap(AMap userMap) { theMap = userMap; theseus = userMap.TheTheseus; minotaur = userMap.TheMinotaur; mapName = userMap.Name; horizontal = userMap.Tiles.GetLength(0) - 1; vertical = userMap.Tiles.GetLength(1) - 1; }
public void LoadMap() { game.SetMap(); SetMap(game.GetCurrentMap()); theseus = theMap.TheTheseus; minotaur = theMap.TheMinotaur; SetTitle(); Painter.SetPanelSize(pnlBackground, this, theMap.Tiles, 2); RenderCharacters(); }
protected void SetMinotaur() { minotaur = currentMap.TheMinotaur; minotaur.SetGame(this); }
internal static String ObjectsToString(Tile[,] theMap, Theseus theTheseus, Minotaur theMinotaur) { string output = ""; int width = theMap.GetLength(0); int height = theMap.GetLength(1); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { output += "."; if (theMap[x, y].MyWalls.HasFlag(TheWalls.North)) { output += "___"; } else { output += " "; } } output += ".\n"; for (int x = 0; x < width; x++) { if (x != width - 1) { if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| "; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " "; } if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| X "; } if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| X "; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " X "; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " X "; } } if (x == width - 1) { if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| "; } if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| |"; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " |"; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " "; } if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| X "; } if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| X |"; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " X |"; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " X "; } } /*** Fixes: * 17/11 * fixed bad spacing when T & M on same row * 18/11 * changed fix to when T/M on furthest column */ if (x == theMinotaur.Coordinate.X && y == theMinotaur.Coordinate.Y) { StringBuilder minoPosition = new StringBuilder(output); if (x == width - 1)//(OnSameLine(theTheseus, theMinotaur) && theTheseus.Coordinate.X < theMinotaur.Coordinate.X && x == (width - 1)) { minoPosition[output.Length - 3] = 'M'; } else { minoPosition[output.Length - 2] = 'M'; } output = minoPosition.ToString(); } if (x == theTheseus.Coordinate.X && y == theTheseus.Coordinate.Y) { StringBuilder thesPosition = new StringBuilder(output); if (x == width - 1)//(OnSameLine(theTheseus, theMinotaur) && theTheseus.Coordinate.X > theMinotaur.Coordinate.X && x == (width - 1)) { thesPosition[output.Length - 3] = 'T'; } else { thesPosition[output.Length - 2] = 'T'; } output = thesPosition.ToString(); } } output += "\n"; } // lowest row of map for (int x = 0; x < width; x++) { output += "."; if (theMap[x, height - 1].MyWalls.HasFlag(TheWalls.South)) { output += "___"; } else { output += " "; } } output += "."; return(output); }
internal static String ObjectsToString(Tile[,] theMap, Theseus theTheseus, Minotaur theMinotaur) { string output = ""; int width = theMap.GetLength(0); int height = theMap.GetLength(1); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { output += "."; if (theMap[x, y].MyWalls.HasFlag(TheWalls.North)) { output += "___"; } else { output += " "; } } output += ".\n"; for (int x = 0; x < width; x++) { if (x != width - 1) { if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| "; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " "; } if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| X "; } if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| X "; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " X "; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " X "; } } if (x == width - 1) { if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| "; } if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| |"; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " |"; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " "; } if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| X "; } if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += "| X |"; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " X |"; } if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End)) { output += " X "; } } /*** Fixes: * 17/11 fixed bad spacing when T & M on same row * 18/11 * changed fix to when T/M on furthest column */ if (x == theMinotaur.Coordinate.X && y == theMinotaur.Coordinate.Y) { StringBuilder minoPosition = new StringBuilder(output); if (x == width - 1)//(OnSameLine(theTheseus, theMinotaur) && theTheseus.Coordinate.X < theMinotaur.Coordinate.X && x == (width - 1)) { minoPosition[output.Length - 3] = 'M'; } else { minoPosition[output.Length - 2] = 'M'; } output = minoPosition.ToString(); } if (x == theTheseus.Coordinate.X && y == theTheseus.Coordinate.Y) { StringBuilder thesPosition = new StringBuilder(output); if (x == width - 1)//(OnSameLine(theTheseus, theMinotaur) && theTheseus.Coordinate.X > theMinotaur.Coordinate.X && x == (width - 1)) { thesPosition[output.Length - 3] = 'T'; } else { thesPosition[output.Length - 2] = 'T'; } output = thesPosition.ToString(); } } output += "\n"; } // lowest row of map for (int x = 0; x < width; x++) { output += "."; if (theMap[x, height - 1].MyWalls.HasFlag(TheWalls.South)) { output += "___"; } else { output += " "; } } output += "."; return output; }
internal static bool OnSameLine(Theseus theTheseus, Minotaur theMinotaur) { if (theTheseus.Coordinate.Y == theMinotaur.Coordinate.Y) { return true; } return false; }