Esempio n. 1
0
        private CTile[,] LoadTilesFromFile(string file)
        {
            var          fs    = File.Open(file, FileMode.Open);
            BinaryReader br    = new BinaryReader(fs);
            int          maxX  = br.ReadInt32();
            int          maxY  = br.ReadInt32();
            var          tiles = new CTile[maxX, maxY];

            for (int x = 0; x < tiles.GetLength(0); x++)
            {
                for (int y = 0; y < tiles.GetLength(1); y++)
                {
                    tiles[x, y] = new CTile()
                    {
                        Type         = br.ReadUInt16(),
                        Wall         = br.ReadByte(),
                        Liquid       = br.ReadByte(),
                        BTileHeader  = br.ReadByte(),
                        BTileHeader2 = br.ReadByte(),
                        BTileHeader3 = br.ReadByte(),
                        FrameX       = br.ReadInt16(),
                        FrameY       = br.ReadInt16(),
                        STileHeader  = br.ReadInt16()
                    };
                }
            }
            fs.Close();
            return(tiles);
        }