Exemplo n.º 1
0
        public override void InitializeScreen()
        {
            InputMap.NewAction(PreviousEntryActionName, Keys.Up);
            InputMap.NewAction(NextEntryActionName, Keys.Down);
            InputMap.NewAction(SelectedEntryActionName, Keys.Enter);
            InputMap.NewAction(SelectedEntryActionName, MousePresses.LeftMouse);
            InputMap.NewAction(MenuCancelActionName, Keys.Escape);

            play = new MainMenuEntry(this, "Play", "PLAY GAME");
            options = new MainMenuEntry(this, "Options", "CHANGE GAME SETTINGS");
            help = new MainMenuEntry(this, "Help", "INPUT DIAGRAM AND GENERAL GAME INFORMATION");
            quit = new MainMenuEntry(this, "Quit", "DONE PLAYING FOR NOW?");

            Removing += new EventHandler(MainMenuRemoving);
            Entering += new TransitionEventHandler(MainMenuScreen_Entering);
            Exiting += new TransitionEventHandler(MainMenuScreen_Exiting);

            play.Selected += new EventHandler(PlayNowSelect);
            options.Selected += new EventHandler(PlaySelect);
            help.Selected += new EventHandler(HelpSelect);
            quit.Selected += new EventHandler(QuitSelect);

            MenuEntries.Add(play);
            MenuEntries.Add(options);
            MenuEntries.Add(help);
            MenuEntries.Add(quit);

            Viewport view = ScreenSystem.Viewport;
            SetDescriptionArea(new Rectangle(100, view.Height - 100,
                view.Width - 100, 50), new Color(11, 38, 40), new Color(29, 108, 117),
                new Point(10, 0), 0.5f);

            //AudioManager.singleton.PlaySong("Menu");
        }
Exemplo n.º 2
0
        public override void InitializeScreen()
        {
            InputMap.NewAction(PreviousEntryActionName, Keys.Up);
            InputMap.NewAction(NextEntryActionName, Keys.Down);
            InputMap.NewAction(SelectedEntryActionName, Keys.Enter);
            InputMap.NewAction(MenuCancelActionName, Keys.Escape);

            play = new MainMenuEntry(this, "Again?","GAME OVER - PLAY THE GAME AGAIN?");
            quit = new MainMenuEntry(this, "Quit","DONE PLAYING FOR NOW?");

            Removing += new EventHandler(GameOverRemoving);
            Entering += new TransitionEventHandler(MainMenuScreen_Entering);
            Exiting += new TransitionEventHandler(MainMenuScreen_Exiting);

            play.Selected += new EventHandler(PlaySelect);
            quit.Selected += new EventHandler(QuitSelect);

            MenuEntries.Add(play);
            MenuEntries.Add(quit);

            Viewport view = ScreenSystem.Viewport;
            SetDescriptionArea(new Rectangle(100, view.Height - 100,view.Width - 100, 50),
                                new Color(11, 38, 40),
                                new Color(29, 108, 117),
                                new Point(10, 0), 0.5f);
        }
        public override void InitializeScreen()
        {
            InputMap.NewAction(PreviousEntryActionName, Keys.Up);
            InputMap.NewAction(NextEntryActionName, Keys.Down);
            InputMap.NewAction(SelectedEntryActionName, Keys.Enter);
            InputMap.NewAction(SelectedEntryActionName, MousePresses.LeftMouse);
            InputMap.NewAction(MenuCancelActionName, Keys.Escape);

            play    = new MainMenuEntry(this, "Play", "PLAY THE GAME");
            options = new MainMenuEntry(this, "Options", "CHANGE GAME SETTINGS");
            help    = new MainMenuEntry(this, "Help", "INPUT DIAGRAM AND GENERAL GAME INFORMATION");
            quit    = new MainMenuEntry(this, "Quit", "DONE PLAYING FOR NOW?");

            Removing += new EventHandler(MainMenuRemoving);
            Entering += new TransitionEventHandler(MainMenuScreen_Entering);
            Exiting  += new TransitionEventHandler(MainMenuScreen_Exiting);

            play.Selected    += new EventHandler(PlaySelect);
            options.Selected += new EventHandler(OptionsSelect);
            help.Selected    += new EventHandler(HelpSelect);
            quit.Selected    += new EventHandler(QuitSelect);

            MenuEntries.Add(play);
            MenuEntries.Add(options);
            MenuEntries.Add(help);
            MenuEntries.Add(quit);

            Viewport view = ScreenSystem.Viewport;

            SetDescriptionArea(new Rectangle(100, view.Height - 100,
                                             view.Width - 100, 50), new Color(11, 38, 40), new Color(29, 108, 117),
                               new Point(10, 0), 0.5f);

            AudioManager.singleton.PlaySong("Menu");
        }
        public override void Initialize()
        {
            //Get a reference to the input system
            InputSystem input = ScreenSystem.InputSystem;

            //Load the actions
            input.NewAction(PreviousEntryActionName, Keys.Up);
            input.NewAction(NextEntryActionName, Keys.Down);
            input.NewAction(SelectedEntryActionName, Keys.Enter);
            input.NewAction(MenuCancelActionName, Keys.Escape);

            //Initialize the entries
            levelSelect = new MainMenuEntry(this, "Play");
            submenu     = new MainMenuEntry(this, "Options");
            intro       = new MainMenuEntry(this, "Intro");
            quit        = new MainMenuEntry(this, "Quit Game");

            //Set up the screen events
            Removing += new EventHandler(MainMenuRemoving);
            Entering += new TransitionEventHandler(MainMenuScreen_Entering);
            Exiting  += new TransitionEventHandler(MainMenuScreen_Exiting);

            //Set up the entry events, and load a submenu.
            levelSelect.AddSubMenu(new LevelSelectScreen(this));
            submenu.AddSubMenu(new OptionsScreen(this));
            intro.Selected += new EventHandler(IntroSelect);
            quit.Selected  += new EventHandler(QuitSelect);

            //Finally, add all entries to the list
            MenuEntries.Add(levelSelect);
            MenuEntries.Add(submenu);
            MenuEntries.Add(intro);
            MenuEntries.Add(quit);
        }
