protected void ActivateSelecetedRaycastCheckers(GameObject[] selectedGameObjects) { List <CS_RaycastChecker> raycastCheckersToRemoveFromInactiveList = new List <CS_RaycastChecker>(); // cycle selected objects and get their raycast checkers foreach (GameObject goRaycastChecker in selectedGameObjects) { CS_RaycastChecker selectedRC = goRaycastChecker.GetComponent <CS_RaycastChecker>(); // if the selected object is a raycast checker, activate it if (selectedRC) { // activate the raycast checker selectedRC.ActivateRaycastChecker(true); raycastCheckersToRemoveFromInactiveList.Add(selectedRC); } } // if raycast checkers are to be moved lists if (raycastCheckersToRemoveFromInactiveList.Count > 0) { foreach (CS_RaycastChecker activeRaycastChecker in raycastCheckersToRemoveFromInactiveList) { // if the raycast checker is in the inactive raycast checkers list if (inactiveRaycastCheckers.Contains(activeRaycastChecker)) { inactiveRaycastCheckers.Remove(activeRaycastChecker); } } raycastCheckersToRemoveFromInactiveList.Clear(); } }
protected void DeactivateSelectedRaycastCheckers(GameObject[] selectedGameObjects) { // cycle selected objects and get their raycast checkers foreach (GameObject goRaycastChecker in selectedGameObjects) { CS_RaycastChecker selectedRC = goRaycastChecker.GetComponent <CS_RaycastChecker>(); // if the selected object is a raycast checker, activate it if (selectedRC) { // deactivate the raycast checker selectedRC.ActivateRaycastChecker(false); // if the selected raycast checker is not in the inactive raycast checker list, add it if (!inactiveRaycastCheckers.Contains(selectedRC)) { inactiveRaycastCheckers.Add(selectedRC); } } } }