public override void Display(Canvas canvas) { Logging.Instance.Write("Player decorator: Displaying Double jump animation", LoggingLevel.Pattern); var doubleJumpAnimation = canvas.Children.OfType <GifImage>().FirstOrDefault(x => x.VisualType == VisualElementType.DoubleJump); if (doubleJumpAnimation == null) { doubleJumpAnimation = new GifImage { VisualType = VisualElementType.DoubleJump, GifSource = ResourcesUriHandler.GetPlayerPowerUp(VisualElementType.DoubleJump), Stretch = Stretch.Fill }; canvas.Children.Add(doubleJumpAnimation); } base.Display(canvas); }
public override void Display(Canvas canvas) { Logging.Instance.Write("Player decorator: Displaying Invulnerability animation", LoggingLevel.Pattern); var playerInvincibilityAnimation = canvas.Children.OfType <GifImage>().FirstOrDefault(x => x.VisualType == VisualElementType.Invulnerability); if (playerInvincibilityAnimation == null) { playerInvincibilityAnimation = new GifImage { VisualType = VisualElementType.Invulnerability, GifSource = ResourcesUriHandler.GetPlayerPowerUp(VisualElementType.Invulnerability), Stretch = Stretch.Fill }; canvas.Children.Add(playerInvincibilityAnimation); } base.Display(canvas); }