Exemplo n.º 5
0
        protected void FireTransitionEvent <T>(TransitionEvent <T> transitionEvent, TransitionEventHandler <T> transitionEventHandler) where T : IViewModel, new()
        {
            if (transitionEvent == null || transitionEventHandler == null)
            {
                return;
            }

            transitionEventHandler((ITransitionEventSender <T>) this, transitionEvent);
        }
Exemplo n.º 6
0
        public override void Initialize()
        {
            starsCollected = 1;
            levelManager   = new LevelManager();
            levelManager.Init(ScreenSystem.Game, ScreenSystem.SpriteBatch);
            if (level == 0)
            {
                curLevel = levelManager.NextLevel();
            }
            else
            {
                curLevel = levelManager.GetLevel(level);
            }


            //Inits the audio
            switch (level)
            {
            case 1:
                audioManager = new AudioManager("spacetheme");
                break;

            case 2:
                audioManager = new AudioManager("spacetheme");
                break;

            case 3:
                audioManager = new AudioManager("lavatheme");
                break;
            }

            audioManager.LoadContent();


            objectManager    = (ObjectManager)ScreenSystem.Game.Services.GetService((typeof(ObjectManager)));
            collisionManager = (IManageCollisionsService)ScreenSystem.Game.Services.GetService((typeof(IManageCollisionsService)));
            _input           = (InputManager)ScreenSystem.Game.Services.GetService(typeof(IInputService));
            input            = ScreenSystem.InputSystem;
            input.NewAction("Pause", Keys.Escape);
            screenOverlayManager = new ScreenOverlayManager(ScreenSystem.Game, this);
            ScreenSystem.Game.Components.Add(screenOverlayManager);
            Entering += new TransitionEventHandler(PlayScreen_Entering);
        }
        public override void Initialize()
        {
            //Get a reference to the input system
            InputSystem input = ScreenSystem.InputSystem;

            //Load the actions
            input.NewAction(PreviousEntryActionName, Keys.Up);
            input.NewAction(NextEntryActionName, Keys.Down);
            input.NewAction(SelectedEntryActionName, Keys.Enter);
            input.NewAction(MenuCancelActionName, Keys.Escape);

            //Initialize the entries
            levelSelect = new MainMenuEntry(this, "Play");
            submenu = new MainMenuEntry(this, "Options");
            intro = new MainMenuEntry(this, "Intro");
            quit = new MainMenuEntry(this, "Quit Game");

            //Set up the screen events
            Removing += new EventHandler(MainMenuRemoving);
            Entering += new TransitionEventHandler(MainMenuScreen_Entering);
            Exiting += new TransitionEventHandler(MainMenuScreen_Exiting);

            //Set up the entry events, and load a submenu.
            levelSelect.AddSubMenu(new LevelSelectScreen(this));
            submenu.AddSubMenu(new OptionsScreen(this));
            intro.Selected += new EventHandler(IntroSelect);
            quit.Selected += new EventHandler(QuitSelect);

            //Finally, add all entries to the list
            MenuEntries.Add(levelSelect);
            MenuEntries.Add(submenu);
            MenuEntries.Add(intro);
            MenuEntries.Add(quit);
        }
