示例#1
0
        private bool TransitionMaps(int direction)
        {
            if (!MapInstance.Lookup.Keys.Contains(mMapId))
            {
                return(false);
            }

            var grid  = MapInstance.Get(mMapId).MapGrid;
            var gridX = MapInstance.Get(mMapId).MapGridX;
            var gridY = MapInstance.Get(mMapId).MapGridY;

            switch (direction)
            {
            case (int)Directions.Up:
                if (gridY > 0 && DbInterface.MapGrids[grid].MyGrid[gridX, gridY - 1] != Guid.Empty)
                {
                    mMapId  = DbInterface.MapGrids[grid].MyGrid[gridX, gridY - 1];
                    mTileY += Options.MapHeight;

                    return(true);
                }

                return(false);

            case (int)Directions.Down:
                if (gridY + 1 < DbInterface.MapGrids[grid].Height &&
                    DbInterface.MapGrids[grid].MyGrid[gridX, gridY + 1] != Guid.Empty)
                {
                    mMapId  = DbInterface.MapGrids[grid].MyGrid[gridX, gridY + 1];
                    mTileY -= Options.MapHeight;

                    return(true);
                }

                return(false);

            case (int)Directions.Left:
                if (gridX > 0 && DbInterface.MapGrids[grid].MyGrid[gridX - 1, gridY] != Guid.Empty)
                {
                    mMapId  = DbInterface.MapGrids[grid].MyGrid[gridX - 1, gridY];
                    mTileX += Options.MapWidth;

                    return(true);
                }

                return(false);

            case (int)Directions.Right:
                if (gridX + 1 < DbInterface.MapGrids[grid].Width &&
                    DbInterface.MapGrids[grid].MyGrid[gridX + 1, gridY] != Guid.Empty)
                {
                    mMapId  = DbInterface.MapGrids[grid].MyGrid[gridX + 1, gridY];
                    mTileX -= Options.MapWidth;

                    return(true);
                }

                return(false);

            default:
                return(false);
            }
        }
示例#2
0
 public MapInstance GetMap()
 {
     return(MapInstance.Get(mMapId));
 }