Exemplo n.º 1
0
        public override void Enter(Action _action, Track _track)
        {
            if (!GameSettings.AllowRadialBlur)
            {
                return;
            }
            this.cameras = Object.FindObjectsOfType <Camera>();
            if (this.cameras == null)
            {
                return;
            }
            int mask = LayerMask.GetMask(new string[]
            {
                "Scene"
            });

            for (int i = 0; i < this.cameras.Length; i++)
            {
                Camera camera = this.cameras[i];
                if ((camera.cullingMask & mask) != 0)
                {
                    RadialBlur radialBlur = camera.GetComponent <RadialBlur>();
                    if (radialBlur == null)
                    {
                        radialBlur = camera.gameObject.AddComponent <RadialBlur>();
                    }
                    radialBlur.blurScale  = this.blurScale;
                    radialBlur.falloffExp = this.falloffExp;
                    radialBlur.UpdateParameters();
                }
            }
        }
Exemplo n.º 2
0
        public override void Leave(Action _action, Track _track)
        {
            if (this.cameras == null)
            {
                return;
            }
            int mask = LayerMask.GetMask(new string[]
            {
                "Scene"
            });

            for (int i = 0; i < this.cameras.Length; i++)
            {
                Camera camera = this.cameras[i];
                if (!(camera == null) && (camera.cullingMask & mask) != 0)
                {
                    RadialBlur component = camera.GetComponent <RadialBlur>();
                    if (component)
                    {
                        Object.Destroy(component);
                    }
                }
            }
            this.cameras = null;
        }
