Exemple #1
0
    private IEnumerator afterLaunch(float clipLength)
    {
        yield return(new WaitForSeconds(clipLength));

        launching = false;
        StoryConstants.Instance.launchDone = true;
        FreeFlyCamera ffc = mainCamera.GetComponent <FreeFlyCamera>();

        ffc._active = true;

        backToMenu.SetActive(true);

        //Display controls
        panelManager.OpenPanel(controlsMenu.GetComponent <Animator>());
        StartCoroutine(removeControls());

        // Restore sky

        Material skyMaterial = sky.GetComponent <MeshRenderer>().material;

        skyMaterial.color = Color.white;

        Animator animator = sky.GetComponent <Animator>();

        animator.SetBool("launch", false);

        sky.SetActive(false);
    }
Exemple #2
0
        void Start()
        {
            m_CameraTransform = m_Camera.transform;
            m_FreeFlyCamera   = m_Camera.GetComponent <FreeFlyCamera>();

            UIStateManager.projectStateChanged += OnProjectStateDataChanged;
        }
Exemple #3
0
    private IEnumerator afterLaunch(float clipLength)
    {
        yield return(new WaitForSeconds(clipLength));

        launching = false;
        StoryConstants.Instance.isDoneL = true;

        //Lock camera in story mode
        FreeFlyCamera ffc = mainCamera.GetComponent <FreeFlyCamera>();

        ffc._active = false;

        StartCoroutine(removeControls());

        Material skyMaterial = sky.GetComponent <MeshRenderer>().material;

        skyMaterial.color = Color.white;

        Animator animator = sky.GetComponent <Animator>();

        animator.SetBool("launch", false);

        sky.SetActive(false);

        float length = beginJourneyAudio.clip.length;

        beginJourneyAudio.Play(0);
        StartCoroutine(startNextPlanet(length, 0));
    }
 void Start()
 {
     m_FPSController         = Instantiate(m_FPSController);
     m_FirstPersonController = m_FPSController.GetComponent <FirstPersonController>();
     m_FirstPersonController.Init(m_LeftJoystick.GetComponentInChildren <JoystickControl>(true));
     m_FreeFlyCamera = m_MainCamera.GetComponent <FreeFlyCamera>();
 }
 private void Start()
 {
     if (mainCamera != null)
     {
         flyComponent  = mainCamera.GetComponent <FreeFlyCamera>();
         flyCamEnabled = false;
     }
 }
 void Start()
 {
     m_FPSController         = Instantiate(m_FPSController);
     m_FirstPersonController = m_FPSController.GetComponent <FirstPersonController>();
     m_FirstPersonController.Init(m_LeftJoystick.GetComponentInChildren <JoystickControl>(true));
     UIStateManager.walkStateChanged += OnWalkStateDataChanged;
     m_FreeFlyCamera = m_MainCamera.GetComponent <FreeFlyCamera>();
 }
Exemple #7
0
    public void BackToMain()
    {
        StoryConstants.Instance.launchDone = false;
        FreeFlyCamera ffc = mainCamera.GetComponent <FreeFlyCamera>();

        ffc._active = false;
        backToMenu.SetActive(false);
        startFade();
    }
