1 using System.Collections.Generic;
3 using FBLibrary.Core.BaseEntities;
4 using FBClient.Entities;
5 using FBClient.Screens;
6 using FBClient.Screens.GameScreens;
7 using FBClient.Sprites;
8 using Microsoft.Xna.Framework;
9 using Microsoft.Xna.Framework.Audio;
10 using Microsoft.Xna.Framework.Graphics;
12 namespace FBClient.Core.Entities
25 private SoundEffect _powerUpPickUpSound;
29 #region Constructor Region
45 private void Initialize()
47 var animations =
new Dictionary<AnimationKey, Animation>();
48 var animation =
new Animation(2, 32, 32, 0, Config.ItemTypeIndex[Type] * 32, 5);
50 var spriteTexture = FinalBomber.Instance.Content.Load<Texture2D>(
"Graphics/Characters/item");
51 Sprite =
new AnimatedSprite(spriteTexture, animation) { IsAnimating =
true };
53 var itemDestroyTexture = FinalBomber.Instance.Content.Load<Texture2D>(
"Graphics/Characters/itemDestroy");
54 animation =
new Animation(7, 31, 28, 0, 0, 8);
55 _itemDestroyAnimation =
new AnimatedSprite(itemDestroyTexture, animation)
61 _powerUpPickUpSound = FinalBomber.Instance.Content.Load<SoundEffect>(
"Audio/Sounds/item");
64 #region XNA Method Region
66 public void Update(GameTime gameTime)
68 Sprite.Update(gameTime);
72 _itemDestroyAnimation.Update(gameTime);
78 public void Draw(GameTime gameTime)
80 Sprite.Draw(gameTime, FinalBomber.Instance.SpriteBatch, Position);
82 if (_itemDestroyAnimation.IsAnimating)
83 _itemDestroyAnimation.Draw(gameTime, FinalBomber.Instance.SpriteBatch, Position);
92 _powerUpPickUpSound.Play();
99 if (!_itemDestroyAnimation.IsAnimating)
101 InDestruction =
true;
102 _itemDestroyAnimation.IsAnimating =
true;
PowerUp(Point cellPosition, PowerUpType type)
void Draw(GameTime gameTime)
void Update(GameTime gameTime)
PowerUp(Point cellPosition)