public void ClearPath() { for (int i = 0; i < route.Count; i++) { Grid_script gs = GetGrid(route[i]).GetComponent <Grid_script>(); gs.ChangeMaterial(gs.normalMaterial); } }
//For testing:show the grids available for build/pass public void ShowPath() { for (int i = 0; i < route.Count; i++) { Grid_script gs = GetGrid(route[i]).GetComponent <Grid_script>(); if (i == 0) { gs.ChangeMaterial(gs.entryMaterial); } else if (i == route.Count - 1) { gs.ChangeMaterial(gs.exitMaterial); } else { gs.ChangeMaterial(gs.highlightMaterial); GameObject next = GetGrid(route[i + 1]); gs.gameObject.transform.LookAt(next.transform); //Let the -x axis look at the next grid instead of y gs.transform.Rotate(new Vector3(0, 0, 90)); } } }