Beispiel #1
0
    private void OnEnable()
    {
        render = (H3DTrailRender)target;

#if UNITY_EDITOR
        if (!EditorApplication.isPlaying)
        {
            //render.InitTrailGO();
            EditorApplication.update += update;
        }
#endif

        m_TrailRender       = new SerializedObject(target);
        m_CastShadows       = m_TrailRender.FindProperty("m_CastShadows");
        m_ReceiveShadows    = m_TrailRender.FindProperty("m_ReceiveShadows");
        m_Time              = m_TrailRender.FindProperty("m_Time");
        m_StartWidth        = m_TrailRender.FindProperty("m_StartWidth");
        m_EndWidth          = m_TrailRender.FindProperty("m_EndWidth");
        m_MinVerDis         = m_TrailRender.FindProperty("m_MinVerDis");
        m_IsAutoDestruct    = m_TrailRender.FindProperty("m_IsAutoDestruct");
        m_IsAlwaysFaceToCam = m_TrailRender.FindProperty("m_IsAlwaysFaceToCam");
        m_RotationAngle     = m_TrailRender.FindProperty("m_RotationAngle");
        m_TrailMaterial     = m_TrailRender.FindProperty("m_TrailMaterial");
        m_Colors            = m_TrailRender.FindProperty("m_Colors");
    }
Beispiel #2
0
    protected override void _Init()
    {
        trailRenderer = GetComponent <H3DTrailRender>();

        if (trailRenderer == null)
        {
            Debug.Log("未成功获取TrailRenderer,检查是否插件绑定错误!");
        }
    }
    private static bool IsSpecialEffectElementLegal(GameObject go)
    {
        if (go == null)
        {
            return(false);
        }

        SpecialEffect spe = go.GetComponent <SpecialEffect>();

        //特效根节点
        if (spe != null)
        {
            return(false);
        }

        SpecialEffectElement speElem = go.GetComponent <SpecialEffectElement>();
        Type elemType = speElem.GetType();

        if (elemType == typeof(SpecialEffectParticleSys))
        {
            ParticleSystem particleSys = go.GetComponent <ParticleSystem>();
            if (particleSys == null)
            {
                return(false);
            }
        }
        else if (elemType == typeof(SpecialEffectAnimation))
        {
            Animation anim = go.GetComponent <Animation>();
            if (anim == null)
            {
                return(false);
            }
        }
        else if (elemType == typeof(SpecialEffectAnimator))
        {
            Animator anim = go.GetComponent <Animator>();
            if (anim == null)
            {
                return(false);
            }
        }
        else if (elemType == typeof(SpecialEffectTrailRenderer))
        {
            H3DTrailRender trail = go.GetComponent <H3DTrailRender>();
            if (trail == null)
            {
                return(false);
            }
        }
        else
        {
            ParticleSystem particleSys = go.GetComponent <ParticleSystem>();
            if (particleSys != null)
            {
                return(false);
            }

            Animation animation = go.GetComponent <Animation>();
            if (animation != null)
            {
                return(false);
            }

            Animator animator = go.GetComponent <Animator>();
            if (animator != null)
            {
                return(false);
            }
        }

        return(true);
    }