public SceneManager(Menu m, World l, EndScreen e) { menu = m; level = l; endScreen = e; fsm = new FSM(this); inMenu.AddTransition(new Transition(inGame, () => bChange)); inGame.AddTransition(new Transition(inEndScreen, () => !level.Player.Active)); inEndScreen.AddTransition(new Transition(inMenu, () => bChange)); fsm.AddState(inMenu); fsm.AddState(inGame); fsm.AddState(inEndScreen); }
protected override void Initialize() { base.Initialize(); widgetManager = new WidgetManager(graphics.GraphicsDevice, menuContents, levelContents, endScreenContents); widgetManager.AddSpriteFont(spriteFont); scoreManager = new ScoreManager(GraphicsDevice, Content); scoreManager.InfoLoader = gameInfoLoader; camera = new Camera(); camera.AspectRatio = (float)graphics.GraphicsDevice.Viewport.Width / graphics.GraphicsDevice.Viewport.Height; debug = new DebugDraw(GraphicsDevice); //Craete scenes gameMenu = new Menu(this); gameWorld = new World(this, gameInfoLoader, levelContents, collisionManager, powerUpManager, backgroundManager, projectileManager, enemyProjectileManager, enemyManager, scoreManager, camera ); endScreen = new EndScreen(this); widgetManager.SetSpriteBatch(spriteBatch); widgetManager.SetPlayer(gameWorld.Player); widgetManager.SetScoreManager(scoreManager); //Create scene manager with scenes sceneManager = new SceneManager(gameMenu, gameWorld, endScreen); sceneManager.Start(); }