Exemple #1
0
    private void oneshot()
    {
        LPRayCastHit[] hits = caster.RaycastWorld();
        if (hits.Length > 0)
        {
            hits = hits.OrderBy(d => d.Fraction).ToArray();



            IntPtr partsysptr       = lpman.ParticleSystems[ParticleSystemImIn].GetPtr();
            IntPtr particlesPointer = LPAPIParticleSystems.GetParticlesInShape(partsysptr
                                                                               , shape, hits[0].Position.x, hits[0].Position.y
                                                                               , transform.rotation.eulerAngles.z);

            int[] particlesArray = new int[1];
            Marshal.Copy(particlesPointer, particlesArray, 0, 1);
            int foundNum = particlesArray[0];


            if (foundNum > 0)
            {
                int[] Indices = new int[foundNum + 1];
                Marshal.Copy(particlesPointer, Indices, 0, foundNum + 1);

                LPAPIParticles.SetSelectedParticleFlags(partsysptr, Indices, DebrisMaterial.GetInt());
                LPAPIParticles.SetSelectedParticleUserData(partsysptr, Indices, 2);
                LPAPIParticles.ExplodeSelectedParticles(partsysptr, Indices, hits[0].Position.x, hits[0].Position.y, ExplosionStrenght);
            }
        }
    }
Exemple #2
0
    void FixedUpdate()
    {
        List <LPSystemPartPartContact> contactslist = sys.GetParticleContacts();
        List <int> indices = new List <int>();

        int acid  = 2;
        int stone = 1;

        foreach (var contact in contactslist)
        {
            if (contact.ParticleAUserData == acid && contact.ParticleBUserData == stone)
            {
                if (!indices.Contains(contact.ParticleBIndex))
                {
                    indices.Add(contact.ParticleBIndex);
                }
            }
        }

        if (indices.Count > 0)
        {
            indices.Insert(0, indices.Count);
            LPAPIParticles.SetSelectedParticleFlags(sys.GetPtr(), indices.ToArray(), sludge.GetInt());
            LPAPIParticles.SetSelectedParticleUserData(sys.GetPtr(), indices.ToArray(), 0);
        }
    }
Exemple #3
0
    private void oneshot2(Vector3 pos)
    {
        IntPtr partsysptr       = lpman.ParticleSystems[ParticleSystemImIn].GetPtr();
        IntPtr particlesPointer = LPAPIParticleSystems.GetParticlesInShape(partsysptr
                                                                           , shape, pos.x, pos.y
                                                                           , transform.rotation.eulerAngles.z);

        int[] particlesArray = new int[1];
        Marshal.Copy(particlesPointer, particlesArray, 0, 1);
        int foundNum = particlesArray[0];


        if (foundNum > 0)
        {
            int[] Indices = new int[foundNum + 1];
            Marshal.Copy(particlesPointer, Indices, 0, foundNum + 1);

            LPAPIParticles.SetSelectedParticleFlags(partsysptr, Indices, DebrisMaterial.GetInt());
            LPAPIParticles.SetSelectedParticleUserData(partsysptr, Indices, 2);
            LPAPIParticles.ExplodeSelectedParticles(partsysptr, Indices, pos.x, pos.y, ExplosionStrenght);
        }
    }
Exemple #4
0
    void FixedUpdate()
    {
        List <LPSystemPartPartContact> contactslist = sys.GetParticleContacts();
        List <int> indices    = new List <int>();
        List <int> delindices = new List <int>();

        int water = 2;
        int lava  = 1;

        foreach (var contact in contactslist)
        {
            if (contact.ParticleAUserData == water && contact.ParticleBUserData == lava)
            {
                if (!indices.Contains(contact.ParticleBIndex))
                {
                    indices.Add(contact.ParticleBIndex);
                }
                if (!delindices.Contains(contact.ParticleAIndex))
                {
                    delindices.Add(contact.ParticleAIndex);
                }
            }
        }

        if (indices.Count > 0)
        {
            indices.Insert(0, indices.Count);
            LPAPIParticles.SetSelectedParticleFlags(sys.GetPtr(), indices.ToArray(), wall.GetInt());
            LPAPIParticles.SetSelectedParticleColor(sys.GetPtr(), indices.ToArray(), 100, 100, 100, 255);
            LPAPIParticles.SetSelectedParticleUserData(sys.GetPtr(), indices.ToArray(), 0);
        }

        if (indices.Count > 0)
        {
            delindices.Insert(0, delindices.Count);
            LPAPIParticles.SetSelectedParticleFlags(sys.GetPtr(), delindices.ToArray(), zombie.GetInt());
        }
    }