private void resetPointsOfInterest() { if (ShowDebugLog) { Debug.Log("Reseting Points Of Interest"); } // stop coroutine Stop_PointsCycle(); // clear list PointsOfInterest.Clear(); PointsOfInterest = new List <GameObject>(); if (CurrentObject != null) { // get list reference from new object VRR_ObjectOfInterest ooi = CurrentObject.GetComponent <VRR_ObjectOfInterest>(); // IF there is an object of interest, add its points values to list if (ooi != null && ooi.PointsOfInterest.Length > 0) { for (int i = 0; i < ooi.PointsOfInterest.Length; i++) { PointsOfInterest.Add(ooi.PointsOfInterest[i].gameObject); } } // start coroutine again Start_PointsCycle(); } }
void OnTriggerEnter(Collider col) { if (_isReady) { if (col.gameObject != InterestController.gameObject) { VRR_ObjectOfInterest ooi = col.gameObject.GetComponent <VRR_ObjectOfInterest>(); if (ooi != null) { //Debug.Log(col.name + " is an object of interest."); // add game object to primary list InterestController.ObjectsOfInterest.Add(col.gameObject); // interupt cycle InterestController.InteruptCycle(col.gameObject); } } } }
/// <summary> /// Remove Exited Object from the Objects Of Interest List in the Controller_Interest script /// If the exited object was being looked at, refresh the focus (clear points of interest and /// the currently looked at objects) /// </summary> /// <param name="col"></param> void OnTriggerExit(Collider col) { if (_isReady) { VRR_ObjectOfInterest ooi = col.gameObject.GetComponent <VRR_ObjectOfInterest>(); if (ooi != null) { // IF the object exiting is the CURRENT OBJECT being looked at // clear everything... if (ooi.gameObject == InterestController.CurrentObject) { InterestController.CurrentlyLookingAt = null; InterestController.CurrentObject = null; } // remove object from list InterestController.ObjectsOfInterest.Remove(col.gameObject); InterestController.ChangeObjectOfFocus(); } } }