public MazeSaveTextCreator(IPlaneBuilder _planeBuilder, IPlaneElementsBounds _elementsBounds, List <string> _saveText, IMazeSpecialElementsSeeker _saveSystemBoundary)
 {
     planeBuilder       = _planeBuilder;
     elementsBounds     = _elementsBounds;
     saveText           = _saveText;
     saveSystemBoundary = _saveSystemBoundary;
 }
    public void CreateSaveText_ContainCheck()
    {
        List <Vector2> listOfMazeElementsThatAreMazeWall = new List <Vector2>();

        listOfMazeElementsThatAreMazeWall.Add(new Vector2(0, 0));
        listOfMazeElementsThatAreMazeWall.Add(new Vector2(0, 1));
        listOfMazeElementsThatAreMazeWall.Add(new Vector2(0, 3));
        listOfMazeElementsThatAreMazeWall.Add(new Vector2(0, 4));
        Vector3 gamePlaneCenter = new Vector3(0, 0, 0);
        Vector3 gamePlaneSize   = new Vector3(10, 10, 10);

        IPlaneElementsBounds planeElementsBounds = GetPlaneElementsBounds(new Bounds(new Vector3(0, 0, 0), new Vector3(10, 10, 10)));
        IPlaneBuilder        planeBuilder        = GetPlaneBuilderMock(new Vector2(10, 10), listOfMazeElementsThatAreMazeWall);

        MazeSaveTextCreator mazeSaveTextCreator = new MazeSaveTextCreator(planeBuilder, planeElementsBounds, new List <string>(), Substitute.For <IMazeSpecialElementsSeeker>());
        List <string>       saveTextToCheck     = mazeSaveTextCreator.CreateSaveText();

        Assert.AreEqual(saveTextToCheck[0].Contains(gamePlaneCenter.ToString()), true);// Bounds format: "Center: (0,0, 0,0, 0,0), Extents: (5,0, 5,0, 5,0)"
        Assert.AreEqual(saveTextToCheck[0].Contains("5,0, 5,0, 5,0"), true);
        Assert.AreEqual(saveTextToCheck[3].Contains("10,0, 10,0"), true);
        Assert.AreEqual(saveTextToCheck[4].Contains("0,0, 0,0"), true);
        Assert.AreEqual(saveTextToCheck[5].Contains("0,0, 1,0"), true);
        Assert.AreEqual(saveTextToCheck[6].Contains("0,0, 3,0"), true);
        Assert.AreEqual(saveTextToCheck[7].Contains("0,0, 4,0"), true);
    }
示例#3
0
 public PlaneBuilder(IFirstUpLeftMazeElementPositionProvider _firstUpLeftMazeElementPositionProvider, INumberOfMazeElementsInGamePlaneArea _numberOfMazeElementsInGamePlaneArea, IPlaneBuilder _planeBuilder,
                     IPlaneElementsBounds _planeElementsBounds)
 {
     firstUpLeftMazeElementPositionProvider = _firstUpLeftMazeElementPositionProvider;
     numberOfMazeElementsInGamePlaneArea    = _numberOfMazeElementsInGamePlaneArea;
     PlaneBuilder        = _planeBuilder;
     PlaneElementsBounds = _planeElementsBounds;
 }
    public IPlaneElementsBounds GetPlaneElementsBounds(Bounds gamePlaneBound)
    {
        IPlaneElementsBounds planeElementsBounds = Substitute.For <IPlaneElementsBounds>();

        planeElementsBounds.GamePlaneBounds.Returns(gamePlaneBound);

        return(planeElementsBounds);
    }
    public void CreateSaveText_CountCheck()
    {
        List <Vector2> listOfMazeElementsThatAreMazeWall = new List <Vector2>();

        listOfMazeElementsThatAreMazeWall.Add(new Vector2(0, 0));
        listOfMazeElementsThatAreMazeWall.Add(new Vector2(0, 1));
        listOfMazeElementsThatAreMazeWall.Add(new Vector2(0, 3));
        listOfMazeElementsThatAreMazeWall.Add(new Vector2(0, 4));

        IPlaneElementsBounds planeElementsBounds = GetPlaneElementsBounds(new Bounds(new Vector3(0, 0, 0), new Vector3(10, 10, 10)));
        IPlaneBuilder        planeBuilder        = GetPlaneBuilderMock(new Vector2(10, 10), listOfMazeElementsThatAreMazeWall);

        MazeSaveTextCreator mazeSaveTextCreator = new MazeSaveTextCreator(planeBuilder, planeElementsBounds, new List <string>(), Substitute.For <IMazeSpecialElementsSeeker>());
        List <string>       saveTextToCheck     = mazeSaveTextCreator.CreateSaveText();

        Assert.AreEqual(saveTextToCheck.Count, 8);
    }
示例#6
0
 public NumberOfMazeElementsInGamePlaneArea(IPlaneElementsBounds _planeElementsBounds)
 {
     planeElementsBounds = _planeElementsBounds;
 }
 public void SetPlaneElementsBounds(IPlaneElementsBounds _planeElementsBounds)
 {
     PlaneElementsBounds = _planeElementsBounds;
 }
示例#8
0
 public FirstUpLeftMazeElementPositionProvider(IPlaneBuilder _planeController, IPlaneElementsBounds _planeElementsBounds)
 {
     planeController     = _planeController;
     planeElementsBounds = _planeElementsBounds;
 }