Esempio n. 1
0
        /// <summary>Обновляем состояние выполняющейся магии</summary>
        private void UpdateExecuted()
        {
            bool IsEnd = false;

            //Если начало и конец одинаковые, то выполняем магию в текущей ячейке
            if (_FromCell == _ToCell)
            {
                _CurrentRectangle = new Rectangle(_ToCell.Rect.X + _ToCell.Rect.Width / 2 - _Width / 2, _ToCell.Rect.Y + _ToCell.Rect.Height / 2 - _Height / 2, _Width, _Height);
                if (_UpdateDelay != 0)
                {
                    _UpdateDelay--;
                    return;
                }
                _Sprite.UpdateInRange(From, To);
                _UpdateDelay = 5;
                IsEnd        = (_Sprite.CurrentFrame == To);
            }
            else
            {
                if (_CurrentRectangle == null || _CurrentRectangle == new Rectangle(0, 0, 0, 0))
                {
                    _CurrentRectangle = new Rectangle(_FromCell.Rect.X + _FromCell.Rect.Width / 2 - _Width / 2, _FromCell.Rect.Y + _FromCell.Rect.Height / 2 - _Height / 2, _Width, _Height);
                    _Movement.Move(_FromCell, _ToCell, _CurrentRectangle);
                }
                _Movement.Update();
                _CurrentRectangle = _Movement.CurrentState;
                IsEnd             = _Movement.IsEnd;
            }


            if (IsEnd)
            {
                _Executed            = false;
                Finished             = true;
                _Sprite.CurrentFrame = Static;
                _Reload           = Convert.ToInt32(_Node.SelectSingleNode("Reload").InnerText) * 100;
                Selected          = false;
                _CurrentRectangle = new Rectangle(0, 0, 0, 0);
            }
        }
Esempio n. 2
0
 public void MoveTo(Cell to)
 {
     _Movement.Move(_CurrentCell, to, _CurrentState);
 }