Esempio n. 1
0
        void Start()
        {
            p11          = this.gameObject.GetComponent <ParticleSystem>();
            p11Transform = this.gameObject.transform;

            if (ParticlePOOL != null)
            {
                Propagator = ParticlePOOL.GetComponent(typeof(ParticlePropagationSKYMASTER)) as ParticlePropagationSKYMASTER;
            }

            collisionEvents = new ParticleCollisionEvent[1][];

            if (Gameobj_instances != null)
            {
                Gameobj_instances.Clear();
            }

            systems_To_override = new List <ParticlePropagationSKYMASTER>();

            if (Systems_To_override != null)
            {
                if (Systems_To_override.Count > 0)
                {
                    for (int i = 0; i < Systems_To_override.Count; i++)
                    {
                        systems_To_override.Add(Systems_To_override[i].GetComponent(typeof(ParticlePropagationSKYMASTER)) as ParticlePropagationSKYMASTER);
                    }
                }
            }
        }
Esempio n. 2
0
        public float cut_off_dist = 0.1f;                                //max distance to check other system for painted positions

        void Update()
        {
            //particle-particle collision
            if (inner_particle_collision)
            {
                if (p11 == null)
                {
                    p11          = this.gameObject.GetComponent <ParticleSystem>();
                    p11Transform = this.gameObject.transform;
                }

                ParticleList = new ParticleSystem.Particle[p11.particleCount];
                p11.GetParticles(ParticleList);

                int counter = 0;
                for (int i = 0; i < ParticleList.Length; i = i + divide_factor)
                {
                    //emit colliders until reach max
                    if (Gameobj_instances.Count < (ParticleList.Length / divide_factor))
                    {
                        GameObject TEMP = Instantiate(Collider_OBJ, ParticleList[i].position, Quaternion.identity) as GameObject;

                        Gameobj_instances.Add(TEMP);
                        TEMP.transform.position = ParticleList[i].position;

                        TEMP.transform.parent = this.gameObject.transform;
                    }
                    if (counter < Gameobj_instances.Count)
                    {
                        Gameobj_instances[counter].transform.position = ParticleList[i].position;

                        if (end_of_life)
                        {
                            if (ParticleList[i].remainingLifetime <life_factor_upper *ParticleList[i].startLifetime
                                                                   & ParticleList[i].remainingLifetime> life_factor_lower * ParticleList[i].startLifetime
                                & Vector3.Distance(ParticleList[i].position, p11Transform.position) > min_source_dist
                                & p11.emission.enabled                            //& p11.enableEmission //SMv3.1
                                )
                            {
                                Gameobj_instances[counter].GetComponent <Collider>().enabled = true;
                            }
                            else
                            {
                                Gameobj_instances[counter].GetComponent <Collider>().enabled = false;
                            }
                        }
                    }
                    counter++;
                }
            }
        }