예제 #1
0
    public SMBParticle ShootParticle()
    {
        SMBParticle inactiveParticle = _particles.GetFreeObject();

        if (inactiveParticle != null)
        {
            float randVel  = Random.Range(_minVel, _maxVel);
            float randAng  = Random.Range(_minAngle, _maxAngle) * Mathf.Deg2Rad;
            float lifetime = Random.Range(_minLifetime, _maxLifetime);

            Vector2 velocity = new Vector2(Mathf.Cos(randAng), Mathf.Sin(randAng)) * randVel;

            inactiveParticle.Shoot(velocity, lifetime, _applyGravity, _gravityFactor, _bounds);
        }

        return(inactiveParticle);
    }
예제 #2
0
 public void KillParticle(SMBParticle particle)
 {
     _particles.SetFreeObject(particle.gameObject);
 }
예제 #3
0
 private void InitParticle(SMBParticle particle)
 {
     particle.Create(this);
 }