Esempio n. 1
0
    public void MPUpdate()
    {
        if (Time.deltaTime == 0.0f)
        {
            return;
        }
        Matrix4x4 mat = transform.localToWorldMatrix;

        switch (shape)
        {
        case Shape.Sphere:
            MPAPI.mpScatterParticlesSphereTransform(ref mat, emitCount, ref velosityBase, velosityDiffuse);
            break;

        case Shape.Box:
            MPAPI.mpScatterParticlesBoxTransform(ref mat, emitCount, ref velosityBase, velosityDiffuse);
            break;
        }
    }
Esempio n. 2
0
    public void MPUpdate()
    {
        if (m_emit_count_prev != m_emit_count)
        {
            m_emit_count_prev = m_emit_count;
            m_total_emit      = Mathf.FloorToInt(m_local_time * m_emit_count);
        }
        m_local_time += Time.deltaTime;
        int emit_total      = Mathf.FloorToInt(m_local_time * m_emit_count);
        int emit_this_frame = emit_total - m_total_emit;

        if (emit_this_frame == 0)
        {
            return;
        }
        m_total_emit = emit_total;

        m_params.velocity = m_velosity_base;
        m_params.velocity_random_diffuse = m_velosity_random_diffuse;
        m_params.lifetime = m_lifetime;
        m_params.lifetime_random_diffuse = m_lifetime_random_diffuse;
        m_params.userdata = m_userdata;
        m_params.handler  = m_spawn_handler;
        Matrix4x4 mat = transform.localToWorldMatrix;

        switch (m_shape)
        {
        case Shape.Sphere:
            EachTargets((w) =>
            {
                MPAPI.mpScatterParticlesSphereTransform(w.GetContext(), ref mat, emit_this_frame, ref m_params);
            });
            break;

        case Shape.Box:
            EachTargets((w) =>
            {
                MPAPI.mpScatterParticlesBoxTransform(w.GetContext(), ref mat, emit_this_frame, ref m_params);
            });
            break;
        }
    }