Exemplo n.º 3
0
 public override void Enter(Action _action, Track _track)
 {
     if (GameSettings.AllowRadialBlur)
     {
         this.cameras = UnityEngine.Object.FindObjectsOfType <Camera>();
         if (this.cameras != null)
         {
             string[] layerNames = new string[] { "Scene" };
             int      mask       = LayerMask.GetMask(layerNames);
             for (int i = 0; i < this.cameras.Length; i++)
             {
                 Camera camera = this.cameras[i];
                 if ((camera.cullingMask & mask) != 0)
                 {
                     RadialBlur component = camera.GetComponent <RadialBlur>();
                     if (component == null)
                     {
                         component = camera.gameObject.AddComponent <RadialBlur>();
                     }
                     component.blurScale  = this.blurScale;
                     component.falloffExp = this.falloffExp;
                     component.UpdateParameters();
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        //init
        if (cameraShake.camera)
        {
            mainCamera = cameraShake.camera;
        }
        else
        {
            mainCamera = GetComponentInChildren <CinemachineVirtualCamera>();
        }
        noise = mainCamera.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>();

        radialBlurIsOpen   = false;
        motionVectorIsOpen = false;

        PPP = GetComponent <PostProcessVolume>().sharedProfile;
        motionBlurSetting = PPP.GetSetting <MotionBlur>();
        RadialBlurSetting = PPP.GetSetting <RadialBlur>();
        HitEffectSetting  = PPP.GetSetting <Vignette>();
    }
Exemplo n.º 5
0
 static void AddRadialBlur()
 {
     if (UnityEditor.Selection.activeGameObject != null)
     {
         RadialBlur comp = UnityEditor.Selection.activeGameObject.AddComponentIfNoExist <RadialBlur>();
         comp.overlayShader = Shader.Find("Xffect/PP/radial_blur");
         comp.target        = UnityEditor.Selection.activeGameObject.transform;
         EditorUtil.SetDirty(comp);
     }
 }
Exemplo n.º 6
0
 public override void StopEvent()
 {
     foreach (var ca in Camera.allCameras)
     {
         RadialBlur rg = ca.gameObject.GetComponent <RadialBlur>();
         if (rg)
         {
             UnityEngine.Object.Destroy(rg);
         }
     }
 }
Exemplo n.º 7
0
 void Awake()
 {
     Property        = this.GetComponent <shuxing>();
     attnum          = 0;
     CameraEffect    = Camera.main.GetComponent <RadialBlur>();
     touji           = Camera.main.GetComponent <toujicamera>();
     player          = this.transform.parent.gameObject;
     mymotor         = this.transform.parent.GetComponent <RPGMotor>();
     myAnimator      = GetComponent <Animator>();
     cameraTransform = Camera.main.transform;
     myCapCollider   = GetComponent <CapsuleCollider>();
 }
Exemplo n.º 8
0
    void Start()
    {
        pm = GetComponent <PlayerMovement>();
        pv = GetComponent <PlayerVitals>();
        empRestorationLabel = GeneralVariables.uiController.empRecalibrate;
        rBlur = GeneralVariables.uiController.guiCamera.GetComponent <RadialBlur>();
        audioSource.volume = 0f;

        if (sunShafts != null)
        {
            camTransform = sunShafts.transform;
        }
    }
Exemplo n.º 9
0
    // Called when the owning graph starts playing
    public override void OnGraphStart(Playable playable)
    {
        PostProcessLayer postLayer = null;

        if (Camera.main != null)
        {
            postLayer = Camera.main.gameObject.GetComponentInChildren <PostProcessLayer>();
        }

        if (postLayer == null)
        {
            var allCam = Camera.allCameras;
            foreach (var cam in allCam)
            {
                var pl = cam.gameObject.GetComponentInChildren <PostProcessLayer>();
                if (pl != null)
                {
                    postLayer = pl;
                    break;
                }
            }
        }

        if (postLayer == null)
        {
            return;
        }


        PostProcessVolume  volume  = PostProcessManager.instance.GetHighestPriorityVolume(postLayer);
        PostProcessProfile profile = volume.sharedProfile;

        if (profile == null)
        {
            return;
        }

        blurCtrl = profile.GetSetting <RadialBlur>();
        if (blurCtrl == null)
        {
            blurCtrl = profile.AddSettings <RadialBlur>();
        }

        blurCtrl.enabled.value            = true;
        blurCtrl.center.value             = this.blurCenter;
        blurCtrl.center.overrideState     = true;
        blurCtrl.centerSize.value         = this.centerSize;
        blurCtrl.centerSize.overrideState = true;
        blurCtrl.blurSize.value           = this.blurSizeCur.Evaluate(0f);
        blurCtrl.blurSize.overrideState   = true;
    }
Exemplo n.º 10
0
    // Use this for initialization
    void Awake()
    {
        _Instance             = this;
        IsActiveCamOtherPoint = false;
        mCamTran                 = camera.transform;
        RadialBlurScript         = GetComponent <RadialBlur>();
        RadialBlurScript.enabled = false;

        //CreateAudioSoureFengXue();
        BlurScript         = GetComponent <MotionBlur>();
        BlurScript.enabled = false;

        InitSetPlayerSpeedRadialBlur();
        //InvokeRepeating("TestCamShake", 3f, 3f);
    }
Exemplo n.º 11
0
    // Start is called before the first frame update
    void Start()
    {
        trans        = transform;
        lastPosition = newPosition = trans.position;

        //获取对象及子对象中的所有渲染器(MeshRenderer或者SkinnedMeshRenderer)
        var renderers = trans.GetComponentsInChildren <Renderer> ();

        //获取所有的材质球(针对有些对象有多个部件多个材质的情况)
        mats = new Material[renderers.Length];
        for (int i = 0; i < renderers.Length; i++)
        {
            mats[i] = renderers[i].sharedMaterial;
        }
        radialBlur = mainCamera.GetComponent <RadialBlur>();
    }
Exemplo n.º 12
0
 public override bool Enter(CameraControll owner)
 {
     base.Enter(owner);
     if (rb && rb.enabled)
     {
         return(true);
     }
     if (!rb)
     {
         rb = owner.gameObject.AddComponent <RadialBlur>();
     }
     rb.enabled   = true;
     rb.Intensity = value;
     isdone       = true;
     return(true);
 }
Exemplo n.º 13
0
    public IEnumerator DoRadialBlur()
    {
        RadialBlur radialBlur = tpsCam.GetComponent <RadialBlur>();

        float blurStrength = 0;

        float toggle   = 0;
        float interval = 0.01f;

        radialBlur.enabled = true;

        radialBlur.blurStrength = blurStrength;
        radialBlur.blurCenter   = radialBlurCenter;

        while (toggle < interval)
        {
            toggle                 += Time.deltaTime;
            blurStrength            = Mathf.Lerp(blurStrength, maxBlurStrength, toggle / interval);
            radialBlur.blurStrength = blurStrength;
            radialBlur.blurCenter   = radialBlurCenter;
            yield return(new WaitForEndOfFrame());
        }
        blurStrength = maxRadialBlurStrength;

        yield return(new WaitForSeconds(radialBlurTime));

        toggle   = 0;
        interval = 0.5f;
        while (toggle < interval)
        {
            toggle                 += Time.deltaTime;
            blurStrength            = Mathf.Lerp(blurStrength, 0, toggle / interval);
            radialBlur.blurStrength = blurStrength;
            radialBlur.blurCenter   = radialBlurCenter;
            yield return(new WaitForEndOfFrame());
        }

        blurStrength = 0;

        radialBlur.blurStrength = blurStrength;
        radialBlur.blurCenter   = radialBlurCenter;

        radialBlur.enabled = false;

        radialBlurActive = false;
    }
Exemplo n.º 14
0
    public void PlayRadialBlur(float strength, Transform t, float duration, Vector3 offset, float beginSmooth, float endSmooth)
    {
        GameObject go       = GameObjectPool.GetPool(GameObjectPool.enPool.Fx).GetImmediately("fx_camera_blur_internal", false);
        CameraFx   cameraFx = go.GetComponent <CameraFx>();


        CameraAni cameraAni = cameraFx.m_anis[0];

        cameraAni.m_endFloat      = strength;
        cameraAni.m_beginDuration = beginSmooth;
        cameraAni.m_endDuration   = endSmooth;

        RadialBlur blur = go.GetComponent <RadialBlur>();

        blur.target = t;
        blur.offset = offset;

        go.SetActive(true);
        FxDestroy.Add(go, duration);
    }
Exemplo n.º 15
0
 public override void Leave(Action _action, Track _track)
 {
     if (this.cameras != null)
     {
         string[] layerNames = new string[] { "Scene" };
         int      mask       = LayerMask.GetMask(layerNames);
         for (int i = 0; i < this.cameras.Length; i++)
         {
             Camera camera = this.cameras[i];
             if ((camera != null) && ((camera.cullingMask & mask) != 0))
             {
                 RadialBlur component = camera.GetComponent <RadialBlur>();
                 if (component != null)
                 {
                     UnityEngine.Object.Destroy(component);
                 }
             }
         }
         this.cameras = null;
     }
 }
Exemplo n.º 16
0
 void Start()
 {
     _radialBlur = GetComponent <RadialBlur>();
 }
Exemplo n.º 17
0
 void OnDestroy()
 {
     instance = null;
 }
Exemplo n.º 18
0
 void Awake()
 {
     instance = this;
     enabled  = false;
 }
Exemplo n.º 19
0
 public RadialBlurSample(Microsoft.Xna.Framework.Game game)
     : base(game)
 {
     _radialBlur = new RadialBlur(GraphicsService);
     GraphicsScreen.PostProcessors.Add(_radialBlur);
 }