public void UpdateIfCurrentMazeEleIsGreater(Direction updatedProcessDirection)
    {
        switch (updatedProcessDirection)
        {
        case Direction.Left:
        {
            if (CurrentFarthestMazeElementIndex.x > MouseBoundary.GetCurrentMouseOnMazeElementIndex().x)
            {
                SetNewFarthestMazeEleOnHorizontalLineOfLastClickMazeEle();
            }
            break;
        }

        case Direction.Right:
        {
            if (CurrentFarthestMazeElementIndex.x < MouseBoundary.GetCurrentMouseOnMazeElementIndex().x)
            {
                SetNewFarthestMazeEleOnHorizontalLineOfLastClickMazeEle();
            }
            break;
        }

        case Direction.Up:
        {
            if (CurrentFarthestMazeElementIndex.y > MouseBoundary.GetCurrentMouseOnMazeElementIndex().y)
            {
                SetNewFarthestMazeEleOnVerticalLineOfLastClickMazeEle();
            }
            break;
        }

        case Direction.Down:
        {
            if (CurrentFarthestMazeElementIndex.y < MouseBoundary.GetCurrentMouseOnMazeElementIndex().y)
            {
                SetNewFarthestMazeEleOnVerticalLineOfLastClickMazeEle();
            }
            break;
        }

        default:
        {
            throw new System.NotImplementedException();
        }
        }
    }
    public void UpdateList(List <IMazeElement> _mazeElementsToProcess, Direction _processDirection, bool newIsMazeWallForRootMazeElement)
    {
        mazeElementsToProcess = _mazeElementsToProcess;

        Vector2 LastMouseClickMazeElementIndex = mouseBoundary.GetLastMouseClickMazeElementIndex();
        Vector2 CurrenMouseOntMazeElementIndex = mouseBoundary.GetCurrentMouseOnMazeElementIndex();

        AddToListMouseClickOnMazeElement(LastMouseClickMazeElementIndex, newIsMazeWallForRootMazeElement);
        switch (_processDirection)
        {
        case Direction.Left:
        {
            for (int i = (int)LastMouseClickMazeElementIndex.x - 1; i >= (int)CurrenMouseOntMazeElementIndex.x; i--)
            {
                IMazeElement MazeElementBoundary = planeBuilder.GetFromMazeArray(i, (int)LastMouseClickMazeElementIndex.y);
                AddToListIfNotBelongToAnotherWall(MazeElementBoundary, newIsMazeWallForRootMazeElement);
            }

            break;
        }

        case Direction.Right:
        {
            for (int i = (int)LastMouseClickMazeElementIndex.x + 1; i <= (int)CurrenMouseOntMazeElementIndex.x; i++)
            {
                IMazeElement MazeElementBoundary = planeBuilder.GetFromMazeArray(i, (int)LastMouseClickMazeElementIndex.y);
                AddToListIfNotBelongToAnotherWall(MazeElementBoundary, newIsMazeWallForRootMazeElement);
            }
            break;
        }

        case Direction.Up:
        {
            for (int i = (int)LastMouseClickMazeElementIndex.y - 1; i >= (int)CurrenMouseOntMazeElementIndex.y; i--)
            {
                IMazeElement MazeElementBoundary = planeBuilder.GetFromMazeArray((int)LastMouseClickMazeElementIndex.x, i);
                AddToListIfNotBelongToAnotherWall(MazeElementBoundary, newIsMazeWallForRootMazeElement);
            }

            break;
        }

        case Direction.Down:
        {
            for (int i = (int)LastMouseClickMazeElementIndex.y + 1; i <= (int)CurrenMouseOntMazeElementIndex.y; i++)
            {
                IMazeElement MazeElementBoundary = planeBuilder.GetFromMazeArray((int)LastMouseClickMazeElementIndex.x, i);
                AddToListIfNotBelongToAnotherWall(MazeElementBoundary, newIsMazeWallForRootMazeElement);
            }
            break;
        }

        default:
        {
            throw new System.NotImplementedException();
        }
        }
    }
 public FarthestMazeElementFromLastMouseClickMazeElement(IMouse _mouseBoundary)
 {
     MouseBoundary = _mouseBoundary;
     try
     {
         CurrentFarthestMazeElementIndex = _mouseBoundary.GetCurrentMouseOnMazeElementIndex();
     }
     catch (System.NullReferenceException)
     {
         CurrentFarthestMazeElementIndex = new Vector2(0, 0);
     }
 }
    public void ChangeMazeElementsInListFromTo(IMouse MouseBoundry, Direction processDirection, List <IMazeElement> mazeElementsToProcess, bool newIsMazeWallForRoot)
    {
        Vector2 firstMazeElementToReverseIndex = MouseBoundry.GetLastMouseClickMazeElementIndex();
        Vector2 lastMazeElementToReverseIndex  = MouseBoundry.GetCurrentMouseOnMazeElementIndex();;
        Change  change;

        switch (processDirection)
        {
        case Direction.Left:
        {
            change = new Change(ChangeOnLeftDirection);
            break;
        }

        case Direction.Right:
        {
            change = new Change(ChangeOnRightDirection);
            break;
        }

        case Direction.Up:
        {
            change = new Change(ChangeOnUpDirection);
            break;
        }

        case Direction.Down:
        {
            change = new Change(ChangeOnDownDirection);
            break;
        }

        default:
        {
            throw new System.NotImplementedException();
        }
        }

        change(firstMazeElementToReverseIndex, lastMazeElementToReverseIndex, mazeElementsToProcess, newIsMazeWallForRoot);
    }
    public static bool isProjectionOfCurrentMazeEleEqualToFarthestMazeEle(IFarthestMazeElement farthestMazeElement, IMouse Mouse, Direction processDirection)
    {
        bool ret = false;

        if (processDirection == Direction.Left || processDirection == Direction.Right)
        {
            Vector2 projectionOfCurrentMazeElementOnHorizontalMazeWall = new Vector2(Mouse.GetCurrentMouseOnMazeElementIndex().x, farthestMazeElement.CurrentFarthestMazeElementIndex.y);
            if (projectionOfCurrentMazeElementOnHorizontalMazeWall == farthestMazeElement.CurrentFarthestMazeElementIndex)
            {
                ret = true;
            }
        }
        else
        {
            Vector2 projectionOfCurrentMazeElementOnVerticalMazeWall = new Vector2(farthestMazeElement.CurrentFarthestMazeElementIndex.x, Mouse.GetCurrentMouseOnMazeElementIndex().y);
            if (projectionOfCurrentMazeElementOnVerticalMazeWall == farthestMazeElement.CurrentFarthestMazeElementIndex)
            {
                ret = true;
            }
        }
        return(ret);
    }
Beispiel #6
0
 public void CurrentMazeElementChange(Vector2 _newCurrentMazeElementIndex)
 {
     mouseBoundary.GetCurrentMouseOnMazeElementIndex().Returns(_newCurrentMazeElementIndex);
 }
Beispiel #7
0
 private void RewoundProcess(Direction processDirection)
 {
     mazeElementsListToProcess.ReverseFromToInList(mouse.GetCurrentMouseOnMazeElementIndex(), farthestMazeEleFromLastMouseClickMazeEle.CurrentFarthestMazeElementIndex, processDirection);
     farthestMazeEleFromLastMouseClickMazeEle.CurrentFarthestMazeElementIndex = mouse.GetCurrentMouseOnMazeElementIndex();
 }