Exemplo n.º 1
0
 private SpinningMissle(Spell castedSpell,
     Vector2D position,
     Vector2D direction,
     TimeSpan timeCasted)
     : base(castedSpell, position,
     direction, timeCasted)
 {
     _spinningMissleState = SpinningMissleState.None;
 }
Exemplo n.º 2
0
        public override void UpdatePosition()
        {
            base.UpdatePosition();

            var wasNone = _spinningMissleState == SpinningMissleState.None;
            _spinningMissleState = _spinningMissleState.GetNextMissleState();

            if(!wasNone)
                Position -= GetPreviousSpinningDirection();
            Position += GetNextSpinningDirection();
        }
Exemplo n.º 3
0
 private Vector2D GetNextSpinningDirection(SpinningMissleState state)
 {
     switch (state)
     {
         case SpinningMissleState.Top:
             return new Vector2D(0, 1);
         case SpinningMissleState.Right:
             return new Vector2D(1, 0);
         case SpinningMissleState.Bottom:
             return new Vector2D(0, -1);
         case SpinningMissleState.Left:
             return new Vector2D(-1, 0);
         case SpinningMissleState.None:
             return new Vector2D(0, 0);
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Exemplo n.º 4
0
 public SpinningMissle(Missle copyMissle)
     : base(copyMissle)
 {
     _spinningMissleState = SpinningMissleState.None;
 }