void Start() { if (mapData != null && grid != null) { int[,] mapDesign = mapData.MakeMap(); grid.CreateGrid(mapDesign); gridVisualisation = grid.gameObject.GetComponent <GridVisualisation>(); if (gridVisualisation != null) { gridVisualisation.CreateGridVisualisation(grid); } //if our goal is not in the map range it will throw. if (grid.IsWithinBounds(xGoal, yGoal) && grid.IsWithinBounds(xStart, yStart)) { startNode = gridVisualisation.nodesVisualisationData[xStart, yStart]; goalNode = gridVisualisation.nodesVisualisationData[xGoal, yGoal]; xGoalInput.text = xGoal.ToString(); yGoalInput.text = yGoal.ToString(); xUnitInput.text = xStart.ToString(); yUnitInput.text = yStart.ToString(); InstantiateUnit(startNode); } } }
void Start() { if (mapData != null && grid != null) { int[,] mapinstance = mapData.MakeMap(); grid.CreateGrid(mapinstance); gridVisualisation = grid.gameObject.GetComponent <GridVisualisation>(); if (gridVisualisation != null) { gridVisualisation.CreateGridVisualisation(grid); } //if our goal is not in the map range it will throw. if (grid.IsWithinBounds(xGoal, yGoal) && grid.IsWithinBounds(xStart, yStart)) { startNode = gridVisualisation.nodesVisualisationData[xStart, yStart]; goalNode = gridVisualisation.nodesVisualisationData[xGoal, yGoal]; xGoalInput.text = xGoal.ToString(); yGoalInput.text = yGoal.ToString(); xUnitInput.text = xStart.ToString(); yUnitInput.text = yStart.ToString(); ChangeTileToGoalNode(goalNode); InstantiateUnit(startNode); } flowfieldPathfinding.CreatePathfinding(grid, gridVisualisation); flowfieldPathfinding.FlowfieldPath(goalNode.transform.position, PathfindingVisualisationAid, heuristicIndex); } }