예제 #1
0
 private void TryDirectionRight(Cell cell)
 {
     if (cell.GetBoundingRect().Left > this.GetBoundingRect().Left)
     {
         _direction = Direction.Right;
     }
 }
예제 #2
0
 private void TryDirectionLeft(Cell cell)
 {
     if (cell.GetBoundingRect().Left < this.GetBoundingRect().Left)
     {
         _direction = Direction.Left;
     }
 }
예제 #3
0
 private void TryDirectionDown(Cell cell)
 {
     if (cell.GetBoundingRect().Top > this.GetBoundingRect().Top)
     {
         _direction = Direction.Down;
     }
 }
예제 #4
0
 private void TryDirectionUp(Cell cell)
 {
     if (cell.GetBoundingRect().Top < this.GetBoundingRect().Top)
     {
         _direction = Direction.Up;
     }
 }
예제 #5
0
        private bool MoveTo(Cell cell)
        {
            #region Validation

            if (cell == null)
            {
                throw new ArgumentNullException();
            }

            #endregion

            TrySlowerSpeed();
            UpdateDirection(cell);

            if (GetBoundingRect() != cell.GetBoundingRect())
            {
                // Review IM : base.Move()
                this.Move();
                return(false);
            }
            else
            {
                _direction = Direction.None;
                _speed     = _fullSpeed;
                return(true);
            }
        }
예제 #6
0
 private bool IsAtStart()
 {
     return(CurrentCell().GetBoundingRect() == _startCell.GetBoundingRect());
 }
예제 #7
0
 private bool IsInCell(Cell cell)
 {
     return(GetBoundingRect() == cell.GetBoundingRect());
 }