public ScreenManager(Game game = null, Bubble player = null) : base(game) { this.game = game; this.player = player; this.texManager = ((Spectrum)game).getTexManager(); lifeTexture = texManager.getUITexture(SpectrumEnums.icons.life); splashScreenTexture = texManager.getSplashScreen(SpectrumEnums.splashScreen.start); }
//############ General ############// public MovementAndInputHandler(Game game, Bubble player) { this.player = player; currentKeyState = Keyboard.GetState(); this.soundManager = ((Spectrum)game).soundManager; this.startDirection = Vector3.Backward; startDirection.Normalize(); currentDirection = startDirection; currentUp = Vector3.Up; currentOrientation = SpectrumEnums.Orientation.posY; jumping = false; }
public void loadLevel(SpectrumEnums.Levels level) { currentLevel = level; Spectrum.lastPlayedLevel = level; models.Add(new SkySphere(skySphereModel, game, ((Spectrum)Game).camera, this)); ((Spectrum)game).getCurrentActFromCurrentLevel(); levelCreator.loadLevel(currentLevel); mapResolution = levelCreator.getCurrentMapResolution(); ((Spectrum)game).getCurrentActFromCurrentLevel(); ((Spectrum)game).soundManager.playMusic(); Vector3 startPosition = levelCreator.getStartPosition(); Vector3 startDirection = Vector3.Zero; Vector3 startUp = Vector3.Zero; enemies = levelCreator.getEnemies(); countLevelInk(); Vector3 dim = levelCreator.getCurrentMapResolution(); OctTree octree = new OctTree(-2, -2, -2, (dim.Z * 2) + 2, (dim.Y * 2) + 2, (dim.X * 2) + 2); foreach(BasicCube cube in worldMap) { octree.Insert(cube); } foreach (Googoo enemy in enemies) { enemy.setAStar(worldMap, mapResolution); enemy.setOctTree(octree); enemy.InitializePathfinding(); } player = new Bubble(bubbleModel, game, ((Spectrum)Game).camera, octree, startPosition, startDirection, startUp, worldMap, screenManager); player.setLives(levelCreator.getLivesInLevel()); models.Add(player); }
//================== Music Settings Bars =====================// public PopUp(Game game, ScreenManager screenManager, Bubble player, SpectrumEnums.popUpId style = SpectrumEnums.popUpId.custom, string headline = "", string text = "") { this.position = new Vector2(game.Window.ClientBounds.Width / 2f, game.Window.ClientBounds.Height / 2f); this.game = game; this.texManager = ((Spectrum)game).texManager; this.screenManager = screenManager; this.player = player; this.headlineFont = screenManager.modelManager.getHeadlineFont(); this.textFont = screenManager.modelManager.getTextFont(); this.buttonHandler = screenManager.modelManager.buttonHandler; popUpTexture = texManager.getUITexture(style); currentStyle = style; switch (style) { case SpectrumEnums.popUpId.custom: this.headline = headline; this.text = text; break; case SpectrumEnums.popUpId.win: this.headline = "Congratulations!"; this.text = "You beat the level! \n You can go on with the next level \nor play again."; break; case SpectrumEnums.popUpId.lose: this.headline = "Game over"; this.text = "You lose, try again!"; break; } origin = new Vector2(popUpTexture.Width / 2f, popUpTexture.Height / 2f); center = new Vector2(position.X + recPosition.Width / 2f, position.Y + recPosition.Height / 2f); recPosition = new Rectangle((int)position.X - (int)origin.X, (int)position.Y - (int)origin.Y, popUpTexture.Width, popUpTexture.Height); setButtons(); }
/* * Sets the player; */ public void setPlayer(Bubble player) { this.player = player; }