/// <summary> /// Constructs a PulseEffect object /// </summary> /// <param name="parms">ColourLerpEffectParms object used to build the effect</param> public ColourLerpEffect(ColourLerpEffectParams parms) : base(parms) { this.LerpDownTo = parms.LerpDownTo; this.LerpUpTo = parms.LerpUpTo; this.LerpBy = parms.LerpBy; }
public HUD(ContentManager content) { SpriteFont font = LoadingUtils.load <SpriteFont>(content, "SpriteFont1"); Text2DParams parms = new Text2DParams(); parms.Font = font; parms.LightColour = Color.Red; parms.Position = new Vector2(Constants.RESOLUTION_X / 3, 450f); parms.WrittenText = TEXT_RESTART; this.statusText = new Text2D(parms); ColourLerpEffectParams effectParms = new ColourLerpEffectParams { LerpBy = 5f, LerpDownTo = Color.White, LerpUpTo = Color.Red }; int size = 1; if (StateManager.getInstance().GameMode == GameMode.TwoPlayer) { size = 2; } this.scoreTexts = new Text2D[size]; this.winnerTexts = new Text2D[size]; parms.Position = new Vector2(RIGHT_X, SCORES_Y); parms.WrittenText = TEXT_SCORE + getScore(0); this.scoreTexts[0] = new Text2D(parms); this.scoreTexts[0].addEffect(new ColourLerpEffect(effectParms)); parms.Position = new Vector2(RIGHT_X + WINNER_X_PADDING, SCORES_Y + WINNER_Y_OFFSET); parms.WrittenText = TEXT_WINNER; this.winnerTexts[0] = new Text2D(parms); this.winnerTexts[0].addEffect(new ColourLerpEffect(effectParms)); if (StateManager.getInstance().GameMode == GameMode.TwoPlayer) { parms.Position = new Vector2(LEFT_X, SCORES_Y); parms.WrittenText = TEXT_SCORE + getScore(1); this.scoreTexts[1] = new Text2D(parms); this.scoreTexts[1].addEffect(new ColourLerpEffect(effectParms)); parms.Position = new Vector2(LEFT_X + WINNER_X_PADDING, SCORES_Y + WINNER_Y_OFFSET); parms.WrittenText = TEXT_WINNER; this.winnerTexts[1] = new Text2D(parms); this.winnerTexts[1].addEffect(new ColourLerpEffect(effectParms)); } this.countDownImages = new StaticDrawable2D[3]; StaticDrawable2DParams countDownParms = new StaticDrawable2DParams { Position = new Vector2(Constants.RESOLUTION_X / 2, Constants.RESOLUTION_Y / 2), Origin = new Vector2(256f), }; for (int i = 0; i < this.countDownImages.Length; i++) { countDownParms.Texture = LoadingUtils.load <Texture2D>(content, (i + 1).ToString()); this.countDownImages[i] = new StaticDrawable2D(countDownParms); } StaticDrawable2DParams gameOverParms = new StaticDrawable2DParams { Position = new Vector2(Constants.RESOLUTION_X / 2, Constants.RESOLUTION_Y / 2), Origin = new Vector2(512f), Texture = LoadingUtils.load <Texture2D>(content, "GameOver") }; this.gameOver = new StaticDrawable2D(gameOverParms); scaleOverTimeEffectParms = new ScaleOverTimeEffectParams { ScaleBy = new Vector2(-1f) }; this.soundEffect = LoadingUtils.load <SoundEffect>(content, "ShortBeep"); this.index = 2; this.activeCountdownItem = this.countDownImages[this.index]; this.activeCountdownItem.addEffect(new ScaleOverTimeEffect(scaleOverTimeEffectParms)); this.elapsedTime = 0f; SoundManager.getInstance().SFXEngine.playSoundEffect(this.soundEffect); }