Ejemplo n.º 1
0
 static void AddCameraFx()
 {
     if (UnityEditor.Selection.activeGameObject != null)
     {
         CameraFx comp = UnityEditor.Selection.activeGameObject.AddComponentIfNoExist <CameraFx>();
         EditorUtil.SetDirty(comp);
     }
 }
Ejemplo n.º 2
0
    public CameraHandle Add(string name, CameraFx fx)
    {
        CameraHandle handle = new CameraHandle(name, fx, this);
        ShareThing   st     = m_fxs.GetNewIfNo(name);

        st.Add(handle);

        if (!this.enabled)
        {
            this.enabled = true;
        }
        return(handle);
    }
Ejemplo n.º 3
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);
    }
Ejemplo n.º 4
0
    public override void OnInspectorGUI()
    {
        //base.OnInspectorGUI();

        CameraFx fx = target as CameraFx;

        EditorGUI.BeginChangeCheck();


        CameraAni removeAni = null;

        for (int i = 0; i < fx.m_anis.Count; ++i)
        {
            if (DrawAni(fx.m_anis[i], i))
            {
                removeAni = fx.m_anis[i];
            }
        }
        if (removeAni != null)
        {
            fx.m_anis.Remove(removeAni);
        }

        int idx = UnityEditor.EditorGUILayout.Popup("添加渐变", -1, CameraAni.TypeName);

        if (idx != -1)
        {
            CameraAni ani = new CameraAni();
            ani.m_type = (CameraAni.enType)idx;
            fx.m_anis.Add(ani);
        }
        if (EditorGUI.EndChangeCheck())
        {
            //Debuger.Log("修改");
            EditorUtil.SetDirty(fx);
        }
    }
Ejemplo n.º 5
0
 public CameraHandle(string name, CameraFx fx, CameraFxMgr mgr)
 {
     this.fx   = fx;
     this.name = name;
     this.mgr  = mgr;
 }