private static Voice[] GetVoices() { Voice[] voices = null; var audio = Find.Any <InteractionAudio>(); if (audio != null) { var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); var assetsRoot = Path.Combine(userProfile, "Box", "VR Initiatives", "Engineering", "Assets"); var keyFile = Path.Combine(assetsRoot, "DevKeys", "azure-speech.txt"); if (File.Exists(keyFile)) { var lines = File.ReadAllLines(keyFile); var azureApiKey = lines[0]; var azureRegion = lines[1]; var cache = audio.GetCachingStrategy(); var voicesDecoder = new JsonFactory <Voice[]>(); var voicesClient = new VoicesClient(azureRegion, azureApiKey, voicesDecoder, cache); var voicesTask = voicesClient.GetVoicesAsync(); voices = voicesTask.Result; } } return(voices); }
protected override void Awake() { base.Awake(); Find.Any(out display); display.ARModeChange += Display_ARModeChange; }
public void Awake() { Find.Any(out weatherService); #if UNITY_MODULES_WIND wind = GetComponent <WindZone>(); #endif }
public void Awake() { Find.Any(out input); devices = new[] { new Device(input, "Gaze pointer", EnableGazeButton, (i) => i.GazeAvailable, (i) => i.GazeEnabled), new Device(input, "Screen pointer", EnableScreenButton, (i) => i.MouseAvailable || i.TouchAvailable, (i) => i.MouseEnabled || i.TouchEnabled), new Device(input, "Hand tracking", EnableHandsButton, (i) => i.HandsAvailable || i.ControllersAvailable, (i) => i.HandsEnabled || i.ControllersEnabled), new Device(input, "Voice", EnableVoiceButton, (i) => i.VoiceAvailable, (i) => i.VoiceEnabled) }; }
public virtual void Awake() { if (!Find.Any(out skybox)) { skybox = this.Ensure <SkyboxManager>(); } }
/// <summary> /// Finds all of the targetable objects and makes sure they all have <see /// cref="TrackableFoundEventHandler"/> s, wiring up the onFound and onLost events of each. /// </summary> protected virtual void Start() { Find.Any(out xr); foreach (var target in FirstTargets.Distinct()) { Register(target); } }
public override void Awake() { base.Awake(); showProbe = false; #if USE_NATIVE_TOUCH Find.Any(out input); pointers.Add(fingerID, this); #endif }
public override void Awake() { base.Awake(); mgr = this.FindClosest <PhotosphereManager>(); Find.Any(out avatar); if (material == null) { material = new Material(Shader.Find("Unlit/Texture")); } }
/// <summary> /// Setup the statistics tracking and get the main camera. /// </summary> public void Awake() { #if UNITY_POSTPROCESSING prost = GetComponent <PostProcessLayer>(); #endif Find.Any(out ground); Find.Any(out display); QualityLevel = PlayerPrefs.GetInt(GRAPHICS_QUALITY_KEY, QualityLevel); #if UNITY_MODULES_XR XRSettings.eyeTextureResolutionScale = 1.5f; #endif }
void LateUpdate() { if (target == null) { var master = Find.Any <MasterSceneController>(); if (master != null) { target = master.systemUserInterface; } } transform.position = target.position; transform.rotation = target.rotation; }
public void Awake() { Find.Any(out stage); foreach (var m in Enum.GetValues(typeof(Mode))) { var mode = (Mode)m; wasGestureSatisfied[mode] = false; dragged[mode] = false; dragDistance[mode] = 0; } lastMousePosition = UnityInput.mousePosition; }
public override void Install(bool reset) { base.Install(reset); if (!reset) { var auth = UserAuthorization.WebCam; var speech = Find.Any <Input.Speech.IKeywordRecognizer>(); if (speech != null && speech.IsAvailable) { auth |= UserAuthorization.Microphone; } Application.RequestUserAuthorization(auth); } }
public void Awake() { Find.Any(out master); startMaterial = Instantiate(startMaterial); startRend = CreateChild(startMaterial, out startProps); startRend.transform.localRotation = Quaternion.Euler(0, 180, 0); endRend = CreateChild(endMaterial, out endProps); SetAlpha(0); this.Remove <MeshRenderer>(); }
/// <summary> /// Disable any subScenes that are alive in the main scene. /// </summary> public virtual void Awake() { if (Find.Any(out input)) { input.paused = true; } Find.Any(out fader); Find.Any(out interaction); foreach (var subScene in FindObjectsOfType <SubSceneController>()) { subScene.Deactivate(); } }
private void Start() { running = false; if (Find.Any(out Avatar avatar)) { userT = avatar.transform; #if UNITY_MODULES_PHYSICS user = userT.GetComponent <Rigidbody>(); #endif } if (Find.Any(out darth)) { darth.Entered += Darth_Entered; } }
/// <summary> /// Get the pointer graphic objects, the main camera, the animator, and the main view system. /// Disable the graphics for the pointer. /// </summary> public void Awake() { #if UNITY_MODULES_AUDIO Find.Any(out interaction); #endif pointer = transform.Find("Pointer"); arrow = pointer.Find("Tag"); tagRange = arrow.localPosition; image = transform.Find("Image"); #if UNITY_MODULES_ANIMATION animator = this.Ensure <UnityAnimator>(); #endif pointer.SetActive(false); image.SetActive(false); }
/// <summary> /// Retrieves component references and sets up event handlers. /// </summary> public void Awake() { Install(false); Entering += FadeTransition_Enter_Exiting; Exiting += FadeTransition_Enter_Exiting; r = GetComponent <Renderer>(); props = new MaterialPropertyBlock(); var material = r.GetMaterial(); fadeOutColor = material.GetColor("_Color"); Find.Any(out input); }
/// <summary> /// If the <see cref="MinutesBetweenReports"/> expires, or the user has traveled more than /// <see cref="MilesBetweenReports"/> since the last weather report, retrieves a new weather report. /// </summary> public void Update() { if (location == null) { Find.Any(out location); } if (weatherService == null && !string.IsNullOrEmpty(owmApiKey)) { if (PlayerPrefs.HasKey(REPORT_KEY)) { lastReportJSON = PlayerPrefs.GetString(REPORT_KEY); } var json = new JsonFactory <WeatherReport>(); serializer = json; weatherService = new OpenWeatherMap.API(json, owmApiKey, lastReportJSON); } if (FakeWeather) { if (!wasFakeWeather && weather != null) { weather.reportTime = EditableDateTime.Now; var gps = GetComponent <GPSLocation>(); if (gps != null && gps.HasCoord) { weather.location = gps.Coord; } } currentWeather = weather; } else if (Ready) { weatherService.ReportRadiusMeters = MilesBetweenReports.Convert(UnitOfMeasure.Miles, UnitOfMeasure.Meters); weatherService.ReportTTLMinutes = MinutesBetweenReports; reportTask = GetReport(false); } wasFakeWeather = FakeWeather; if (DebugReport) { PrintDebugReport(); } }
public virtual void Install(bool reset) { #if UNITY_EDITOR if (pointerPrefab == null) { pointerPrefab = ResourceExt.EditorLoadAsset <GameObject>("Assets/Juniper/Assets/Prefabs/Rigs/DiskProbe2018.2.prefab"); } if (laserPointerNormalMaterial == null) { laserPointerNormalMaterial = ResourceExt.EditorLoadAsset <Material>("Assets/Juniper/Assets/Materials/LaserPointer_White.mat"); } if (laserPointerEnabledMaterial == null) { laserPointerEnabledMaterial = ResourceExt.EditorLoadAsset <Material>("Assets/Juniper/Assets/Materials/LaserPointer_Green.mat"); } if (laserPointerDisabledMaterial == null) { laserPointerDisabledMaterial = ResourceExt.EditorLoadAsset <Material>("Assets/Juniper/Assets/Materials/LaserPointer_Red.mat"); } #endif Find.Any(out stage); stage.Install(reset); stage.IndependentHead = HasFloorPosition; Gaze = MakePointer <GazePointer>(stage.Head, "GazePointer"); Mouse = MakePointer <Mouse>(stage.Head, "Mouse"); Helper = MakePointer <NetworkPointer>(stage.Hands, "Network"); Touches = new TouchPoint[10]; for (var i = 0; i < Touches.Length; ++i) { Touches[i] = MakePointer <TouchPoint>(stage.Head, $"Touches/TouchPoint{i.ToString()}"); Touches[i].fingerID = i; } Controllers = MotionController.MakeControllers(MakeHandPointer <MotionController>); Hands = HandTracker.MakeControllers(MakeHandPointer <HandTracker>); Voice = this.FindClosest <KeywordRecognizer>(); }
/// <summary> /// Initializes a new instance of the <see cref="T:Juniper.Input.PointerDevice"/> class. /// </summary> public virtual void Awake() { Install(false); Find.Any(out input); Find.Any(out stage); Find.Any(out interaction); pointerOffset = MinimumPointerDistance * Vector3.forward; Haptics = this.Ensure <HapticType>(); nativeButtons.ButtonDownNeeded += IsButtonDown; nativeButtons.ButtonUpNeeded += IsButtonUp; nativeButtons.ButtonPressedNeeded += IsButtonPressed; nativeButtons.ClonedPointerEventNeeded += Clone; nativeButtons.InteractionNeeded += PlayInteraction; }
protected virtual void Awake() { Find.Any(out input); var parentControl = GetComponent <IPointerClickHandler>(); if (parentControl is UnityEngine.UI.Selectable selectable) { isParentEnabled = selectable.IsInteractable; } else if (parentControl is AbstractTouchable touchable) { isParentEnabled = touchable.IsInteractable; } else { isParentEnabled = AlwaysEnabled; } }
public override void Install(bool reset) { base.Install(reset); this.WithLock(() => { var rend = this.Ensure <WaveVR_Render>(); if (rend.IsNew) { if (!rend.Value.isExpanded) { WaveVR_Render.Expand(rend); } rend.Value.cpuPerfLevel = WaveVR_Utils.WVR_PerfLevel.Maximum; rend.Value.gpuPerfLevel = WaveVR_Utils.WVR_PerfLevel.Maximum; } rend.Value.origin = WVR_PoseOriginModel.WVR_PoseOriginModel_OriginOnHead; var tracker = this.Ensure <WaveVR_DevicePoseTracker>().Value; tracker.type = WVR_DeviceType.WVR_DeviceType_HMD; tracker.trackPosition = true; tracker.EnableNeckModel = true; tracker.trackRotation = true; tracker.timing = WVR_TrackTiming.WhenNewPoses; #if UNITY_MODULES_AUDIO #if UNITY_GOOGLE_RESONANCE_AUDIO var wasStereo = goog.stereoSpeakerModeEnabled; this.Remove <ResonanceAudioListener>(); #endif this.Remove <AudioListener>(); Find.Any(out listener); #if UNITY_GOOGLE_RESONANCE_AUDIO goog = listener.Ensure <ResonanceAudioListener>(); goog.stereoSpeakerModeEnabled = wasStereo; #endif #endif }); }
/// <summary> /// Adds a probe to the scene. /// </summary> /// <param name="parent"></param> /// <param name="name"> </param> /// <returns></returns> public static Probe Ensure(Transform parent, string name) { var probe = Find.Any <Probe>(p => p.name == name); if (probe == null && Find.Any(out UnifiedInputModule input)) { if (input.pointerPrefab == null) { probe = new GameObject(name).AddComponent <Probe>(); } else { probe = Instantiate(input.pointerPrefab).Ensure <Probe>(); probe.name = name; } } probe.transform.Reparent(parent, false); return(probe); }
private static Camera MakeCamera(string tag, string name) { ConfigurationManagement.TagManager.NormalizeTag(tag); var cam = Find.Any <Camera>(camera => camera.CompareTag(tag)); if (cam == null) { var obj = new GameObject(name); cam = obj.AddComponent <Camera>(); #if !UNITY_2019_3_OR_NEWER #pragma warning disable CS0618 // Type or member is obsolete obj.AddComponent <GUILayer>(); #pragma warning restore CS0618 // Type or member is obsolete #endif cam.gameObject.tag = tag; if (Find.Any(out JuniperSystem js)) { SceneManager.MoveGameObjectToScene(obj, js.gameObject.scene); } } return(cam); }
public void Awake() { Find.Any(out interaction); }
public override void Awake() { base.Awake(); processor = new UnityTexture2DProcessor(); Find.Any(out loadingBar); Find.Any(out gps); if (!this.FindClosest(out photospheres)) { photospheres = this.Ensure <PhotosphereManager>(); } Find.Any(out avatar); navPlane = avatar.GroundPlane.Ensure <Clickable>(); navPlane.Activate(); navPointer = transform.Find("NavPointer"); if (navPointer != null) { navPointer.Deactivate(); } Find.Any(out input); cache = new CachingStrategy(); #if UNITY_EDITOR this.ReceiveCredentials(); locationInput = this.Ensure <EditorTextInput>(); locationInput.OnSubmit.AddListener(new UnityAction <string>(SetLocation)); if (!string.IsNullOrEmpty(locationInput.value)) { SetLocation(locationInput.value); } else if (gps != null && gps.HasCoord) { SetLocation(gps.Coord.ToString()); } var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); var assetsRoot = Path.Combine(userProfile, "Box", "VR Initiatives", "Engineering", "Assets"); var oldCubemapPath = Path.Combine(assetsRoot, "GoogleMaps"); var oldGmapsPath = Path.Combine(oldCubemapPath, "streetview", "maps", "api"); cache.AddBackup(new FileCacheLayer(oldCubemapPath)); cache.AddBackup(new FileCacheLayer(oldGmapsPath)); #else if (gps != null && gps.HasCoord) { SetLocation(gps.Coord.ToString()); } #endif var newGmapsPath = Path.Combine(CachePrefix, "Google", "StreetView"); cache.Add(new StreamingAssetsCacheLayer(newGmapsPath)); codec = new UnityTexture2DCodec(MediaType.Image.Jpeg); var metadataDecoder = new JsonFactory <MetadataTypeT>(); var geocodingDecoder = new JsonFactory <GeocodingResponse>(); gmaps = new GoogleMapsClient <MetadataTypeT>(gmapsApiKey, gmapsSigningKey, metadataDecoder, geocodingDecoder, cache); photospheres.CubemapNeeded += Photosphere_CubemapNeeded; photospheres.SetIO(cache, codec); photospheres.SetDetailLevels(searchFOVs); }
public void Start() { Find.Any(out input); }
public virtual void Awake() { Find.Any(out master); }
public void Awake() { location = GetComponent <GPSLocation>(); Find.Any(out compass); }
/// <summary> /// Finds the anchor store. /// </summary> public void Start() { Find.Any(out nkar); }