public void LoadContent(IsometricTile tile) { _sourceTile = tile; _hitbox = new Diamond(new Rectangle((int)tile.Position.X, (int)tile.Position.Y, tile.SourceRect.Width, tile.SourceRect.Height)); _type = tile.Value1; _height = tile.Height; _position = tile.Position; //We can come up with many types, not just 3. (Double digit ints and negative ints can be read as well.) switch (Type) { case 1: _walkable = true; _damaging = false; break; case 2: _walkable = true; _damaging = false; break; case 3: _walkable = true; _damaging = false; break; default: _walkable = false; _damaging = false; break; } }
public IsometricRendering(int width, int height, Vector2 tileSize, SpriteBatch spriteBatch) { TileSize = tileSize; SpriteBatch = spriteBatch; Tiles = new IsometricTile[width, height]; Half = new Vector2(width / 2f, height / 2f); Position = Half * TileSize; }
/// <summary> /// Default constructor /// </summary> public CombatTile() { _hitbox = new Diamond(); _sourceTile = new IsometricTile(); _agentOccupying = null; // need to find a way to make this not null _gridPosition = Point.Zero; _position = Vector2.Zero; }
public List <GameObject> AdjacentRoads(IsometricTile tile) { List <GameObject> list = new List <GameObject>(); foreach (var neighbor in tile.m_adjacent) { if (neighbor != null) { if (m_roads.Contains(neighbor.GetComponent <SpriteRenderer>().sprite)) { list.Add(neighbor); } } } return(list); }
int AdjacentScore(IsometricTile tile) { int adjacent = 0; int i = 1; foreach (var neighbor in tile.m_adjacent) { if (neighbor != null) { if (m_roads.Contains(neighbor.GetComponent <SpriteRenderer>().sprite)) { adjacent += i; } } i *= 2; } return(adjacent); }