public ItemData this[Coordinates2D coords] { get { return LevelMap[coords.X][coords.Y]; } set { LevelMap[coords.X][coords.Y] = value; } }
public bool MoveEnemyFromXToY(Coordinates2D x, Coordinates2D y) { if (!EnemyAt(x)) return false; if (EmptyAt(y)) { _levelData[y] = _levelData[x]; return true; } return false; }
private Coordinates2D GetPlayerLocation(LevelData data) { for (int x = 0; x < data.LevelMap.Length; ++x) { for (int y = 0; y < data.LevelMap[x].Length; ++y) { Coordinates2D coords = new Coordinates2D(x, y); if (data[coords] == ItemData.FRIEND) return coords; } } return null; }
public override void Draw(GameTime gameTime) { for (int x = 0; x < _level.Width; ++x) { for (int y = 0; y < _level.Height; ++y) { Coordinates2D coords = new Coordinates2D(x, y); ItemData item = _level.GetItemAt(coords); } } base.Draw(gameTime); }
public bool MovePlayerFromXToY(Coordinates2D x, Coordinates2D y) { if (!PlayerAt(x)) return false; if (EmptyAt(y)) { _levelData[y] = _levelData[x]; _levelData[x] = ItemData.EMPTY; PlayerCurrentLocation = y; return true; } return false; }
public bool Equals(Coordinates2D other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other.X == X && other.Y == Y; }
private bool EmptyAt(Coordinates2D x) { return ItemTypeAt(x, ItemData.EMPTY); }
private bool EnemyAt(Coordinates2D x) { return ItemTypeAt(x, ItemData.ENEMY); }
private bool PlayerAt(Coordinates2D x) { return ItemTypeAt(x, ItemData.FRIEND); }
private bool ItemTypeAt(Coordinates2D x, ItemData type) { if (_levelData[x] == type) return true; return false; }
public ItemData GetItemAt(Coordinates2D x) { return _levelData[x]; }