示例#1
0
文件: FSEGame.cs 项目: mbg/FSEGame
        public void BeginBattle(String configuration)
        {
            DialogueEventDelegate outroDelegate = null;
            outroDelegate = new DialogueEventDelegate(delegate
            {
                this.DialogueManager.OnEnd -= outroDelegate;
                this.RegisterDefaultDialogueHandlers();
                this.state = GameState.Menu;
                this.OpenMainMenu();
            });

            BattleEndedDelegate battleDelegate = null;
            battleDelegate = new BattleEndedDelegate(delegate(Boolean victory)
            {
                this.battleManager.Ended -= battleDelegate;

                if (victory)
                {
                    this.CurrentLevel.Unload();

                    this.character.Orientation = 180.0f;

                    this.UnregisterDefaultDialogueHandlers();
                    this.DialogueManager.OnEnd += outroDelegate;
                    this.DialogueManager.PlayDialogue(@"FSEGame\Dialogues\Outro.xml");
                }
                else
                {
                    this.state = GameState.Menu;
                    this.gameOverScreen.Show();
                }
            });

            this.BeginBattle(configuration, battleDelegate);
        }
示例#2
0
文件: FSEGame.cs 项目: mbg/FSEGame
        public void BeginBattle(String configuration, BattleEndedDelegate ended)
        {
            this.state = GameState.Battle;

            BattleEndedDelegate battleDelegate = null;
            battleDelegate = new BattleEndedDelegate(delegate(Boolean victory)
            {
                this.battleManager.Ended -= battleDelegate;

                ended(victory);
            });

            FadeScreenEventDelegate fadeEndEvent = null;
            fadeEndEvent = new FadeScreenEventDelegate(delegate
            {
                this.fadeScreen.Finished -= fadeEndEvent;
                this.fadeScreen.Enabled = false;
                this.fadeScreen.Visible = false;

                this.UnregisterDefaultDialogueHandlers();

                this.battleManager.Ended += battleDelegate;
                this.battleManager.Load(configuration);
                this.battleManager.Start();
            });

            this.fadeScreen.Visible = true;
            this.fadeScreen.Enabled = true;
            this.fadeScreen.Finished += fadeEndEvent;
            this.fadeScreen.FadeIn(1.0d);
        }
示例#3
0
文件: Markus.cs 项目: mbg/FSEGame
        /// <summary>
        /// Performs Markus' action based on the current state of the game.
        /// </summary>
        protected override void PerformAction()
        {
            if (this.HasAcquiredStick())
            {
                GameBase.Singleton.DialogueManager.PlayDialogue(
                    @"FSEGame\Dialogues\MarkusPostStick.xml");
            }
            else if (this.CanAcquireStick())
            {
                FSEGame.Singleton.UnregisterDefaultDialogueHandlers();

                DialogueEventDelegate stickDelegate = null;
                stickDelegate = new DialogueEventDelegate(delegate
                {
                    FSEGame.Singleton.DialogueManager.OnEnd -= stickDelegate;
                    FSEGame.Singleton.RegisterDefaultDialogueHandlers();

                    FSEGame.Singleton.State = GameState.Exploring;

                    this.GiveStick();
                });

                // :: Declare the event handler for the end of the combat sequence. This
                // :: delegate will be called when the battle has ended and the outcome
                // :: will be supplied as argument.
                BattleEndedDelegate battleEndedDelegate = null;
                battleEndedDelegate = new BattleEndedDelegate(delegate(Boolean victory)
                {
                    FSEGame.Singleton.LoadLevel(@"Levels\House3.xml", "TutorialEnd", false);
                    FSEGame.Singleton.Character.Orientation = 0.0f;
                    FSEGame.Singleton.PlayerCharacter.CurrentAttributes.Health =
                        FSEGame.Singleton.PlayerCharacter.BaseAttributes.Health;

                    // :: If the player is victorious, give him the stick and play
                    // :: a short dialogue - however, if the player has lost, don't
                    // :: give him the stick.
                    if (victory)
                    {
                        FSEGame.Singleton.UnregisterDefaultDialogueHandlers();
                        FSEGame.Singleton.DialogueManager.OnEnd += stickDelegate;

                        FSEGame.Singleton.State = GameState.Cutscene;

                        GameBase.Singleton.DialogueManager.PlayDialogue(
                            @"FSEGame\Dialogues\MarkusPostTutorial.xml");
                    }
                    else
                    {
                        FSEGame.Singleton.RegisterDefaultDialogueHandlers();

                        GameBase.Singleton.DialogueManager.PlayDialogue(
                            @"FSEGame\Dialogues\MarkusPostTutorialLoss.xml");
                    }
                });

                DialogueEventDelegate endDelegate = null;
                endDelegate = new DialogueEventDelegate(delegate
                {
                    FSEGame.Singleton.DialogueManager.OnEnd -= endDelegate;
                    FSEGame.Singleton.RegisterDefaultDialogueHandlers();

                    FSEGame.Singleton.BeginBattle(@"BattleData\Tutorial1.xml", battleEndedDelegate);
                });

                FSEGame.Singleton.DialogueManager.OnEnd += endDelegate;
                FSEGame.Singleton.State = GameState.Cutscene;

                GameBase.Singleton.DialogueManager.PlayDialogue(
                    @"FSEGame\Dialogues\MarkusStick.xml");
            }
            else
            {
                GameBase.Singleton.DialogueManager.PlayDialogue(
                    @"FSEGame\Dialogues\MarkusDefault.xml");
            }
        }