/// <summary> /// Awake is used to initialize any variables or game state before the game starts. /// </summary> void Awake() { canspawnbunny = false; tracker = GetComponent <ZEDControllerTracker_DemoInputs>(); zedPlane = FindObjectOfType <ZEDPlaneDetectionManager>(); bunnySpawner = GetComponent <BunnySpawner>(); }
// Use this for initialization void Start() { if (!zedController) { zedController = GetComponentInParent <ZEDControllerTracker_DemoInputs>(); } }
IEnumerator Start() { audiosource = GetComponent <AudioSource>(); if (zedManager == null) { zedManager = FindObjectOfType <ZEDManager>(); if (ZEDManager.GetInstances().Count > 1) { Debug.Log("Warning: " + gameObject + " ZEDManager reference not set, but there are multiple ZEDManagers in the scene. " + "Setting to first available ZEDManager, which may cause undesirable crosshair positions."); } } if (laserPointerBeadHolder != null) { //Get the laser bead from the parent/achor object. pointerbead = laserPointerBeadHolder.transform.GetChild(0).gameObject; //Disable the laser bead to wait for the ZED to initialize. pointerbead.SetActive(false); } //Wait for VR Controllers to initilize yield return(new WaitForSeconds(1f)); objecttracker = GetComponent <ZEDControllerTracker_DemoInputs>(); if (objecttracker != null) { #if ZED_STEAM_VR if (objecttracker.index >= 0) { yield break; } #endif #if ZED_OCULUS if (OVRInput.GetConnectedControllers().ToString().ToLower().Contains("touch")) { yield break; } #endif // If it got here then there's no VR Controller connected int children = transform.childCount; for (int i = 0; i < children; ++i) { transform.GetChild(i).gameObject.SetActive(false); } //this.enabled = false; } else { //If its not attached to an object tracker var otherObjectTracker = FindObjectsOfType <ZEDControllerTracker>(); if (otherObjectTracker != null) { int children = transform.childCount; #if ZED_STEAM_VR foreach (ZEDControllerTracker trackers in otherObjectTracker) { if (trackers.index >= 0) { for (int i = 0; i < children; ++i) { transform.GetChild(i).gameObject.SetActive(false); } this.enabled = false; yield break; } } #endif #if ZED_OCULUS if (OVRManager.isHmdPresent) { if (OVRInput.GetConnectedControllers().ToString().ToLower().Contains("touch")) { for (int i = 0; i < children; ++i) { transform.GetChild(i).gameObject.SetActive(false); } //this.enabled = false; yield break; } } #endif } } }