Ejemplo n.º 1
0
        public XnaRaceTrackTile(Dictionary <FingerRacerGame.TilePiece, Texture2D> textureMap, string name, string mapData)
            : base(new Rectangle())
        {
            this.TextureMap = textureMap;
            this.Name       = name;

            string[] rows = mapData.Split('\n');

            _boardTiles = new FingerRacerGame.TilePiece[rows.Length][];

            // Let us load the map
            int y = 0;

            foreach (string row in rows)
            {
                string[] cols = row.Trim().Split(' ');

                _boardTiles[y] = new FingerRacerGame.TilePiece[cols.Length];

                int x = 0;
                foreach (string cell in cols)
                {
                    if (y < _boardTiles.Length && x < _boardTiles[0].Length)
                    {
                        _boardTiles[y][x] = (FingerRacerGame.TilePiece)Convert.ToInt32(cell);
                    }
                    x++;
                }
                y++;
            }
        }
Ejemplo n.º 2
0
        public XnaRaceTrackTile(Dictionary<FingerRacerGame.TilePiece, Texture2D> textureMap, string name, string mapData)
            : base(new Rectangle())
        {
            this.TextureMap = textureMap;
            this.Name = name;

            string[] rows = mapData.Split('\n');

            _boardTiles = new FingerRacerGame.TilePiece[rows.Length][];

            // Let us load the map
            int y = 0;
            foreach (string row in rows)
            {
                string[] cols = row.Trim().Split(' ');

                _boardTiles[y] = new FingerRacerGame.TilePiece[cols.Length];

                int x = 0;
                foreach (string cell in cols)
                {
                    if (y < _boardTiles.Length && x < _boardTiles[0].Length)
                    {
                        _boardTiles[y][x] = (FingerRacerGame.TilePiece)Convert.ToInt32(cell);
                    }
                    x++;
                }
                y++;
            }
        }