Ejemplo n.º 1
0
    public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    {
        var playable = ScriptPlayable <ParticleSystemControlBehaviour> .Create(graph, template);

        ParticleSystemControlBehaviour clone = playable.GetBehaviour();

        return(playable);
    }
Ejemplo n.º 2
0
    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
    {
#if UNITY_EDITOR
        foreach (TimelineClip clip in m_Clips)
        {
            ParticleSystemControlClip mouthClip = clip.asset as ParticleSystemControlClip;
            // the template variable comes from classes made with the playable wizard
            ParticleSystemControlBehaviour behaviour = mouthClip.template;
            // name the track with my variables value
            clip.displayName = go.name;
            clip.duration    = GetParticleDuration(go);
        }
#endif
        ScriptPlayable <ParticleSystemControlMixerBehaviour> playable = ScriptPlayable <ParticleSystemControlMixerBehaviour> .Create(graph, inputCount);

        return(playable);
    }
Ejemplo n.º 3
0
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        if (particleSystem == null)
        {
            if (playerData is GameObject)
            {
                ParticleRoot = ((GameObject)playerData).transform;
            }
            else if (playerData is ParticleSystem)
            {
                ParticleRoot = ((ParticleSystem)playerData).gameObject.transform;
            }
        }

        if (ParticleSys == null)
        {
            return;
        }


        int inputCount = playable.GetInputCount();

        for (int i = 0; i < inputCount; i++)
        {
            ScriptPlayable <ParticleSystemControlBehaviour> playableInput = (ScriptPlayable <ParticleSystemControlBehaviour>)playable.GetInput(i);
            ParticleSystemControlBehaviour input = playableInput.GetBehaviour();

            float inputWeight    = playable.GetInputWeight(i);
            float normalisedTime = (float)(playableInput.GetTime() * input.inverseDuration);

            if (ParticleSys != null)
            {
                for (int j = 0; j < ParticleSys.Length; j++)
                {
                    ParticleSys[j].Simulate(normalisedTime, true, true);
                }
            }
        }
    }