private void ManualInitGrid() { const int sizeX = 7; const int sizeZ = 23; const float cellSize = 1f; gridSystem.Init(new Int2(sizeX, sizeZ), cellSize, new Int2(3, 22)); int[,] map = new int[sizeX, sizeZ] { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; HashSet <PlatformGroup> init = new HashSet <PlatformGroup>(); for (int x = 0; x < sizeX; x++) { for (int z = 0; z < sizeZ; z++) { if (map[x, z] == 1) { init.Add(gridSystem.PlacePlatform(x, z)); } } } PlatformGroup.Restructure(init, new Int2(3, 0)); }
private void ManualInitGrid() { gridSystem.Init(new Int2(sizeX, sizeZ), cellSize, new Int2(goalX, goalZ)); //gridSizeX = 7 //gridSizeZ = 20 if (gridSystem.gridSizeX != 7 || gridSystem.gridSizeZ != 22) { throw new UnityException("gridSystem has a different size than that of manual initialization "); } int[,] map = new int[7, 22] { { 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1 }, { 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 }, { 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0 }, { 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1 }, { 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0 }, { 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1 }, { 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0 } }; HashSet <PlatformGroup> init = new HashSet <PlatformGroup>(); for (int x = 0; x < 7; x++) { for (int z = 0; z < 22; z++) { if (map[x, z] == 1) { init.Add(gridSystem.PlacePlatform(x, z)); } } } PlatformGroup.Restructure(init, gridSystem.ComputeIdx(new Vector2(robotController.transform.position.x, robotController.transform.position.z))); }