public void addObstacle(GameObject obst) { ObstManager obstManager = obst.GetComponent <ObstManager>(); obstManager.setIsActive(true); //if obstacle has not yet been asigned an index if (obstManager.getIndex() == -1) { Obstacles.Add(obstManager); obstManager.setIndex(heighestIndex); heighestIndex++; numOfObstacles++; gridScript.addObstPath(); } else { Obstacles[obstManager.getIndex()] = obstManager; } if (managerScipt.isLocalAvoidance) { obstManager.GetComponent <PredictPath>().enabled = false; obstManager.GetComponent <GetCoveredNodes>().enabled = false; } }
public void removeObstacle(GameObject obst) { ObstManager obstManager = obst.GetComponent <ObstManager>(); obstManager.setIsActive(false); obstManager.cleanPath(); Obstacles[obstManager.getIndex()] = null; numOfObstacles--; }
public void init() { //set ref managerScript = Ref.getManagerGO().GetComponent <Manager>(); predictedPathBoxCollider = predictedPathBox.GetComponent <BoxCollider>(); gridScript = Ref.getGridScript(); pathBounds = predictedPathBox.GetComponent <BoxCollider>(); obstManagerScript = GetComponent <ObstManager>(); followPathScript = managerScript.getActiveAgent().GetComponent <FollowPath>(); predictedPathBoxXScale = predictedPathBox.transform.localScale.x; indexObstList = obstManagerScript.getIndex(); }