Exemple #8
0
        public IEnumerator StreamingPerformanceTest(string modelPath, int loadTimeoutSeconds)
        {
            if (k_IsRunningUnderUtr)
            {
                yield break;
            }

            m_ModelBounds   = default;
            m_IsModelLoaded = default;

            var runWithMovement = true;

            yield return(StartLoadingModel(modelPath, TimeSpan.FromSeconds(loadTimeoutSeconds)));

            var camera = Camera.main;

            if (runWithMovement)
            {
                camera.transform.position = m_ModelBounds.center - new Vector3(0.0f, 0.0f, -m_ModelBounds.extents.z);
                camera.transform.rotation = Quaternion.identity;
            }
            else
            {
                var fitPosition = FreeFlyCamera.CalculateViewFitPosition(m_ModelBounds, 20.0f, 0.75f, camera.fieldOfView, camera.aspect);
                camera.transform.rotation = Quaternion.Euler(fitPosition.rotation);
                camera.transform.position = fitPosition.position;
            }

            var posFromOrigin = new Vector3(0.0f, 0.0f, -Mathf.Max(m_ModelBounds.extents.z, m_ModelBounds.extents.x));
            var yAngle        = 0.0f;

            var bridge = m_ViewerReflectBootstrapper.Bridge;

            bridge.Subscribe <StreamingProgressed>(ctx =>
            {
                m_IsModelLoaded = ctx.Data.NbStreamed >= ctx.Data.Total * 0.99f;
            });

            using (Measure.Frames().Scope())
            {
                while (!m_IsModelLoaded)
                {
                    if (runWithMovement)
                    {
                        yAngle += 1.0f;

                        var pos      = Quaternion.Euler(0.0f, yAngle, 0.0f) * posFromOrigin * 1.1f;
                        var finalPos = pos + m_ModelBounds.center;

                        camera.transform.position = finalPos;
                        camera.transform.LookAt(m_ModelBounds.center);
                    }

                    yield return(null);
                }
            }
        }
    void Start()
    {
        cameraScript = Camera.main.GetComponent <FreeFlyCamera>();

        if (cameraScript.controllerConnected)
        {
            crosshair.SetActive(true);
            eventSystem = EventSystem.current.GetComponent <EventSystem>();
        }
    }
        void Start()
        {
            m_CameraTransform = m_Camera.transform;
            m_FreeFlyCamera   = m_Camera.GetComponent <FreeFlyCamera>();

            m_TeleportTargetSelector  = UISelectorFactory.createSelector <Vector3>(ProjectContext.current, nameof(ITeleportDataProvider.teleportTarget), OnTeleportTargetChanged);
            m_TeleportPickerSelector  = UISelectorFactory.createSelector <IPicker>(ProjectContext.current, nameof(ITeleportDataProvider.teleportPicker));
            m_WalkModeEnableSelector  = UISelectorFactory.createSelector <bool>(WalkModeContext.current, nameof(IWalkModeDataProvider.walkEnabled));
            m_WalkInstructionSelector = UISelectorFactory.createSelector <IWalkInstructionUI>(WalkModeContext.current, nameof(IWalkModeDataProvider.instruction));
            m_HOLDFilterSelector      = UISelectorFactory.createSelector <bool>(SceneOptionContext.current, nameof(ISceneOptionData <SkyboxData> .filterHlods));
        }
        public Sprite CaptureActiveProjectThumbnail(UIProjectStateData projectStateData)
        {
            if (m_Camera == null || !m_Camera.gameObject.activeInHierarchy)
            {
                m_Camera = Camera.main;
            }

            if (m_Camera != null)
            {
                var thumbnailPositionRotation = FreeFlyCamera.CalculateViewFitPosition(projectStateData.rootBounds, 20.0f, 0.90f, m_Camera.fieldOfView, m_Camera.aspect);
                var thumbnailTexture          = CaptureCameraFrame(
                    m_Camera,
                    k_ThumbnailDimension, k_ThumbnailDimension,
                    thumbnailPositionRotation,
                    m_ThumbnailMask);

                var imageData = thumbnailTexture.EncodeToPNG();
                var path      = GetProjectThumbnailSavePath(m_ActiveProjectGetter.GetValue());
                File.WriteAllBytes(path, imageData);
                return(Sprite.Create(thumbnailTexture, new Rect(0, 0, thumbnailTexture.width, thumbnailTexture.height), new Vector2(0.5f, 0.5f), 100.0f));
            }
            return(null);
        }
        public Sprite CaptureActiveProjectThumbnail(UIProjectStateData projectStateData)
        {
            if (m_Camera == null || !m_Camera.gameObject.activeInHierarchy)
            {
                m_Camera = Camera.main;
            }

            if (m_Camera != null)
            {
                var thumbnailPositionRotation = FreeFlyCamera.CalculateViewFitPosition(projectStateData.rootBounds, 20.0f, 0.75f, m_Camera.fieldOfView);
                var thumbnailTexture          = CaptureCameraFrame(
                    m_Camera,
                    k_ThumbnailDimension, k_ThumbnailDimension,
                    thumbnailPositionRotation,
                    m_ThumbnailMask,
                    m_CameraFeaturesToDisable); // There are some issue with SSAO, needs to disable it before Rendering or everything comes black

                var imageData = thumbnailTexture.EncodeToPNG();
                var path      = GetProjectThumbnailSavePath(projectStateData.activeProject);
                File.WriteAllBytes(path, imageData);
                return(Sprite.Create(thumbnailTexture, new Rect(0, 0, thumbnailTexture.width, thumbnailTexture.height), new Vector2(0.5f, 0.5f), 100.0f));
            }
            return(null);
        }
Exemple #13
0
 // Start is called before the first frame update
 void Start()
 {
     _freeFlyCamera         = GetComponent <FreeFlyCamera>();
     _freeFlyCamera.enabled = false;
 }
 private void Awake()
 {
     m_flyController      = GetComponent <FreeFlyCamera>();
     m_teleportableObject = GetComponent <TeleportableObject>();
 }