Пример #1
0
 public MainMenuSpawnerManager()
     : base()
 {
     this.stateChanged = true;
     this.spawnerStateFunction = null;
     this.stateStackTrace = new Stack<SpawnStateFunction>();
     this.configuration = Configuration.getCurrentConfiguration();
 }
Пример #2
0
        public void backButtonActivationDelegate()
        {
            this.playSelectionSound();

            ISceneManager sceneManager = GameLoop.getSceneManager();
            sceneManager.removeGameObjectsByTag(Tags.BUTTON_TAG);

            this.stateChanged = true;
            this.spawnerStateFunction = this.stateStackTrace.Pop();
        }
Пример #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        private List<KeyValuePair<IGameObject, IGameObject>> spawnBaseMenuInitialObject()
        {
            List<KeyValuePair<IGameObject, IGameObject>> gameObjectParentGameObjectPairList = new List<KeyValuePair<IGameObject, IGameObject>>();

            { // selection sound
                SoundGameObject soundGameObject = new SoundGameObject(new Uri(@"Resources\Sounds\selection.wav", UriKind.Relative), false);
                GameLoop.getSpawnerManager().specialRequestToSpawn(new GameObjectSpawnRequest(soundGameObject, null));
            }

            { // Menu theme
                SoundGameObject soundGameObject = new SoundGameObject(new Uri(@"Resources/Sounds/menu_theme.mp3", UriKind.Relative),
                                                                      0.4,
                                                                      true);
                gameObjectParentGameObjectPairList.Add(new KeyValuePair<IGameObject, IGameObject>(soundGameObject, null));
            }

            { //userObject

                Image image = new Image();
                image.Source = new BitmapImage(new Uri(BitmapUtility.getImgResourcePath(@"hand.png")));
                image.Height = 150;
                image.Width = 150;

                Image notAlreadyTracketImage = new Image();
                notAlreadyTracketImage.Source = new BitmapImage(new Uri(BitmapUtility.getImgResourcePath(@"wave.png")));
                notAlreadyTracketImage.Height = 129;
                notAlreadyTracketImage.Width = 600;

                Geometry boundingBoxGeometry = new EllipseGeometry(new Point(75, 75), 10, 10);

                HandUserGameObject userGameObject = new HandUserGameObject(0, 0, boundingBoxGeometry, notAlreadyTracketImage, image, SkeletonSmoothingFilter.HIGH_SMOOTHING_LEVEL);
                gameObjectParentGameObjectPairList.Add(new KeyValuePair<IGameObject, IGameObject>(userGameObject, null));
            #if DEBUG
                gameObjectParentGameObjectPairList.Add(new KeyValuePair<IGameObject, IGameObject>(new BoundingBoxViewerGameObject(userGameObject), userGameObject));
            #endif
            }

            { //logo

                Image logoImage = new Image();
                logoImage.Source = new BitmapImage(new Uri(BitmapUtility.getImgResourcePath(@"logo.png")));
                logoImage.Height = 221;
                logoImage.Width = 400;

                ImageGuiGameObject logoGameObject = new ImageGuiGameObject(600, 20, logoImage);
                gameObjectParentGameObjectPairList.Add(new KeyValuePair<IGameObject, IGameObject>(logoGameObject, null));

            }

            { //menu area

                ISceneManager sceneManager = GameLoop.getSceneManager();

                CenteredScreenAreaGameObject areaGameObject = new CenteredScreenAreaGameObject(sceneManager.getCanvasWidth(),
                                                                                                   sceneManager.getCanvasHeight(),
                                                                                                   1366,
                                                                                                   700);
                this.menuAreaGameObject = areaGameObject;
                gameObjectParentGameObjectPairList.Add(new KeyValuePair<IGameObject, IGameObject>(areaGameObject, null));
            #if DEBUG
                gameObjectParentGameObjectPairList.Add(new KeyValuePair<IGameObject, IGameObject>(new BoundingBoxViewerGameObject(areaGameObject), areaGameObject));
            #endif
            }

            this.spawnerStateFunction = this.spawnMainMenu;
            this.stateChanged = true;
            return gameObjectParentGameObjectPairList;
        }
Пример #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="newSpawnerState"></param>
        private void changeState(SpawnStateFunction newSpawnerState)
        {
            this.playSelectionSound();

            ISceneManager sceneManager = GameLoop.getSceneManager();
            sceneManager.removeGameObjectsByTag(Tags.BUTTON_TAG);

            this.stateChanged = true;
            this.stateStackTrace.Push(this.spawnerStateFunction);
            this.spawnerStateFunction = newSpawnerState;
        }