public void CreateMap_FixedMap_EdgesAreCorrect() { // ARRANGE var map = CreateFakeMap(); var mapGenerator = new GridMapGenerator(7); // ACT mapGenerator.CreateMap(map); // ASSERT AssertEdge(map, 0, 0, 1, 0); AssertEdge(map, 3, 1, 4, 2); // полный набор соседей AssertEdge(map, 1, 1, 0, 1); AssertEdge(map, 1, 1, 1, 0); AssertEdge(map, 1, 1, 2, 0); AssertEdge(map, 1, 1, 2, 1); AssertEdge(map, 1, 1, 2, 2); AssertEdge(map, 1, 1, 1, 2); // полный набор соседей для углового AssertEdge(map, 6, 6, 5, 6); AssertEdge(map, 6, 6, 5, 5); AssertEdge(map, 6, 6, 6, 5); }
public TestGridGenWallMap() { var gridGenerator = new GridMapGenerator(10); gridGenerator.CreateMap(this); RemoveEdge(3, 3, 3, 4); RemoveEdge(3, 3, 2, 3); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (GUILayout.Button("Regenerate")) { GridMapGenerator gridMap = (GridMapGenerator)target; gridMap.BuildMesh(); } }
public void CreateMap_HexMapType_NoExceptions() { // ARRANGE var map = new HexMap(); var mapGenerator = new GridMapGenerator(7); // ACT Action act = () => { mapGenerator.CreateMap(map); }; // ASSERT act.Should().NotThrow(); }
/// <summary> /// Создаёт открытую карту без препятствий. /// </summary> /// <returns></returns> private static IMap CreateGridOpenMap() { var nodes = new List <IMapNode>(); var edges = new List <IEdge>(); var mapMock = new Mock <IMap>(); mapMock.SetupGet(x => x.Nodes).Returns(nodes); mapMock.SetupGet(x => x.Edges).Returns(edges); mapMock.Setup(x => x.IsPositionAvailableFor(It.IsAny <IMapNode>(), It.IsAny <IActor>())) .Returns(true); var map = mapMock.Object; var genertor = new GridMapGenerator(); genertor.CreateMap(map); return(map); }
public GridMap Build(int width, int height) { var structure = StructureGenerator.Generate(width, height); return(GridMapGenerator.Generate(structure)); }
void Start() { gridMap = GetComponent <GridMapGenerator>(); }
public TestGridGenMap(int size) { var gridGenerator = new GridMapGenerator(size); gridGenerator.CreateMap(this); }