Esempio n. 1
0
    private void Start()
    {
        Application.targetFrameRate = 60;

        StartCoroutine(FadeOutTransition());

        // Starting the game from the title/start menu
        m_currentState        = GameState.START;
        m_dialogueWriter      = GetComponent <DialogueWriter>();
        m_audioSource         = GetComponent <AudioSource>();
        m_mainCameraTransform = Camera.main.transform;

        // Initializing everything needed
        // GetComponentsInChildren<CrackArea>(m_allCrackArea);
        m_fixingTool = FindObjectOfType <FixingTool>();

        // Instantiating post process profile to modify it at runtime
        // in case it's not yet fully optimal like described here
        // https://github.com/Unity-Technologies/PostProcessing/wiki/(v1)-Runtime-post-processing-modification
        var postBehavior = FindObjectOfType <UnityEngine.PostProcessing.PostProcessingBehaviour>();

        m_postProfile        = Instantiate(postBehavior.profile);
        postBehavior.profile = m_postProfile;
        //m_postProfile.motionBlur.enabled = false;
    }
Esempio n. 2
0
 private void ShowInventory(bool show)
 {
     InventoryUI.ShowInventory(show);
     ChatUI.HideChat(show);
     UnityEngine.PostProcessing.PostProcessingProfile profile = PlayerCamera.instance.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>().profile;
     profile.depthOfField.enabled = show;
 }
Esempio n. 3
0
    void OnEnable()
    {
        ppb         = GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour> ();
        profile     = Instantiate(ppb.profile);
        ppb.profile = profile;

        ppb.profile.ambientOcclusion.enabled = QualitySettings.GetQualityLevel() > 3;
        ppb.profile.bloom.enabled            = QualitySettings.GetQualityLevel() > 2;
    }
Esempio n. 4
0
    void Start()
    {
        profile = Camera.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>().profile;

        DOFModel = profile.depthOfField;
        CGModel  = profile.colorGrading;

        DOFModel.enabled = false;
        CGModel.enabled  = false;

        DOFsetting = DOFModel.settings;
        CGsetting  = CGModel.settings;
    }
Esempio n. 5
0
    // Use this for initialization
    void Start()
    {
        dl                     = GameObject.FindGameObjectWithTag("DrawListener").GetComponent <DrawListener>();
        cam                    = Camera.main;
        camController          = cam.gameObject.GetComponent <CameraController>();
        nextCheckForDeathPaths = checkForDeadPaths;
        riders.AddRange(GameObject.FindGameObjectsWithTag("Player"));
        postProc     = cam.gameObject.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>();
        deathProfile = (UnityEngine.PostProcessing.PostProcessingProfile)Instantiate(Resources.Load("Profiles/DeathProfile"));

        // Determine camera bounds
        upperXBound = cam.gameObject.transform.position.x + (cam.orthographicSize * Screen.width / Screen.height);
        lowerXBound = cam.gameObject.transform.position.x - (cam.orthographicSize * Screen.width / Screen.height);
        upperYBound = cam.gameObject.transform.position.y + cam.orthographicSize;
        lowerYBound = cam.gameObject.transform.position.y - cam.orthographicSize;
    }
Esempio n. 6
0
 // Use this for initialization
 void Start()
 {
     prof = GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>().profile;
     cam  = GetComponent <Camera>();
 }
Esempio n. 7
0
        void OnPreCull()
        {
            // All the per-frame initialization logic has to be done in OnPreCull instead of Update
            // because [ImageEffectAllowedInSceneView] doesn't trigger Update events...

            if (profile == null)
            {
                return;
            }

            m_Camera = GetComponent <Camera>();

#if UNITY_EDITOR
            // Track the scene view camera to disable some effects we don't want to see in the
            // scene view
            // Currently disabled effects :
            //  - Temporal Antialiasing
            //  - Depth of Field
            //  - Motion blur
            //  - Grain
            m_RenderingInSceneView = UnityEditor.SceneView.currentDrawingSceneView != null &&
                                     UnityEditor.SceneView.currentDrawingSceneView.camera == m_Camera;
#endif

            // Prepare context
            var context = m_Context.Reset();
            context.profile = profile;
            context.renderTextureFactory = m_RenderTextureFactory;
            context.materialFactory      = m_MaterialFactory;
            context.camera = m_Camera;

            // Prepare components
            m_DebugViews.Init(context, profile.debugViews);
            m_AmbientOcclusion.Init(context, profile.ambientOcclusion);
            m_ScreenSpaceReflection.Init(context, profile.screenSpaceReflection);
            m_DepthOfField.Init(context, profile.depthOfField);
            m_MotionBlur.Init(context, profile.motionBlur);
            m_Taa.Init(context, profile.antialiasing);
            m_EyeAdaptation.Init(context, profile.eyeAdaptation);
            m_Bloom.Init(context, profile.bloom);
            m_ChromaticAberration.Init(context, profile.chromaticAberration);
            m_ColorGrading.Init(context, profile.colorGrading);
            m_UserLut.Init(context, profile.userLut);
            m_Grain.Init(context, profile.grain);
            m_Vignette.Init(context, profile.vignette);
            m_Fxaa.Init(context, profile.antialiasing);

            // Handles profile change and 'enable' state observers
            if (m_PreviousProfile != profile)
            {
                DisableComponents();
                m_PreviousProfile = profile;
            }

            CheckObservers();

            // Find out which camera flags are needed before rendering begins
            // Note that motion vectors will only be available one frame after being enabled
            var flags = DepthTextureMode.None;
            foreach (var component in m_Components)
            {
                if (component.active)
                {
                    flags |= component.GetCameraFlags();
                }
            }

            context.camera.depthTextureMode = flags;

            // Temporal antialiasing jittering, needs to happen before culling
#if UNITY_EDITOR
            if (!m_RenderingInSceneView)
#endif
            if (m_Taa.active && !profile.debugViews.willInterrupt)
            {
                m_Taa.SetProjectionMatrix();
            }
        }
 public void ChangePostProcessingProfile(PostProcessingProfile _profile)
 {
     profile = _profile;
 }