コード例 #1
0
        public static LevelDescription Parse(string filePath)
        {
            LevelDescription _level = new LevelDescription();

            string[] lines = File.ReadAllLines(filePath);

            _level.Name      = lines[0];
            _level.Time      = double.Parse(lines[1]);
            _level.NextLevel = lines[2];

            for (int i = HeaderSize; i < lines.Length; i++)
            {
                string[] enemiesAndTime = lines[i].Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries);

                if (enemiesAndTime.Count() != 0)
                {
                    _level.Enemies.Add(new EnemyDef(enemiesAndTime[0].Trim(), double.Parse(enemiesAndTime[1], CultureInfo.InvariantCulture)));
                }
            }

            return(_level);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Drahkir/Shooter
        private void InitializeGameState()
        {
            LevelDescription level = new LevelDescription();
            level.Time = 900;
            _persistentGameData.CurrentLevel = level;

            // Game states are loaded here
            _system.AddState("start_menu", new StartMenuState(_titleFont, _generalFont, _input, _system));
            _system.AddState("inner_game", new InnerGameState(_system, _input, _textureManager, _persistentGameData, _generalFont));
            _system.AddState("game_over", new GameOverState(_persistentGameData, _system, _input, _generalFont, _titleFont));
            _system.ChangeState("start_menu");
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: iq110/csharpgameprogramming
 private void InitializeGameData()
 {
     LevelDescription level = new LevelDescription();
     level.Time = 30;
     _persistantGameData.CurrentLevel = level;
 }