public Tile GetNeighbour(Compass Compass) { switch (Compass) { case Compass.N: return(WorldController.GetTileAt((int)tileNumber.X, (int)tileNumber.Y - 1)); case Compass.E: return(WorldController.GetTileAt((int)tileNumber.X + 1, (int)tileNumber.Y)); case Compass.S: return(WorldController.GetTileAt((int)tileNumber.X, (int)tileNumber.Y + 1)); case Compass.W: return(WorldController.GetTileAt((int)tileNumber.X - 1, (int)tileNumber.Y)); case Compass.NE: return(WorldController.GetTileAt((int)tileNumber.X + 1, (int)tileNumber.Y - 1)); case Compass.SE: return(WorldController.GetTileAt((int)tileNumber.X + 1, (int)tileNumber.Y + 1)); case Compass.SW: return(WorldController.GetTileAt((int)tileNumber.X - 1, (int)tileNumber.Y + 1)); case Compass.NW: return(WorldController.GetTileAt((int)tileNumber.X - 1, (int)tileNumber.Y - 1)); default: return(GetNeighbour(Compass.N)); } }
public override void debugRender(Graphics graphics) { if (!DRAW_TILE_HOVER_INFORMATION) { return; } Tile t = WorldController.GetMouseOverTile(); if (t != null) { Debug.drawText(" [Tile] Tile Infrastructure: " + t.GetInfrastructureItem(), duration: 0); Debug.drawText(" [Tile] Tile Position: " + t.GetTileNumber() + " : " + t.GetPosition(), duration: 0); } }
public Tile[] GetNeighbours(bool doDiaganol) { Tile[] ns = new Tile[doDiaganol ? 8 : 4]; ns[0] = WorldController.GetTileAt((int)tileNumber.X, (int)tileNumber.Y - 1); // North ns[1] = WorldController.GetTileAt((int)tileNumber.X - 1, (int)tileNumber.Y); // East ns[2] = WorldController.GetTileAt((int)tileNumber.X, (int)tileNumber.Y + 1); // South ns[3] = WorldController.GetTileAt((int)tileNumber.X + 1, (int)tileNumber.Y); // West if (doDiaganol) { ns[4] = WorldController.GetTileAt((int)tileNumber.X - 1, (int)tileNumber.Y - 1); // North East ns[5] = WorldController.GetTileAt((int)tileNumber.X - 1, (int)tileNumber.Y + 1); // South East ns[6] = WorldController.GetTileAt((int)tileNumber.X + 1, (int)tileNumber.Y + 1); // South West ns[7] = WorldController.GetTileAt((int)tileNumber.X + 1, (int)tileNumber.Y - 1); // North West } return(ns); }