Exemple #1
0
        private LevelScript LoadScript(ContentManager content, string level)
        {
            LevelScript s = new LevelScript();

            using (StreamReader r = new StreamReader(content.RootDirectory + @"/gfx/levels/" + level + ".txt"))
            {
                while (!r.EndOfStream)
                {
                    string[] line = r.ReadLine().Split('=');
                    switch (line[0].ToLower())
                    {
                    case "rain":
                        s.rain = int.Parse(line[1]);
                        break;

                    case "fan":
                        fans.Add(Fan.Parse(line[1]));
                        break;

                    case "sign":
                        signs.Add(Sign.Parse(line[1]));
                        break;

                    default:
                        break;
                    }
                }
            }
            return(s);
        }
Exemple #2
0
        public Level LoadContent(ContentManager content, int level)
        {
            signs   = new List <Sign>();
            fans    = new List <Fan>();
            texture = content.Load <Texture2D>(@"gfx/grid");
            sources = new Dictionary <Cell, Rectangle> {
                { Cell.None, SourceRectangle.Create(0, 0, 0, 0) }, //Empty
                { Cell.Dirt, SourceRectangle.Create(0, 0, 1, 1) }, //2
                { Cell.DirtFloor, SourceRectangle.Create(1, 0, 1, 1) },
                { Cell.DirtSky, SourceRectangle.Create(2, 0, 1, 1) },
                { Cell.Stone, SourceRectangle.Create(3, 0, 1, 1) },
                { Cell.StoneFloor, SourceRectangle.Create(4, 0, 1, 1) },
                { Cell.StoneSky, SourceRectangle.Create(5, 0, 1, 1) },
                { Cell.Spikes, SourceRectangle.Create(6, 0, 1, 1) },
                { Cell.Start, SourceRectangle.Create(7, 0, 1, 1) },
                { Cell.End, SourceRectangle.Create(8, 0, 1, 1) }
            };

            start  = Vector2.Zero;
            end    = Vector2.Zero;
            grid   = LoadLevel(content, "level" + level, out start, out end);
            script = LoadScript(content, "level" + level);

            signTex = content.Load <Texture2D>(@"gfx/sign");
            fanTex  = content.Load <Texture2D>(@"gfx/fan");

            return(this);
        }
Exemple #3
0
        private LevelScript LoadScript(ContentManager content, string level)
        {
            LevelScript s = new LevelScript();
            using (StreamReader r = new StreamReader(content.RootDirectory + @"/gfx/levels/" + level + ".txt"))
            {
                while (!r.EndOfStream)
                {
                    string[] line = r.ReadLine().Split('=');
                    switch (line[0].ToLower())
                    {
                        case "rain":
                            s.rain = int.Parse(line[1]);
                            break;

                        case "fan":
                            fans.Add(Fan.Parse(line[1]));
                            break;

                        case "sign":
                            signs.Add(Sign.Parse(line[1]));
                            break;

                        default:
                            break;
                    }
                }
            }
            return s;
        }
 public ParticleManager LoadContent(ContentManager content, LevelScript script)
 {
     texture = content.Load<Texture2D>(@"gfx/particles");
     rain = script.rain;
     return this;
 }
Exemple #5
0
        public Level LoadContent(ContentManager content, int level)
        {
            signs = new List<Sign>();
            fans = new List<Fan>();
            texture = content.Load<Texture2D>(@"gfx/grid");
            sources = new Dictionary<Cell,Rectangle>{
                {Cell.None, SourceRectangle.Create(0, 0, 0, 0)}, //Empty
                {Cell.Dirt, SourceRectangle.Create(0, 0, 1, 1)}, //2
                {Cell.DirtFloor, SourceRectangle.Create(1, 0, 1, 1)},
                {Cell.DirtSky, SourceRectangle.Create(2, 0, 1, 1)},
                {Cell.Stone, SourceRectangle.Create(3, 0, 1, 1)},
                {Cell.StoneFloor, SourceRectangle.Create(4, 0, 1, 1)},
                {Cell.StoneSky, SourceRectangle.Create(5, 0, 1, 1)},
                {Cell.Spikes,  SourceRectangle.Create(6, 0, 1, 1)},
                {Cell.Start, SourceRectangle.Create(7, 0, 1, 1)},
                {Cell.End, SourceRectangle.Create(8, 0, 1, 1)}
            };

            start = Vector2.Zero;
            end = Vector2.Zero;
            grid = LoadLevel(content, "level" + level, out start, out end);
            script = LoadScript(content, "level" + level);

            signTex = content.Load<Texture2D>(@"gfx/sign");
            fanTex = content.Load<Texture2D>(@"gfx/fan");

            return this;
        }