/// <summary> /// Create all the game components. /// </summary> private void CreateGameComponents() { ScoreBar scoreBar = new ScoreBar(ScreenManager.Game, 0, 100, new Vector2(8, 65), 10, 70, Color.Blue, ScoreBar.ScoreBarOrientation.Horizontal, 0, this, true); ScreenManager.Game.Components.Add(scoreBar); // Create the honey jar jar = new HoneyJar(ScreenManager.Game, this, new Vector2(20, 8), scoreBar); ScreenManager.Game.Components.Add(jar); // Create all the beehives and the bees CreateBeehives(); // Create the smoke gun's score bar int totalSmokeAmount = ConfigurationManager.ModesConfiguration[gameDifficultyLevel].TotalSmokeAmount; Vector2 smokeButtonPosition = new Vector2(664, 346) + new Vector2(22, smokeButton.Height - 8); smokeButtonScorebar = new ScoreBar(ScreenManager.Game, 0, totalSmokeAmount, smokeButtonPosition, 12, 70, Color.White, ScoreBar.ScoreBarOrientation.Horizontal, totalSmokeAmount, this, false); ScreenManager.Game.Components.Add(smokeButtonScorebar); // Creates the BeeKeeper beeKeeper = new BeeKeeper(ScreenManager.Game, this); beeKeeper.AnimationDefinitions = animations; beeKeeper.ThumbStickArea = new Rectangle((int)controlstickBoundaryPosition.X, (int)controlstickBoundaryPosition.Y, controlstickBoundary.Width, controlstickBoundary.Height); ScreenManager.Game.Components.Add(beeKeeper); // Create the vat's score bar scoreBar = new ScoreBar(ScreenManager.Game, 0, 300, new Vector2(306, 440), 10, 190, Color.White, ScoreBar.ScoreBarOrientation.Horizontal, 0, this, true); ScreenManager.Game.Components.Add(scoreBar); // Create the vat vat = new Vat(ScreenManager.Game, this, ScreenManager.Game.Content.Load <Texture2D>("Textures/vat"), new Vector2(294, 355), scoreBar); ScreenManager.Game.Components.Add(vat); scoreBar.DrawOrder = vat.DrawOrder + 1; }
/// <summary> /// Create all the game components. /// </summary> private void CreateGameComponents() { Vector2 scaleVector = ScreenManager.SpriteBatch.ScaleVector; Rectangle safeArea = SafeArea; Texture2D jarTexture = ScreenManager.Game.Content.Load<Texture2D>("Textures/honeyJar"); Vector2 honeyJarLocation = safeArea.GetVector() + new Vector2(UIConstants.HoneyJarLeftMargin, UIConstants.HoneyJarTopMargin); Vector2 jarBarLocation = honeyJarLocation + new Vector2(0, jarTexture.Height * scaleVector.Y + 7); ScoreBar scoreBar = new ScoreBar(ScreenManager.Game, 0, 100, jarBarLocation, (int)(jarTexture.Height / 6 * scaleVector.Y), (int)(jarTexture.Width * scaleVector.X), Color.Blue, ScoreBar.ScoreBarOrientation.Horizontal, 0, this, true); ScreenManager.Game.Components.Add(scoreBar); // Create the honey jar jar = new HoneyJar(ScreenManager.Game, this, honeyJarLocation, scoreBar); ScreenManager.Game.Components.Add(jar); // Create all the beehives and the bees CreateBeehives(safeArea, jar); // We only initialize the smoke button position here since we need access // to the screen manager in order to do so (and it is null in the // constructor) smokeButtonPosition = new Vector2(safeArea.Right - UIConstants.SmokeButtonRightAbsoluteMargin, safeArea.Bottom - UIConstants.SmokeButtonBottomAbsoluteMargin); // Create the smoke gun's score bar int totalSmokeAmount = ConfigurationManager.ModesConfiguration[gameDifficultyLevel].TotalSmokeAmount; Vector2 smokeBarLocation = smokeButtonPosition + new Vector2(UIConstants.SmokeButtonSize * scaleVector.X / 8, UIConstants.SmokeButtonSize * scaleVector.Y); smokeButtonScorebar = new ScoreBar(ScreenManager.Game, 0, totalSmokeAmount, smokeBarLocation, (int)(UIConstants.SmokeButtonSize * scaleVector.X / 10), (int)(UIConstants.SmokeButtonSize * scaleVector.Y * 3 / 4), Color.White, ScoreBar.ScoreBarOrientation.Horizontal, totalSmokeAmount, this, false); smokeTextLocation = smokeButtonPosition + new Vector2( UIConstants.SmokeButtonSize * scaleVector.X / 2 - font16px.MeasureString(SmokeText).X * scaleVector.X / 2, UIConstants.SmokeButtonSize * scaleVector.Y * 11 / 10); ScreenManager.Game.Components.Add(smokeButtonScorebar); // Creates the BeeKeeper beeKeeper = new BeeKeeper(ScreenManager.Game, this); beeKeeper.AnimationDefinitions = animations; beeKeeper.ThumbStickArea = new Rectangle((int)controlstickBoundaryPosition.X, (int)controlstickBoundaryPosition.Y, controlstickBoundary.Width, controlstickBoundary.Height); ScreenManager.Game.Components.Add(beeKeeper); // Creates the vat Texture2D vatTexture = ScreenManager.Game.Content.Load<Texture2D>("Textures/vat"); Vector2 vatLocation = new Vector2(safeArea.Center.X - vatTexture.Width * scaleVector.X / 2, safeArea.Bottom - vatTexture.Height * scaleVector.Y - UIConstants.VatBottomMargin); Vector2 vatScorebarLocation = vatLocation + new Vector2((vatTexture.Width * scaleVector.X - UIConstants.VatScorebarWidth) / 2, vatTexture.Height * scaleVector.Y * 7 / 10); scoreBar = new ScoreBar(ScreenManager.Game, 0, 300, vatScorebarLocation, UIConstants.VatScorebarHeight, UIConstants.VatScorebarWidth, Color.White, ScoreBar.ScoreBarOrientation.Horizontal, 0, this, true); vat = new Vat(ScreenManager.Game, this, vatTexture, vatLocation, scoreBar); ScreenManager.Game.Components.Add(vat); vatArrowPosition = vatLocation + new Vector2(vatTexture.Width * scaleVector.X / 2 - arrowTexture.Width * scaleVector.X / 2, UIConstants.VatArrowOffset); ScreenManager.Game.Components.Add(scoreBar); scoreBar.DrawOrder = vat.DrawOrder + 1; }
/// <summary> /// Create all the game components. /// </summary> private void CreateGameComponents() { Vector2 scaleVector = ScreenManager.SpriteBatch.ScaleVector; Rectangle safeArea = SafeArea; Texture2D jarTexture = ScreenManager.Game.Content.Load <Texture2D>("Textures/honeyJar"); Vector2 honeyJarLocation = safeArea.GetVector() + new Vector2(UIConstants.HoneyJarLeftMargin, UIConstants.HoneyJarTopMargin); Vector2 jarBarLocation = honeyJarLocation + new Vector2(0, jarTexture.Height * scaleVector.Y + 7); ScoreBar scoreBar = new ScoreBar(ScreenManager.Game, 0, 100, jarBarLocation, (int)(jarTexture.Height / 6 * scaleVector.Y), (int)(jarTexture.Width * scaleVector.X), Color.Blue, ScoreBar.ScoreBarOrientation.Horizontal, 0, this, true); ScreenManager.Game.Components.Add(scoreBar); // Create the honey jar jar = new HoneyJar(ScreenManager.Game, this, honeyJarLocation, scoreBar); ScreenManager.Game.Components.Add(jar); // Create all the beehives and the bees CreateBeehives(safeArea, jar); // We only initialize the smoke button position here since we need access // to the screen manager in order to do so (and it is null in the // constructor) smokeButtonPosition = new Vector2(safeArea.Right - UIConstants.SmokeButtonRightAbsoluteMargin, safeArea.Bottom - UIConstants.SmokeButtonBottomAbsoluteMargin); // Create the smoke gun's score bar int totalSmokeAmount = ConfigurationManager.ModesConfiguration[gameDifficultyLevel].TotalSmokeAmount; Vector2 smokeBarLocation = smokeButtonPosition + new Vector2(UIConstants.SmokeButtonSize * scaleVector.X / 8, UIConstants.SmokeButtonSize * scaleVector.Y); smokeButtonScorebar = new ScoreBar(ScreenManager.Game, 0, totalSmokeAmount, smokeBarLocation, (int)(UIConstants.SmokeButtonSize * scaleVector.X / 10), (int)(UIConstants.SmokeButtonSize * scaleVector.Y * 3 / 4), Color.White, ScoreBar.ScoreBarOrientation.Horizontal, totalSmokeAmount, this, false); smokeTextLocation = smokeButtonPosition + new Vector2( UIConstants.SmokeButtonSize * scaleVector.X / 2 - font16px.MeasureString(SmokeText).X *scaleVector.X / 2, UIConstants.SmokeButtonSize * scaleVector.Y * 11 / 10); ScreenManager.Game.Components.Add(smokeButtonScorebar); // Creates the BeeKeeper beeKeeper = new BeeKeeper(ScreenManager.Game, this); beeKeeper.AnimationDefinitions = animations; beeKeeper.ThumbStickArea = new Rectangle((int)controlstickBoundaryPosition.X, (int)controlstickBoundaryPosition.Y, controlstickBoundary.Width, controlstickBoundary.Height); ScreenManager.Game.Components.Add(beeKeeper); // Creates the vat Texture2D vatTexture = ScreenManager.Game.Content.Load <Texture2D>("Textures/vat"); Vector2 vatLocation = new Vector2(safeArea.Center.X - vatTexture.Width * scaleVector.X / 2, safeArea.Bottom - vatTexture.Height * scaleVector.Y - UIConstants.VatBottomMargin); Vector2 vatScorebarLocation = vatLocation + new Vector2((vatTexture.Width * scaleVector.X - UIConstants.VatScorebarWidth) / 2, vatTexture.Height * scaleVector.Y * 7 / 10); scoreBar = new ScoreBar(ScreenManager.Game, 0, 300, vatScorebarLocation, UIConstants.VatScorebarHeight, UIConstants.VatScorebarWidth, Color.White, ScoreBar.ScoreBarOrientation.Horizontal, 0, this, true); vat = new Vat(ScreenManager.Game, this, vatTexture, vatLocation, scoreBar); ScreenManager.Game.Components.Add(vat); vatArrowPosition = vatLocation + new Vector2(vatTexture.Width * scaleVector.X / 2 - arrowTexture.Width * scaleVector.X / 2, UIConstants.VatArrowOffset); ScreenManager.Game.Components.Add(scoreBar); scoreBar.DrawOrder = vat.DrawOrder + 1; }