//------------------------------------------------------------------------------ // Function: TileLayer // Author: nholmes // Summary: constructor to use when data is available - sets the map data to use, // graphics to use, the size of the tiles and how the layer moves in // relation to it's parent position //------------------------------------------------------------------------------ public TileLayer(string layerName, TileSet tileSet, TileMap tileMap, TileLayerMode layerMode, TileLayer targetLayer, float displayScale, Vector2 positionScale, Vector2 positionOffset, Vector2 displaySize, Color tintColor) { // store the layer's name this.name = layerName; // store the name of the tile set and a reference to them tileSetName = tileSet.Name; this.tileSet = tileSet; // store the name of the tile map and a reference to them tileMapName = tileMap.Name; this.tileMap = tileMap; // store the layer mode this.mode = layerMode; // store the target layer target = targetLayer; // clear the updated status updated = false; // store the scale this.displayScale = displayScale; // store the position scale (this will be ignored if position mode is anything other than 'Scaled' this.positionScale = positionScale; // store the position offset (used by all targeted layer modes) this.positionOffset = positionOffset; // precalculate values used for displaying the tile layer SetDisplaySize(displaySize); // set the tint color this.tintColor = tintColor; }
//------------------------------------------------------------------------------ // Function: TileLayer // Author: nholmes // Summary: constructor to use to create a blank tile layer //------------------------------------------------------------------------------ public TileLayer(Game game, string layerName) { // get a handle to the display manager service displayManager = (DisplayManager)game.Services.GetService(typeof(DisplayManager)); // store the layer's name name = layerName; // store the name of the tile set and a reference to them tileSetName = ""; tileSet = null; // store the name of the tile map and a reference to them tileMapName = ""; tileMap = null; // store the layer mode mode = TileLayerMode.Follow; // set the target layer to be undefined target = null; // default tint color is white tintColor = new Color(255, 255, 255, 255); // clear the updated status updated = false; // store the scale displayScale = 1.0f; // store the position scale (this will be ignored if position mode is anything other than 'Scaled' positionScale = new Vector2(1.0f, 1.0f); // store the position offset (used by all targeted layer modes) positionOffset = new Vector2(0.0f, 0.0f); }