/// <summary> /// Creates a new instance. /// </summary> /// <param name="game">Associated game object.</param> /// <param name="gamePlayScreen">Gameplay screen where the component will be presented.</param> public TexturedDrawableGameComponent(Game game, GameplayScreen gamePlayScreen) : base(game) { this.gamePlayScreen = gamePlayScreen; scaledSpriteBatch = (ScaledSpriteBatch)game.Services.GetService(typeof(ScaledSpriteBatch)); }
/// <summary> /// Load the screen resources /// </summary> public override void LoadContent() { font = Load<SpriteFont>(@"Fonts\MenuFont"); // Create a new instance of the gameplay screen gameplayScreen = new GameplayScreen(DifficultyMode.Easy); gameplayScreen.ScreenManager = ScreenManager; }
/// <summary> /// Load screen resources /// </summary> public override void LoadContent() { if (difficultyMode.HasValue) { gameplayScreen = new GameplayScreen(difficultyMode.Value); gameplayScreen.ScreenManager = ScreenManager; } font36px = ScreenManager.Game.Content.Load<SpriteFont>("Fonts/GameScreenFont36px"); font16px = ScreenManager.Game.Content.Load<SpriteFont>("Fonts/GameScreenFont16px"); textSize = font36px.MeasureString(text); safeArea = SafeArea; base.LoadContent(); }
/// <summary> /// Creates a new score bar instance. /// </summary> /// <param name="game">The associated game object.</param> /// <param name="minValue">The score bar's minimal value.</param> /// <param name="maxValue">The score bar's maximal value.</param> /// <param name="position">The score bar's position.</param> /// <param name="height">The score bar's height.</param> /// <param name="width">The score bar's width.</param> /// <param name="scoreBarColor">Color to tint the scorebar's background with.</param> /// <param name="scoreBarOrientation">The score bar's orientation.</param> /// <param name="initialValue">The score bar's initial value.</param> /// <param name="screen">Gameplay screen where the score bar will appear.</param> /// <param name="isAppearAtCountDown">Whether or not the score bar will appear during the game's initial /// countdown phase.</param> public ScoreBar(Game game, int minValue, int maxValue, Vector2 position, int height, int width, Color scoreBarColor, ScoreBarOrientation scoreBarOrientation, int initialValue, GameplayScreen screen, bool isAppearAtCountDown) : base(game) { this.MinValue = minValue; this.MaxValue = maxValue; this.Position = position; this.ScoreBarColor = scoreBarColor; this.scoreBarOrientation = scoreBarOrientation; this.currentValue = initialValue; this.width = width; this.height = height; this.gameplayScreen = screen; this.isAppearAtCountDown = isAppearAtCountDown; spriteBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch)); GetSpaceFromBoarder(); }
/// <summary> /// Creates a new soldier bee instance. /// </summary> /// <param name="game">Associated game object.</param> /// <param name="gamePlayScreen">Gameplay screen where the bee will appear.</param> /// <param name="beehive">The bee's associated beehive.</param> public SoldierBee(Game game, GameplayScreen gamePlayScreen, Beehive beehive) : base(game, gamePlayScreen, beehive) { AnimationKey = "SoldierBee"; }
/// <summary> /// Creates a new worker bee instance. /// </summary> /// <param name="game">The associated game object.</param> /// <param name="gamePlayScreen">The gameplay screen where the bee is displayed</param> /// <param name="beehive">The bee's associated beehive.</param> public WorkerBee(Game game, GameplayScreen gamePlayScreen, Beehive beehive) : base(game, gamePlayScreen, beehive) { AnimationKey = "WorkerBee"; }
/// <summary> /// Creates a new beekeeper instance. /// </summary> /// <param name="game">The game object.</param> /// <param name="gamePlayScreen">The gameplay screen.</param> public BeeKeeper(Game game, GameplayScreen gamePlayScreen) : base(game, gamePlayScreen) { }
/// <summary> /// Creates a new puff of smoke. /// </summary> /// <param name="game">Associated game object.</param> /// <param name="gameplayScreen">The gameplay screen where the smoke puff will be displayed.</param> /// <param name="texture">The texture which represents the smoke puff.</param> public SmokePuff(Game game, GameplayScreen gameplayScreen, Texture2D texture) : base(game, gameplayScreen) { this.texture = texture; drawOrigin = new Vector2(texture.Width / 2, texture.Height / 2); DrawOrder = Int32.MaxValue - 15; }
/// <summary> /// Creates a new score bar instance. /// </summary> /// <param name="game">The associated game object.</param> /// <param name="minValue">The score bar's minimal value.</param> /// <param name="maxValue">The score bar's maximal value.</param> /// <param name="position">The score bar's position.</param> /// <param name="height">The score bar's height.</param> /// <param name="width">The score bar's width.</param> /// <param name="scoreBarColor">Color to tint the scorebar's background with.</param> /// <param name="scoreBarOrientation">The score bar's orientation.</param> /// <param name="initialValue">The score bar's initial value.</param> /// <param name="screen">Gameplay screen where the score bar will appear.</param> /// <param name="isAppearAtCountDown">Whether or not the score bar will appear during the game's initial /// countdown phase.</param> public ScoreBar(Game game, int minValue, int maxValue, Vector2 position, int height, int width, Color scoreBarColor, ScoreBarOrientation scoreBarOrientation, int initialValue, GameplayScreen screen, bool isAppearAtCountDown) : base(game) { this.MinValue = minValue; this.MaxValue = maxValue; this.Position = position; this.ScoreBarColor = scoreBarColor; this.scoreBarOrientation = scoreBarOrientation; this.currentValue = initialValue; this.width = width; this.height = height; this.gameplayScreen = screen; this.isAppearAtCountDown = isAppearAtCountDown; scaledSpriteBatch = (ScaledSpriteBatch)Game.Services.GetService(typeof(ScaledSpriteBatch)); GetSpaceFromBorder(); }
/// <summary> /// Creates a new bee instance. /// </summary> /// <param name="game">The game object.</param> /// <param name="gamePlayScreen">The gameplay screen.</param> /// <param name="beehive">The related beehive.</param> public Bee(Game game, GameplayScreen gamePlayScreen, Beehive beehive) : base(game, gamePlayScreen) { this.relatedBeehive = beehive; DrawOrder = Int32.MaxValue - 20; }
/// <summary> /// Creates a new beehive instance. /// </summary> /// <param name="game">The game object.</param> /// <param name="gamePlayScreen">The gameplay screen.</param> /// <param name="texture">The texture representing the beehive.</param> /// <param name="score">Score object representing the amount of honey in the /// hive.</param> /// <param name="position">The beehive's position.</param> public Beehive(Game game, GameplayScreen gamePlayScreen, Texture2D texture, ScoreBar score, Vector2 position) : base(game, gamePlayScreen) { this.texture = texture; this.score = score; this.position = position; AllowBeesToGenerate = true; DrawOrder = (int)position.Y; }
/// <summary> /// Creates a new instance of the component. /// </summary> /// <param name="game">The associated game object.</param> /// <param name="gamePlayScreen">The gameplay screen where the component will be rendered.</param> /// <param name="position">The position of the component.</param> /// <param name="score">Scorebar representing the amount of honey in the jar.</param> public HoneyJar(Game game, GameplayScreen gamePlayScreen, Vector2 position, ScoreBar score) : base(game, gamePlayScreen) { this.position = position; this.score = score; }
/// <summary> /// Creates a new vat instance. /// </summary> /// <param name="game">The associated game object.</param> /// <param name="gamePlayScreen">Gameplay screen where the vat will be displayed.</param> /// <param name="texture">The vat's texture.</param> /// <param name="position">The position of the vat.</param> /// <param name="score">An associated score bar.</param> public Vat(Game game, GameplayScreen gamePlayScreen, Texture2D texture, Vector2 position, ScoreBar score) : base(game, gamePlayScreen) { this.texture = texture; this.position = position; this.score = score; DrawOrder = (int)(position.Y + Bounds.Height); }
/// <summary> /// Creates a new worker bee instance. /// </summary> /// <param name="game">The associated game object.</param> /// <param name="gamePlayScreen">The gameplay screen where the bee is displayed</param> /// <param name="block">The bee's associated Block.</param> public WorkerBombBase(Game game,GameplayScreen gamePlayScreen, Block block) : base(game,gamePlayScreen,block) { AnimationKey = "WorkerBee"; }