示例#1
0
        /// <summary>
        ///     初期化処理を実施します
        /// </summary>
        private void OnEnable()
        {
            if (isInitialized)
            {
                return;
            }

            isInitialized        = true;
            manipulationHandler  = GetComponent <ManipulationHandler>();
            interactionGrabbable = GetComponent <NearInteractionGrabbable>();
            handInteractionHint  = GetComponentInChildren <HandInteractionHint>();
            arrowAnimate         = GetComponentInChildren <ArrowAnimate>();
            toolTip = GetComponentInChildren <ToolTip>();
            systemKeyboardInputHelper = GetComponentInChildren <SystemKeyboardInputHelper>();
            pos1 = handInteractionHint.transform.GetChild(1).transform.position;
            pos2 = handInteractionHint.transform.GetChild(2).transform.position;
        }
        private async Task CreateAnchorsDemoAsync()
        {
            switch (currentAppState)
            {
            case AppState.DemoStepCreateSession:
                CleanupSpawnedObjects();
                currentCloudAnchor = null;
                if (CloudManager.Session == null)
                {
                    await CloudManager.CreateSessionAsync();

                    ConfigureSession();
                    await CloudManager.StartSessionAsync();
                }
                else
                {
                    CloudManager.StopSession();
                    await CloudManager.ResetSessionAsync();

                    ConfigureSession();
                }
                locationProvider = new PlatformLocationProvider();
                CloudManager.Session.LocationProvider = locationProvider;

                SensorPermissionHelper.RequestSensorPermissions();
                ConfigureSensors();
                currentAppState = AppState.DemoStepCreateLocalAnchor;
                break;

            case AppState.DemoStepCreateLocalAnchor:
                if (spawnedObject != null)
                {
                    currentAppState = AppState.DemoStepSettingExplanationText;
                }

                break;

            case AppState.DemoStepSettingExplanationText:
                keyboardInputHelper = spawnedObject.GetComponentInChildren <SystemKeyboardInputHelper>();
                if (keyboardInputHelper != null && !string.IsNullOrEmpty(keyboardInputHelper.text))
                {
                    explanationText = new Dictionary <string, string>();
                    explanationText.Add("Explanation", keyboardInputHelper.text);
                    keyboardInputHelper = null;
                    currentAppState     = AppState.DemoStepSaveCloudAnchor;
                }
                break;

            case AppState.DemoStepSaveCloudAnchor:
                currentAppState = AppState.DemoStepSavingCloudAnchor;
                await SaveCurrentObjectAnchorToCloudAsync();

                currentAppState    = AppState.DemoStepReplay;
                spawnedObject      = null;
                currentCloudAnchor = null;
                break;

            case AppState.DemoStepReplay:
                break;

            case AppState.DemoStepStopSession:
                CloudManager.StopSession();
                CleanupSpawnedObjects();
                await CloudManager.ResetSessionAsync();

                locationProvider = null;
                currentAppState  = AppState.DemoStepComplete;
                break;

            case AppState.DemoStepComplete:
                currentCloudAnchor = null;
                currentAppState    = AppState.DemoStepSettingMode;
                CleanupSpawnedObjects();
                break;
            }
        }