/// </summary>\r
public Tilemap Tilemap\r
{\r
- get { return mView.Tilemap; }\r
- set { mView.Tilemap = value; }\r
+ get { return mData.Tilemap; }\r
+ set { mData.Tilemap = value; }\r
}\r
\r
/// <summary>\r
return mData.IsCellOpen(x, y);\r
}\r
\r
+ /// <summary>\r
+ /// created by Brady for AI precalculations\r
+ /// </summary>\r
+ /// <param name="x">X-coordinate.</param>\r
+ /// <param name="y">Y-coordinate.</param>\r
+ public bool IsWall(int x, int y)\r
+ {\r
+ return mData.IsWall(x, y);\r
+ }\r
+\r
/// <summary>\r
/// Determine whether or not a cell can be occupied by a game entity.\r
/// </summary>\r
public List<RawEntity> Entities { get { return mEntities; } }\r
public Point[] PlayerPositions { get { return mPlayerPositions; } }\r
public bool[,] Grid { get { return mBooleanGrid; } }\r
+ public Tilemap Tilemap;\r
\r
\r
public Model(Metadata metadata, char[,] grid, char defaultTile,\r
\r
public bool IsCellOpen(int x, int y)\r
{\r
- // TODO: Still need to define characters for types of scenery.\r
- if (IsOnMap(x, y)) return mGrid[x, y] == ' ';\r
- return false;\r
+ if (!IsOnMap(x, y)) return false;\r
+ return (Tilemap.GetTileFlags(mGrid[x, y]) & TileFlags.Open) == TileFlags.Open;\r
+ }\r
+\r
+ //created by Brady for AI precalculations\r
+ public bool IsWall(int x, int y)\r
+ {\r
+ if (!IsOnMap(x, y)) return false;\r
+ return (Tilemap.GetTileFlags(mGrid[x, y]) & TileFlags.Wall) == TileFlags.Wall;\r
}\r
\r
public void SetCell(int x, int y, char tile)\r
class View\r
{\r
public Vector2 CenterCell;\r
- public Tilemap Tilemap;\r
public float Zoom;\r
\r
\r
\r
public void Draw(SpriteBatch spriteBatch)\r
{\r
- if (Tilemap == null) throw new Exception("Cannot draw map without first setting the tilemap.");\r
+ if (mData.Tilemap == null) throw new Exception("Cannot draw map without first setting the tilemap.");\r
mViewport = spriteBatch.GraphicsDevice.Viewport;\r
\r
for (int y = 0; y < mData.Metadata.GridHeight; y++)\r
{\r
for (int x = 0; x < mData.Metadata.GridWidth; x++)\r
{\r
- Tilemap.Draw(spriteBatch, mData.GetCell(x, y), GetRectangleFromCoordinates(x, y));\r
+ mData.Tilemap.Draw(spriteBatch, mData.GetCell(x, y), GetRectangleFromCoordinates(x, y));\r
}\r
}\r
}\r