コード例 #1
0
ファイル: SpeakableEditor.cs プロジェクト: Chapmania/Juniper
        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);
        }
コード例 #2
0
ファイル: ARCoreGround.cs プロジェクト: Chapmania/Juniper
        protected override void Awake()
        {
            base.Awake();

            Find.Any(out display);
            display.ARModeChange += Display_ARModeChange;
        }
コード例 #3
0
        public void Awake()
        {
            Find.Any(out weatherService);
#if UNITY_MODULES_WIND
            wind = GetComponent <WindZone>();
#endif
        }
コード例 #4
0
        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)
            };
        }
コード例 #5
0
ファイル: Photosphere.cs プロジェクト: Chapmania/Juniper
 public virtual void Awake()
 {
     if (!Find.Any(out skybox))
     {
         skybox = this.Ensure <SkyboxManager>();
     }
 }
コード例 #6
0
ファイル: TrackerKeeper.cs プロジェクト: Chapmania/Juniper
        /// <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);
            }
        }
コード例 #7
0
ファイル: TouchPoint.cs プロジェクト: Chapmania/Juniper
        public override void Awake()
        {
            base.Awake();

            showProbe = false;

#if USE_NATIVE_TOUCH
            Find.Any(out input);
            pointers.Add(fingerID, this);
#endif
        }
コード例 #8
0
        public override void Awake()
        {
            base.Awake();

            mgr = this.FindClosest <PhotosphereManager>();
            Find.Any(out avatar);

            if (material == null)
            {
                material = new Material(Shader.Find("Unlit/Texture"));
            }
        }
コード例 #9
0
        /// <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
        }
コード例 #10
0
        void LateUpdate()
        {
            if (target == null)
            {
                var master = Find.Any <MasterSceneController>();
                if (master != null)
                {
                    target = master.systemUserInterface;
                }
            }

            transform.position = target.position;
            transform.rotation = target.rotation;
        }
コード例 #11
0
ファイル: CameraControl.cs プロジェクト: Chapmania/Juniper
        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;
        }
コード例 #12
0
        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);
            }
        }
コード例 #13
0
        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>();
        }
コード例 #14
0
        /// <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();
            }
        }
コード例 #15
0
ファイル: TeleportPad.cs プロジェクト: Chapmania/Juniper
        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;
            }
        }
コード例 #16
0
        /// <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);
        }
コード例 #17
0
        /// <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);
        }
コード例 #18
0
ファイル: Weather.cs プロジェクト: Chapmania/Juniper
        /// <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();
            }
        }
コード例 #19
0
        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>();
        }
コード例 #20
0
        /// <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;
        }
コード例 #21
0
        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;
            }
        }
コード例 #22
0
        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
            });
        }
コード例 #23
0
        /// <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);
        }
コード例 #24
0
        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);
        }
コード例 #25
0
ファイル: Speakable.cs プロジェクト: Chapmania/Juniper
 public void Awake()
 {
     Find.Any(out interaction);
 }
コード例 #26
0
        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);
        }
コード例 #27
0
ファイル: CameraControl.cs プロジェクト: Chapmania/Juniper
 public void Start()
 {
     Find.Any(out input);
 }
コード例 #28
0
 public virtual void Awake()
 {
     Find.Any(out master);
 }
コード例 #29
0
ファイル: SunPosition.cs プロジェクト: Chapmania/Juniper
 public void Awake()
 {
     location = GetComponent <GPSLocation>();
     Find.Any(out compass);
 }
コード例 #30
0
ファイル: Anchored.cs プロジェクト: Chapmania/Juniper
 /// <summary>
 /// Finds the anchor store.
 /// </summary>
 public void Start()
 {
     Find.Any(out nkar);
 }