public ItemData this[Coordinates2D coords]
        {
            get
            {
                return LevelMap[coords.X][coords.Y];
            }

            set
            {
                LevelMap[coords.X][coords.Y] = value;
            }
        }
Exemplo n.º 2
0
        public bool MoveEnemyFromXToY(Coordinates2D x, Coordinates2D y)
        {
            if (!EnemyAt(x))
                return false;

            if (EmptyAt(y))
            {
                _levelData[y] = _levelData[x];
                return true;
            }

            return false;
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 5
0
        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;
 }
Exemplo n.º 7
0
 private bool EmptyAt(Coordinates2D x) 
 {
     return ItemTypeAt(x, ItemData.EMPTY);
 }
Exemplo n.º 8
0
 private bool EnemyAt(Coordinates2D x)
 {
     return ItemTypeAt(x, ItemData.ENEMY);
 }
Exemplo n.º 9
0
 private bool PlayerAt(Coordinates2D x)
 {
     return ItemTypeAt(x, ItemData.FRIEND);
 }
Exemplo n.º 10
0
 private bool ItemTypeAt(Coordinates2D x, ItemData type) 
 {
     if (_levelData[x] == type)
         return true;
     return false;
 }
Exemplo n.º 11
0
 public ItemData GetItemAt(Coordinates2D x)
 {
     return _levelData[x];
 }