Exemplo n.º 1
0
        public void Unoccupy(int x, int y)
        {
            for (int i = mOccupiedTiles.Count - 1; i > -1; i--)
            {
                OccupiedTile occupiedTile = mOccupiedTiles[i];

                if (occupiedTile.X == x && occupiedTile.Y == y)
                {
                    mOccupiedTiles.RemoveAt(i);
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public void Unoccupy(object occupier)
        {
            for (int i = mOccupiedTiles.Count - 1; i > -1; i--)
            {
                OccupiedTile occupiedTile = mOccupiedTiles[i];

                if (occupiedTile.Occupier == occupier)
                {
                    mOccupiedTiles.RemoveAt(i);

                    // Don't do a break here because
                    // one occupier could occupy multiple
                    // tiles.
                    // break;
                }
            }
        }
Exemplo n.º 3
0
        public void OccupyTile(int x, int y, object occupier)
        {
#if DEBUG
            object objectAlreadyOccupying = GetTileOccupier(x, y);

            if (objectAlreadyOccupying != null)
            {
                throw new InvalidOperationException("The tile at " + x + ", " + y + " is already occupied by " +
                                                    objectAlreadyOccupying.ToString());
            }
#endif
            OccupiedTile occupiedTile = new OccupiedTile();
            occupiedTile.X        = x;
            occupiedTile.Y        = y;
            occupiedTile.Occupier = occupier;

            mOccupiedTiles.Add(occupiedTile);
        }
Exemplo n.º 4
0
        public void OccupyTile(int x, int y, object occupier)
        {
#if DEBUG
            object objectAlreadyOccupying = GetTileOccupier(x, y);

            if (objectAlreadyOccupying != null)
            {
                throw new InvalidOperationException("The tile at " + x + ", " + y + " is already occupied by " +
                    objectAlreadyOccupying.ToString());
            }
#endif
            OccupiedTile occupiedTile = new OccupiedTile();
            occupiedTile.X = x;
            occupiedTile.Y = y;
            occupiedTile.Occupier = occupier;

            mOccupiedTiles.Add(occupiedTile);

        }