/// <summary>
        /// Completely clears this GameLevel
        /// </summary>
        private void ClearLevel()
        {
            _mainLayer = null;
            _gameLayers.Clear();
            _camera = null;

            // Verification WriteLine
            Console.WriteLine("Current level cleared!");
        }
        /// <summary>
        /// Clears the current level and generates a new level
        /// </summary>
        /// <param name="numRows">Number of tile rows</param>
        /// <param name="numCols">Number of tile columns</param>
        /// <param name="defaultTileReferenceCode">Default tile to populate the GameLevel</param>
        public void NewLevel(int numRows, int numCols, byte defaultTileReferenceCode)
        {
            ClearLevel();
            _camera = new Camera2D(Graphics);
            _mainLayer = new GameLayerTiled(this, numRows, numCols, defaultTileReferenceCode);

            // Verification WriteLine
            Console.WriteLine("New level created!\n Tile rows: " + numRows + "\nTile cols: " + numCols);
        }
        /// <summary>
        /// Load a GameLevel from a specified file
        /// </summary>
        /// <param name="filename">File to load from</param>
        public void LoadLevel(string filename)
        {
            string loadPath = "Levels\\" + filename;
            GameLevelData levelData = Content.Load<GameLevelData>(loadPath);

            ClearLevel();
            _camera = new Camera2D(Graphics);
            _mainLayer = new GameLayerTiled(this, levelData.MainLayerData);

            // Verification WriteLine
            Console.WriteLine("Load successfull!\n" + loadPath);
        }
        /// <summary>
        /// Common constructor code
        /// Should be called by all constructors
        /// </summary>
        /// <param name="numRows">Number of tile rows</param>
        /// <param name="numCols">Number of tile columns</param>
        private void Construct(GameLayerTiled gameLayer, int numRows, int numCols)
        {
            _gameLayer = gameLayer;

            // ---------- Load TileTypes into ContentLibrary ----------
            ContentLib.LoadTypesFromFile<TileTypeData, TileType>("ReferenceData\\", "tiletypes");

            // ---------- Allocate 2D tile array ----------
            _tiles = new TileRef[numRows, numCols];
            _numRows = numRows;
            _numCols = numCols;

            // ---------- Allocate tile selection attributes ----------
            _selectedIndices = new List<Vector2>();
            _selectionSize = 2;
            _selectionTexture = Content.Load<Texture2D>("Textures/tileselector");
            _selectionTextureDraw = _selectionTexture;
            _selectionColor = new Color(150, 150, 150, 150);
            _selectionColorDraw = _selectionColor;
        }
        /// <summary>
        /// Load a TileSystem from data file
        /// </summary>
        public TileSystem(GameLayerTiled gameLayer, TileSystemData tileSystemData)
        {
            Construct(gameLayer, tileSystemData.NumRows, tileSystemData.NumCols);

            // ---------- Populate 2D tile array with specified data ----------
            for (int i = 0; i < _numRows; i++)
                for (int j = 0; j < _numCols; j++)
                {
                    int current1Dindex = j + (i * _numCols);
                    TileRef tile = new TileRef(tileSystemData.Tiles[current1Dindex]);
                    _tiles[i, j] = tile;
                }
        }
        private bool _updatePlayerControls; // Indicates whether or not to update player controls

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create a new TileSystem
        /// </summary>
        /// <param name="defaultTile">ReferenceID for default tile which will fill the system</param>
        public TileSystem(GameLayerTiled gameLayer, int numRows, int numCols, short defaultTile)
        {
            Construct(gameLayer, numRows, numCols);

            // ---------- Populate 2D tile array with specified tile ----------
            for (int i = 0; i < _numRows; i++)
                for (int j = 0; j < _numCols; j++)
                {
                    TileRef tile = new TileRef(defaultTile, 0);
                    _tiles[i, j] = tile;
                }
        }