Exemplo n.º 8
0
        public override void Initialize()
        {
            starsCollected = 1;
            levelManager = new LevelManager();
            levelManager.Init(ScreenSystem.Game, ScreenSystem.SpriteBatch);
            if (level == 0)
            {
                curLevel = levelManager.NextLevel();
            }
            else
            {
                curLevel = levelManager.GetLevel(level);
            }

            //Inits the audio
            switch (level)
            {
                case 1:
                    audioManager = new AudioManager("spacetheme");
                    break;
                case 2:
                    audioManager = new AudioManager("spacetheme");
                    break;
                case 3:
                    audioManager = new AudioManager("lavatheme");
                    break;
            }

            audioManager.LoadContent();

            objectManager = (ObjectManager)ScreenSystem.Game.Services.GetService((typeof(ObjectManager)));
            collisionManager = (IManageCollisionsService)ScreenSystem.Game.Services.GetService((typeof(IManageCollisionsService)));
            _input = (InputManager)ScreenSystem.Game.Services.GetService(typeof(IInputService));
            input = ScreenSystem.InputSystem;
            input.NewAction("Pause", Keys.Escape);
            screenOverlayManager = new ScreenOverlayManager(ScreenSystem.Game, this);
            ScreenSystem.Game.Components.Add(screenOverlayManager);
            Entering += new TransitionEventHandler(PlayScreen_Entering);
        }
Exemplo n.º 9
0
		private void OnTransitionEvent(TransitionEventHandler handler, StateBase prev, StateBase next, TriggerBase why) {
			if (handler != null)
			{
				if (_invokeDelegate.InvokeRequired)
				{
					_invokeDelegate.Invoke(new TransitionEventHandler(handler), 
									new[] { this, (object) new TransitionEventArgs(prev, next, why) }
					);
					return;
				}
				handler(this, new TransitionEventArgs(prev, next, why));
			}
		}
Exemplo n.º 10
0
        /// <summary>
        /// Makes the state machine go into another state.
        /// </summary>
        public void TransitionToNewState(StateBase newState, TriggerBase causedByTrigger, GuardBase guard, TransitionEventHandler EffectHandler)
		{
            if (disposedValue)
            { // Silent
                throw new InvalidOperationException("State Machine Disposed");
            }
			// Pull the trigger to find if condition is Ok.
			OnTransitionEvent(StartTransition, this.CurrentState, newState, causedByTrigger);
            if ( guard != null )
            {
                if (!guard.Execute()) return; // Guard said this trigger can't go on
            }

			OnTransitionEvent(BeforeExitingPreviousState, this.CurrentState, newState, causedByTrigger);
            // exit the current state
            if (this.CurrentState != null)
				this.CurrentState.OnExit(causedByTrigger);

            StateBase previousState = this.CurrentState ;
			this.CurrentState = newState;
			
			//call effect
			if(EffectHandler != null)
				OnTransitionEvent(EffectHandler, previousState, this.CurrentState, causedByTrigger);

            // enter the new state
            if (this.CurrentState != null)
				this.CurrentState.OnEntry(causedByTrigger);
			OnTransitionEvent(EndTransition, previousState, this.CurrentState, causedByTrigger);
        }