1 using System.Collections.Generic;
3 using FBClient.Sprites;
4 using Microsoft.Xna.Framework;
5 using Microsoft.Xna.Framework.Graphics;
7 namespace FBClient.Core.Entities
14 private bool _isAlive;
19 #region Property Region
23 #region Constructor Region
28 _lookDirection = initialLookDirection;
33 #region XNA Method Region
37 const int animationFramesPerSecond = 10;
38 var animations =
new Dictionary<AnimationKey, Animation>();
40 var animation =
new Animation(1, 32, 32, 0, 0, animationFramesPerSecond);
41 animations.Add(AnimationKey.Down, animation);
43 animation =
new Animation(1, 32, 32, 0, 32, animationFramesPerSecond);
44 animations.Add(AnimationKey.Left, animation);
46 animation =
new Animation(1, 32, 32, 0, 64, animationFramesPerSecond);
47 animations.Add(AnimationKey.Right, animation);
49 animation =
new Animation(1, 32, 32, 0, 96, animationFramesPerSecond);
50 animations.Add(AnimationKey.Up, animation);
52 var spriteTexture = FinalBomber.Instance.Content.Load<Texture2D>(
"Graphics/Characters/arrow");
57 CurrentAnimation = LookDirectionToAnimationKey(_lookDirection)
61 public void Update(GameTime gameTime)
63 Sprite.Update(gameTime);
66 public void Draw(GameTime gameTime)
68 Sprite.Draw(gameTime, FinalBomber.Instance.SpriteBatch, Position);
73 #region Private Method Region
77 var animationKey = AnimationKey.Up;
78 switch (lookDirection)
80 case LookDirection.Up:
81 animationKey = AnimationKey.Up;
83 case LookDirection.Down:
84 animationKey = AnimationKey.Down;
86 case LookDirection.Right:
87 animationKey = AnimationKey.Right;
89 case LookDirection.Left:
90 animationKey = AnimationKey.Left;
98 #region Public Method Region
102 Point nextPosition = bomb.CellPosition;
103 switch (_lookDirection)
105 case LookDirection.Up:
108 case LookDirection.Down:
111 case LookDirection.Left:
114 case LookDirection.Right:
122 CollisionLayer[nextPosition.X, nextPosition.Y])
124 bomb.ChangeDirection(_lookDirection, -1);
132 #region Override Method Region
void Update(GameTime gameTime)
Arrow(Point position, LookDirection initialLookDirection)
void ChangeDirection(Bomb bomb)
static FinalBomber Instance
void Draw(GameTime gameTime)
readonly GamePlayScreen GamePlayScreen