Beispiel #1
0
    //-----------------------------------------------------//

    //called after cut a fruit
    public void GetParticle(particleType _particleType, Vector3 pos, Quaternion rot)
    {
        string         particlType = _particleType.ToString();
        ParticleSystem particle    = SplashParticleDict[particlType].Dequeue();

        //ParticleSystem SlashParticle = SlashParticles.Dequeue();

        particle.transform.localPosition = pos;
        particle.transform.rotation      = rot;
        // SlashParticle.transform.localPosition = pos;
        //  SlashParticle.transform.rotation = rot;

        particle.Play();
        //  SlashParticle.Play();

        SplashParticleDict[particlType].Enqueue(particle);
        //   SlashParticles.Enqueue(SlashParticle);

        if (_particleType == particleType.Ice)
        {
            FrostEffect = StartCoroutine(IceCameraEffect());
        }
        else if (_particleType == particleType.Explosion)
        {
            ResetPool();
            StartGameInPool(2f);
        }
    }
Beispiel #2
0
 public emmitter(Vector2 Position, Vector2 Target, Vector2 max, Vector2 min, Texture2D[] Textures, bool Cycle, int Life, float Friction, bool Grow, bool Shrink, bool Fade, int size_max, int size_inital, particleType Type)
 {
     position = Position;
     direction = Target; // target
     randMax = max;
     randMin = min;
     textures = Textures;
     nextTex = 0;
     sizeInit = size_inital;
     sizeMax = size_max; //-1 being texture size
     life = Life;
     friction = Friction;
     grow = Grow;
     shrink = Shrink;
     fade = Fade;
     cycle = Cycle;
     type = Type;
 }
Beispiel #3
0
 public emmitter(Vector2 Position, Texture2D[] Textures, int Life, particleType Type)
 {
     position = Position;
     direction = position;
     randMax = Vector2.One;
     randMin = -Vector2.One;
     textures = Textures;
     nextTex = 0;
     sizeInit = -1;
     sizeMax = -1; //-1 being texture size
     life = Life;
     friction = 0;
     grow = false;
     shrink = false;
     fade = false;
     cycle = false;
     type = Type;
 }
Beispiel #4
0
        public static void particle_create(Vector3 pos, Vector3 velo, Texture2D tex, float friction, int sizeInit, int sizeMax, int life, bool Grow, bool Shrink, bool Fade, particleType ptype)
        {
            particle New = new particle(pos, velo, tex, friction, sizeInit, sizeMax, life, Grow, Shrink, Fade, ptype);

            if(particles != null && particles.Length !=0)
            {
                particle[] old = particles;
                particles = new particle[old.Length + 1];

                for (int i = 0; i != old.Length; i++)
                {
                    particles[i] = old[i];
                }
                particles[old.Length] = New;
            }
            else
            {
                particles = new particle[1];
                particles[0] = New;
            }
        }
Beispiel #5
0
        public static void emmitter_create(Vector2 Position, Vector2 Target, Vector2 max, Vector2 min, Texture2D[] Textures, bool Cycle, int Life, float friction, bool Grow, bool Shrink, bool Fade, int size_max, int size_inital, particleType Type)
        {
            emmitter New = new emmitter(Position, Target, max, min, Textures, Cycle, Life, friction, Grow, Shrink, Fade, size_max, size_inital, Type);

            try
            {
                emmitter[] old = emmitters;
                emmitters = new emmitter[old.Length + 1];

                for (int i = 0; i != old.Length; i++)
                {
                    emmitters[i] = old[i];
                }
                emmitters[old.Length] = New;
            }
            catch
            {
                emmitters = new emmitter[1];
                emmitters[0] = New;
            }
        }
Beispiel #6
0
 public particle(Vector3 pos, Vector3 velo, Texture2D tex, float Friction, float SideInit, float MaxInit, int Life, bool Grow, bool Shrink, bool Fade, particleType Type)
 {
     position = pos;
     Velocity = velo;
     texture = tex;
     friction = Friction;
     size_init = SideInit;
     size_final = MaxInit;
     life = Life;              //-1 makes live forever
     grow = Grow;
     shrink = Shrink;
     fade = Fade;
     type = Type;
     lived = 0;
     size_current = size_init;
     angle = angular_velo = 0;
 }
Beispiel #7
0
 public particle(Vector3 pos, Vector3 velo, Texture2D tex, particleType Type)
 {
     type = Type;
     position = pos;
     Velocity = velo;
     texture = tex;
     friction = 0f;
     size_init = tex.Width;
     size_final = size_init;
     life = -1;              //-1 makes live forever
     grow = false;
     shrink = false;
     fade = false;
     angle = angular_velo = 0;
     lived = 0;
     size_current = size_init;
 }
Beispiel #8
0
 public void GimmeParticles(particleType type, Vector3 particlePos)
 {
     transforms[(int)type].position = particlePos;
     particlesForInit[(int)type].Play();
 }