Exemplo n.º 1
0
 void Update()
 {
     if (lastSpawnTime + SPAWN_INTERVAL < Time.time)
     {                                                                                                                   // Is it time already for spawning a new particle?
         GameObject     newLiquidParticle = POLIMIGameCollective.ObjectPoolingManager.Instance.GetObject(Particle.name); //Spawn a particle
         Dynam_Particle particleScript    = newLiquidParticle.GetComponent <Dynam_Particle>();                           // Get the particle script
         particleScript.get_rb().AddForce(particleForce);                                                                //Add our custom force
         newLiquidParticle.transform.position = transform.position;                                                      // Relocate to the spawner position
         newLiquidParticle.transform.parent   = particlesParent;                                                         // Add the particle to the parent container
         lastSpawnTime = Time.time;                                                                                      // Register the last spawnTime
     }
 }
Exemplo n.º 2
0
        // TODO: put center particle in constructor and join next methods
        public RB_vert(GameObject part_ref, Vector3 initial_position, Quaternion initial_rotation)
        {
            part_ref.tag = "Player";
            particle     = part_ref;

            part_ref.transform.position = initial_position;
            part_ref.transform.rotation = initial_rotation;

            tr        = particle.GetComponent <Transform> ();
            rigidBody = particle.GetComponent <Rigidbody2D> ();

            particle_script            = particle.GetComponent <Dynam_Particle> ();
            particle_script.m_IsSticky = true;

            to_center = null;
        }