示例#1
0
        /// <summary>
        /// Create all the stages of the game and wire them up to load one after the other
        /// </summary>
        private IGameStage createGameStages()
        {
            var stage1         = new MainScreen("MainScreen");
            var stage2         = new Level("Level");
            var stage2Settings = new GameStageSettings();

            stage2Settings.Set("replay", true);
            var stage3 = new GameOver("GameOver");

            stage1.Next = stage2;
            stage2.Next = stage3;
            stage3.Next = stage1;

            stage1.End += (o, e) =>
            {
                currentStage = stage2;
                currentStage.BeforeStart();
                currentStage.Start();
                bool?shouldRecord = stage2Settings["replay"] as bool?;
                if (shouldRecord.HasValue && shouldRecord == true)
                {
                    loopId = 0;
                    replay = new Replay();
                    replay.StartRecordingReplay();
                }
            };
            stage2.End += (o, e) =>
            {
                bool?shouldRecord = stage2Settings["replay"] as bool?;
                if (shouldRecord.HasValue && shouldRecord == true)
                {
                    replay.CompleteReplay();
                }
                currentStage = stage3;
                currentStage.BeforeStart();
                currentStage.Start();
            };
            stage3.End += (o, e) => { startNewGame(); };
            return(stage1);
        }
 public void BeforeStart(GameStageSettings settings = null)
 {
     font = DIContainer.Get <AssetLoader>("AssetLoader").Content.Load <SpriteFont>("courier");
 }
示例#3
0
 public void BeforeStart(GameStageSettings settings = null)
 {
     ResetGame();
 }