public void RemoveToUpdate(ITextSprite textSprite) { if (ToUpdate.Contains(textSprite)) { ToUpdate.Remove(textSprite); } }
public TextSpriteHorizontalScrolling(float frequency, float duration, ITextSprite textSprite, bool isSeesaw = false) { _timeSinceLast = 0; var nbCharDisplayed = 13; Duration = duration; ElapsedLifeTime = 0; Frequency = frequency; Name = "TextSpriteHorizontalScrolling"; AffectedTextSprite = textSprite; AnimationTexts = new List <string>(); textSprite.CurrentAnimation = Name; BaseObject = textSprite; string txt = textSprite.Text; AnimationTexts.Add(txt); for (int i = 0; i < textSprite.Text.Length; i++) { char temp = txt[0]; txt = txt.Remove(0, 1); txt = txt.Insert(txt.Length, temp.ToString()); string test = ""; for (int j = 0; j < nbCharDisplayed; j++) { test = test.Insert(j, txt[j].ToString()); } AnimationTexts.Add(test); } IsSeesaw = isSeesaw; Increase = true; textSprite.Animation = this; }
public void InitializeTextSprite(ITextSprite textSprite) { textSprite.Origin = Vector2.One; SpriteFont spriteFont; _spriteFonts.TryGetValue(textSprite.FontName, out spriteFont); }
public CompetitiveEndingDisplayPanel() { backgroundSprite = BackgroundSpriteFactory.Instance.CreateBlackBackgroundSprite(); gameOverTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); gameOverTextSprite.Text = ""; count = maxCount; }
public GameOverDisplayPanel() { backgroundSprite = BackgroundSpriteFactory.Instance.CreateBlackBackgroundSprite(); gameOverTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); gameOverTextSprite.Text = "GAME OVER"; count = maxCount; }
public void RemoveTextSprite(ITextSprite toRemove) { if (_toDraw.Contains(toRemove)) { _toDraw.Remove(toRemove); } }
public ScoreTextAnimation(Vector2 location, string score) { this.textSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); this.textSprite.Text = score; this.State = AnimationState.NotStart; this.endLocationY = location.Y - EndYOffset * GameUtilities.SinglePixel; this.location = location; }
public GameOverDisplay() { lifeTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); backgroundSprite = BackgroundFactory.Instance.GetBackgroundObject("BlackGround", new Vector2(SpriteUtil.Zero, SpriteUtil.Zero)); lifeTextSprite.Text = "Game Over"; count = TimerUtil.Zero; SoundManager.StopSong(); Timer.StopTimer(); }
/*-------------*/ /* CONSTRUCTOR */ /*-------------*/ public TextSpriteFlashingEffectOverTime(int frequency, ITextSprite textTextSprite, float duration = 5) { Duration = duration; ElapsedLifeTime = 0; _frequency = frequency; AffectedDrawable = textTextSprite; textTextSprite.Effects.Add(this); BaseObject = new TextSprite(textTextSprite.ScreenPosition, textTextSprite.Text); }
public TitleDisplayPanel() { this.titleImgSprite = BackgroundSpriteFactory.Instance.CreateTitleImgSprite(); instructionTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); instructionTextSprite.Text = adventureText; highestScoreTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); highestScoreTextSprite.Text = "Top Score - " + fixText(GameUtilities.EmptyString + MarioAttributes.HighestScore, scoreLength); castTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); castTextSprite.Text = "SPRING \'17 3902 TEAM 5 - ALL RIGHTS RESERVED"; }
public CompetitivePreparingDisplayPanel() { backgroundSprite = BackgroundSpriteFactory.Instance.CreateBlackBackgroundSprite(); marioSprite = MarioSpriteFactory.Instance.CreateIdleRightSmallMarioSprite(); mario2Sprite = MarioSpriteFactory.Instance.CreateIdleLeftSmallMarioSprite(); worldTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); multiTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); multiTextSprite.Text = "READY"; count = maxCount; }
public PoleScoreTextAnimation(Rectangle marioDestination, Rectangle poleDestination, string score) { this.textSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); this.textSprite.Text = score; this.State = AnimationState.NotStart; this.endLocationY = marioDestination.Y; float startingLocationY = poleDestination.Y + poleDestination.Height - textSprite.MakeDestinationRectangle(new Vector2(GameUtilities.Origin)).Height; this.location = new Vector2(marioDestination.X + marioDestination.Width + locationXFix, startingLocationY); }
public void UpdateAnimation(ITextSprite textSprite, GameTime gameTime) { if (textSprite.CurrentAnimation != null) { textSprite.Animation.Affect(gameTime); if (textSprite.Animation.ElapsedLifeTime >= textSprite.Animation.Duration) { textSprite.Animation.Reset(); } } }
public void Draw(SpriteBatch spriteBatch, ITextSprite textSprite) { SpriteFont spriteFont; _spriteFonts.TryGetValue(textSprite.FontName, out spriteFont); if (spriteFont == null) { throw new Exception("SpriteFont not found in the dictionary"); } spriteBatch.DrawString(spriteFont, textSprite.Text, textSprite.Position, textSprite.Color, textSprite.Rotation, textSprite.Origin, textSprite.Scale, textSprite.SpriteEffect, textSprite.Depth); }
public MarioLifeDisplayPanel() { backgroundSprite = BackgroundSpriteFactory.Instance.CreateBlackBackgroundSprite(); marioSprite = MarioSpriteFactory.Instance.CreateIdleRightSmallMarioSprite(); worldTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); worldTextSprite.Text = "WORLD 1-1"; multiTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); multiTextSprite.Text = "*"; lifeTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); lifeTextSprite.Text = "" + MarioAttributes.MarioLife[GameUtilities.Player1]; count = maxCount; }
public void UpdateEffect(ITextSprite textSprite, GameTime gameTime) { if (textSprite.Effects.Count != 0) { foreach (IDrawableEffectOverTime textSpriteEffect in textSprite.Effects) { if (textSpriteEffect.ElapsedLifeTime >= textSpriteEffect.Duration) { _effectsToRemove.Add(textSpriteEffect); } textSpriteEffect.Affect(gameTime); } } }
public void Reset() { ITextSprite textSprite = (ITextSprite)BaseObject; if (textSprite == null) { throw new InvalidCastException("ERROR : CAST FROM OBJECT TO IDRAWABLE FAILED"); } AffectedTextSprite.Opacity = textSprite.Opacity; AffectedTextSprite.Rotation = textSprite.Rotation; AffectedTextSprite.Scale = textSprite.Scale; AffectedTextSprite.CurrentFrame = textSprite.CurrentFrame; AffectedTextSprite.CurrentAnimation = textSprite.CurrentAnimation; AffectedTextSprite.Text = textSprite.Text; }
private void CreateText() { creditsFont = Content.Load <SpriteFont>("Credits"); creditsColor = Color.AntiqueWhite; creditsText = new SimpleText("Credits", new Vector2(400, 400), creditsColor, creditsFont, true); nameText = new SimpleText("Made by: Austin Rogers.1274", new Vector2(400, 420), creditsColor, creditsFont, true); string sourceString = "Sprites from: https://www.spriters-resource.com/nes/legendofzelda/sheet/8366/"; sourceText = new SimpleText(sourceString, new Vector2(400, 440), creditsColor, creditsFont, true); texts = new List <ITextSprite> { creditsText, nameText, sourceText }; }
public HeadsUpDisplayBoard() { marioTitleTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); marioTitleTextSprite.Text = "MARIO"; scoreTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); scoreTextSprite.Text = fixText("" + 0, HUDUtil.scoreLength); coinTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); coinTextSprite.Text = "*" + fixText("" + 0, HUDUtil.coinLength); worldTitleTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); worldTitleTextSprite.Text = "WORLD"; worldTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); worldTextSprite.Text = fixText("1 - " + LevelCounter.Instance.Level, HUDUtil.levelLength); timeTitleTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); timeTitleTextSprite.Text = "TIME"; timeTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); timeTextSprite.Text = fixText("" + Timer.Time, HUDUtil.timeLength); }
public LifeDisplay() { lifeTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); if (GameObjectManager.Instance.LifeDisplayTrigger) { lifeTextSprite.Text = " X "; lifeTextSprite.Text += LifeCounter.Instance.LifeRemains().ToString(); } else { lifeTextSprite.Text = " L o a d i n g "; } counter = SpriteUtil.Zero; backgroundObject = BackgroundFactory.Instance.GetBackgroundObject("BlackGround", new Vector2(SpriteUtil.Zero, SpriteUtil.Zero)); marioSprite = SpriteFactory.Instance.CreateSprite(MarioFactory.Instance.GetSpriteDictionary[typeof(NormalMarioPowerupState)][typeof(RightIdleMarioMovementState)]); }
public HeadsUpDisplayPanel() { marioTitleTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); marioTitleTextSprite.Text = HUDUtilities.Mario; scoreTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); scoreTextSprite.Text = fixText(GameUtilities.EmptyString + ScoringSystem.Player1Score.Score, scoreLength); coinSprite = ItemSpriteFactory.Instance.CreateCoinSprite(); coinTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); coinTextSprite.Text = HUDUtilities.MultiplicationSign + fixText(GameUtilities.EmptyString + CoinSystem.Instance.Coins, coinLength); worldTitleTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); worldTitleTextSprite.Text = HUDUtilities.World; worldTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); worldTextSprite.Text = HUDUtilities.Level; timeTitleTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); timeTitleTextSprite.Text = HUDUtilities.Time; timeTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); timeTextSprite.Text = fixText(GameUtilities.EmptyString + MarioAttributes.Time, timeLength); }
public void AddDrawable(IDrawable drawable) { ISprite sprite = drawable as ISprite; if (sprite != null) { SpriteDrawer.AddSprite(sprite); SpriteUpdater.AddToUpdate(sprite); } ITextSprite textSprite = drawable as ITextSprite; if (textSprite != null) { TextSpriteDrawer.AddTextSprite(textSprite); TextSpriteUpdater.AddToUpdate(textSprite); } }
public CompetitiveHeadsUpDisplayPanel() { marioTitleTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); marioTitleTextSprite.Text = "PLAYER1"; scoreTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); scoreTextSprite.Text = fixText("" + ScoringSystem.Player1Score.Score, scoreLength); mario2TitleTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); mario2TitleTextSprite.Text = "PLAYER2"; score2TextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); score2TextSprite.Text = fixText("" + ScoringSystem.Player2Score.Score, scoreLength); worldTitleTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); worldTitleTextSprite.Text = "WORLD"; worldTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); worldTextSprite.Text = "1-1"; timeTitleTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); timeTitleTextSprite.Text = "TIME"; timeTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); timeTextSprite.Text = fixText("" + MarioAttributes.Time, timeLength); }
public ScoreManager() { turnColor = ChessPieceType.Color.White; backRoundSprite = SpriteFactory.Instance.MakeScoreManagerBackRoundSprite(); turnText = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); turnText.Text = "White's turn"; blackScoreText = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); blackScoreText.Text = "Black's Score: 0"; whiteScoreText = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); whiteScoreText.Text = "Whites's Score: 0"; boardFlipText = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); boardFlipText.Text = "Flip Board"; leftArrow = new ArrowButton(ChessPieceType.Direction.Left, new Vector2(8 * Utilities.PieceWidth, 4 * Utilities.PieceHeight)); rightArrow = new ArrowButton(ChessPieceType.Direction.Right, new Vector2(8 * Utilities.PieceWidth + Utilities.PieceWidth, 4 * Utilities.PieceHeight)); clickDisabled = false; buttonList = new int[2][]; for (int i = 0; i < 2; i++) { buttonList[i] = new int[8]; } for (int i = 0; i < 2; i++) { for (int j = 0; j < 8; j++) { if (i == 0) { buttonList[i][j] = 2 * j; } else { buttonList[i][j] = 2 * j + 1; } } } }
public TestTextSpritesAnimation() { _textSprite = new TextSprite(new Point(100, 100), "Hello world - "); _textSprite2 = new TextSprite(new Point(100, 200), "Hello world - "); }
public void AddToUpdate(ITextSprite textSprite) { ToUpdate.Add(textSprite); }
public TestTextSpritesEffects() { _textSprite = new TextSprite(new Point(100, 100), "Hello world"); }
public PlayerNameDisplayPanel() { playerNameTextSprite = TextSpriteFactory.Instance.CreateNormalFontTextSpriteSprite(); playerNameTextSprite.Text = ""; }
/*------------*/ /* METHODS */ /*------------*/ public void AddTextSprite(ITextSprite toAdd) { _toDraw.Add(toAdd); }