示例#1
0
 public static GameData getInstance()
 {
     if (Instance == null)
     {
         Instance = new GameData();
     }
     return Instance;
 }
示例#2
0
文件: Map.cs 项目: ericamccowan/ILS
        } // End constructor.
        #endregion


        public void setUp( string mapName, float mapVersion, string mapOrientation, int mapWidth, int mapHeight, int mapTileWidth, int mapTileHeight, int numberOfLayers, List<MapRow> rowList )
        { // Start Setup.

            // Singleton reference cache:
            _camera = Camera.getInstance();
            _gameData = GameData.getInstance();
            _spriteBatch = Game1.Instance.SpriteBatch;

            // Information loaded from the map:
            _mapName = mapName;
            _mapVersion = mapVersion;
            _mapOrientation = mapOrientation;
            _mapWidth = mapWidth;
            _mapHeight = mapHeight;
            _mapTileWidth = mapTileWidth;
            _mapTileHeight = mapTileHeight;
            _numberOfLayers = numberOfLayers;
            _rowList = rowList;

            // Getting the texture:
            if ( _gameData.ArtManager.ContainsKey ( mapName ) )
                _texture = _gameData.ArtManager.getObject ( _mapName );
            else
                _texture = _gameData.ArtManager.getObject ( GameGlobals.defaultGraphicFiles[1] );

            _textureWidth = _texture.Width;
            _textureHeight = _texture.Height;

            // Setting basic draw data based on defaults:
            _sourceRect = Rectangle.Empty;
            _sourceRect.Width = _mapTileWidth;
            _sourceRect.Height = _mapTileHeight;
            _tint = MapGlobals.defaultTint;
            _rotation = MapGlobals.defaultRotation;
            _origin = MapGlobals.defaultOrigin;
            _scale = MapGlobals.defaultScale;
            _spriteEffect = MapGlobals.defaultSpriteEffect;
            _layer = 1.0f;
            _tilesToViewAcross = (int) ( _gameData.ViewportWidth / _mapTileWidth );
            _tilesToViewDown = (int) ( _gameData.ViewportHeight / _mapTileHeight );
            //_rotationCompensatorMultiplier = MapGlobals.tileViewMultiplier;

        } // End Setup.