I have a function that sets the drawing state for a particular tile, given another tile. The tile that draws the state is about to change, compares the tiles that surround it, and then updates accordingly. I will try to illustrate this below
[b] [b] [a]
[b] [a] [a]
[a] [a] [a] where a = sand && b = water
when a determines that b borders on it, it must update its drawing state. So I have a function that works in upper case, lower case, left and right. Now I need to change this function so that it can handle the case from left to right, upper right case, lower right case, etc. Etc. Here is my function
public override void CompareBorderingTiles(Tile T)
{
if (T is Water)
{
float leftBound = location.X - (Tile.TileWidth * Tile.TileScale);
float rightBound = location.X + (Tile.TileWidth * Tile.TileScale);
float upperBound = location.Y - (Tile.TileHieght * Tile.TileScale);
float bottomBound = location.Y + (Tile.TileHieght * Tile.TileScale);
if (T.GridLocation.X == leftBound)
{
drawstate = DrawState.Left;
}
if (T.GridLocation.X == rightBound)
drawstate = DrawState.Right;
if (T.GridLocation.Y == upperBound)
drawstate = DrawState.Upper;
if (T.GridLocation.Y == bottomBound)
drawstate = DrawState.Lower;
}
base.CompareBorderingTiles(T);
}
, , . , , (drawstate - ).
- , , ?