Example #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);
        }