Beispiel #1
0
    /// <summary>Create this particle group in the simulation</summary>
    public void Initialise(LPParticleSystem s)
    {
        sys = s;
        IntPtr shape = GetShape();

        ThingPtr = LPAPIParticleGroups.CreateParticleGroup(sys.GetPtr(), getPartNum(), getGroupNum(), 0f, Strenght, AngularVelocity
                                                           , LinearVelocity.x, LinearVelocity.y
                                                           , shape
                                                           , (int)(_Color.r * 255f), (int)(_Color.g * 255f), (int)(_Color.b * 255f), (int)(_Color.a * 255f)

                                                           , Stride, LifeTime, UserData);
        LPAPIUtility.ReleaseShape(shape);

        if (SubPtrs != null && ParticlesMaterial != null && (ParticlesMaterial.elastic || ParticlesMaterial.spring))
        {
            foreach (IntPtr groupptr in SubPtrs)
            {
                LPAPIParticleGroups.JoinParticleGroups(sys.GetPtr(), ThingPtr, groupptr);
            }
        }
    }
Beispiel #2
0
    protected override void DoSpawn()
    {
        Vector3 diff = getdiff();

        if (!SpawnOnlyOneParticle)
        {
            pg.LinearVelocity = new Vector2(diff.x, diff.y);
            pg.Initialise(lpman.ParticleSystems[pg.ParticleSystemImIn]);


            if (JoinGroups)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    LPAPIParticleGroups.JoinParticleGroups(lpman.ParticleSystems[pg.ParticleSystemImIn].GetPtr()
                                                           , lastgroup, pg.GetPtr());
                }
                lastgroup = pg.GetPtr();
            }
        }
        else
        {
            int mat = 0;
            if (pg.ParticlesMaterial != null)
            {
                mat = pg.ParticlesMaterial.GetInt();
            }

            LPAPIParticles.CreateParticleInSystem(lpman.ParticleSystems[pg.ParticleSystemImIn].GetPtr()
                                                  , mat, transform.position.x, transform.position.y, diff.x, diff.y
                                                  , (int)(pg._Color.r * 255f), (int)(pg._Color.g * 255f), (int)(pg._Color.b * 255f), (int)(pg._Color.a * 255f)
                                                  , pg.LifeTime);
        }
    }