Ejemplo n.º 1
0
        public override void GetDepsFrom(object obj, GetDepsFromContext context)
        {
            base.GetDepsFrom(obj, context);
            if (obj == null)
            {
                return;
            }

            ParticleSystem.SubEmittersModule o = (ParticleSystem.SubEmittersModule)obj;
            for (int i = 0; i < o.subEmittersCount; ++i)
            {
                AddDep(o.GetSubEmitterSystem(i), context);
            }
        }
Ejemplo n.º 2
0
        public static void MulSize(ParticleSystem ps, float scale)
        {
            ParticleSystem.MainModule ps_main = ps.main;
            ps_main.startSize = ScaleCurve(ps_main.startSize, scale);

            ParticleSystem.SubEmittersModule ps_sub = ps.subEmitters;
            if (ps_sub.enabled)
            {
                for (int si = 0; si < ps_sub.subEmittersCount; si++)
                {
                    MulSize(ps_sub.GetSubEmitterSystem(si), scale);
                }
            }
        }
Ejemplo n.º 3
0
 public static void SetSpeed(ParticleSystem ps, float speed)
 {
     ParticleSystem.MainModule main_module = ps.main;
     main_module.simulationSpeed = speed;
     ParticleSystem.SubEmittersModule sub_module = ps.subEmitters;
     if (sub_module.enabled)
     {
         for (int sub_i = 0; sub_i < sub_module.subEmittersCount; sub_i++)
         {
             ParticleSystem sub_sys = sub_module.GetSubEmitterSystem(sub_i);
             SetSpeed(sub_sys, speed);
         }
     }
 }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (!system.isEmitting)
        {
            ParticleSystem.SubEmittersModule sub = system.subEmitters;

            bool done = true;
            for (int i = 0; i < sub.subEmittersCount; i++)
            {
                ParticleSystem subemitter = sub.GetSubEmitterSystem(i);
                done = done && subemitter.isEmitting;
            }

            if (done)
            {
                Destroy(gameObject);
            }
        }
    }
Ejemplo n.º 5
0
        public static void MulExpVel(ParticleSystem ps, float scale, bool self, bool child)
        {
            if (self)
            {
                ParticleSystem.MainModule ps_main = ps.main;
                ps_main.startSpeed = ScaleCurve(ps_main.startSpeed, scale);
            }

            if (child)
            {
                ParticleSystem.SubEmittersModule ps_sub = ps.subEmitters;
                if (ps_sub.enabled)
                {
                    for (int si = 0; si < ps_sub.subEmittersCount; si++)
                    {
                        MulExpVel(ps_sub.GetSubEmitterSystem(si), scale);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public override void ReadFrom(object obj)
        {
            base.ReadFrom(obj);
            if (obj == null)
            {
                return;
            }

            ParticleSystem.SubEmittersModule o = (ParticleSystem.SubEmittersModule)obj;
            m_subSystems         = new long[o.subEmittersCount];
            m_subEmitProbability = new float[o.subEmittersCount];
            m_subProperties      = new ParticleSystemSubEmitterProperties[o.subEmittersCount];
            m_subTypes           = new ParticleSystemSubEmitterType[o.subEmittersCount];
            for (int i = 0; i < o.subEmittersCount; ++i)
            {
                m_subSystems[i]         = ToID(o.GetSubEmitterSystem(i));
                m_subEmitProbability[i] = o.GetSubEmitterEmitProbability(i);
                m_subProperties[i]      = o.GetSubEmitterProperties(i);
                m_subTypes[i]           = o.GetSubEmitterType(i);
            }
        }