#1 Problem: This code is detecting if the path is blocked but for some reason after detecting if its blocked i cant build anymore to other plane that its not blockin and its going to say block.
`
string name = btnChoice.name;
//temporary collider to test if its going to block and if its not blocking it will get destroyed and install a new tower.
GameObject test = (GameObject)Instantiate(testCollider, planeSelected.transform.position, Quaternion.identity);
GraphUpdateObject guo = new GraphUpdateObject(test.collider.bounds);
bool pathBlocked = GraphUpdateUtilities.UpdateGraphsNoBlock(guo, GameObject.Find(“Enemy”).GetComponent().a,
GameObject.Find(“Enemy”).GetComponent().b, false);
if (pathBlocked)
{
Debug.Log("Not Blocked" + name);
planeSelected.tag = "PlacementPlane_Taken";
if (money > lowestCost)
{
if (name == "Button_Turret" && planeSelected.tag == "PlacementPlane_Selected")
{
GameObject go = (GameObject)Instantiate(allStructures [0], planeSelected.transform.position, Quaternion.identity);
planeSelected.GetComponent<PlacementPlane>().myStructure = go;
money -= go.GetComponent<Turret>().cost;
} else if (name == "Button_AirTurret" && planeSelected.tag == "PlacementPlane_Selected" && money >= 150)
{
GameObject go = (GameObject)Instantiate(allStructures [1], planeSelected.transform.position.Quaternion.identity);
planeSelected.GetComponent<PlacementPlane>().myStructure = go;
money -= go.GetComponent<AirTurret>().cost;
}
}
foreach(GameObject enemy in GameObject.FindGameObjectsWithTag("Enemy"))
{
enemy.GetComponent<TemporaryEnemyScript>().GetNewPath();
}
buildPanelOpen = false;
planeSelected = null;
lastHitObj = null;
} else if(!pathBlocked)
{
Debug.Log("Blocked");
planeSelected.tag = "PlacementPlane_Open";
DestroyImmediate(test);
pathfinding.Scan();
buildPanelOpen = false;
planeSelected = null;
lastHitObj = null;
}
}`