Пример #1
0
        public override void OnEnter()
        {
base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            Color = CCColor3B.Black;
            RemoveChild(Background, true);
            Background = null;

            batchNode = new CCParticleBatchNode("Images/stars-grayscale", 3000);

            AddChild(batchNode, 1, 2);


            for (int i = 0; i < 3; i++)
            {
                var particleSystem = new CCParticleSystemQuad(200, CCEmitterMode.Radius);
                particleSystem.Texture = (batchNode.Texture);

                // duration
                particleSystem.Duration = CCParticleSystem.ParticleDurationInfinity;

                // radius mode: 100 pixels from center
                particleSystem.StartRadius = (100);
                particleSystem.StartRadiusVar = (0);
                particleSystem.EndRadius = (CCParticleSystem.ParticleStartRadiusEqualToEndRadius);
                particleSystem.EndRadiusVar = (0); // not used when start == end

                // radius mode: degrees per second
                // 45 * 4 seconds of life = 180 degrees
                particleSystem.RotatePerSecond = (45);
                particleSystem.RotatePerSecondVar = (0);


                // angle
                particleSystem.Angle = (90);
                particleSystem.AngleVar = (0);

                // emitter position
                particleSystem.PositionVar = (CCPoint.Zero);

                // life of particles
                particleSystem.Life = (4);
                particleSystem.LifeVar = (0);

                // spin of particles
                particleSystem.StartSpin = (0);
                particleSystem.StartSpinVar = (0);
                particleSystem.EndSpin = (0);
                particleSystem.EndSpinVar = (0);

                // color of particles
                var color = new float[3] {0, 0, 0};
                color[i] = 1;
                var startColor = new CCColor4F(color[0], color[1], color[2], 1.0f);
                particleSystem.StartColor = (startColor);

                var startColorVar = new CCColor4F(0, 0, 0, 0);
                particleSystem.StartColorVar = (startColorVar);

                CCColor4F endColor = startColor;
                particleSystem.EndColor = (endColor);

                CCColor4F endColorVar = startColorVar;
                particleSystem.EndColorVar = (endColorVar);

                // size, in pixels
                particleSystem.StartSize = (32);
                particleSystem.StartSizeVar = (0);
                particleSystem.EndSize = CCParticleSystem.ParticleStartSizeEqualToEndSize;

                // emits per second
                particleSystem.EmissionRate = (particleSystem.TotalParticles / particleSystem.Life);

                // additive

                particleSystem.Position = (new CCPoint(i * 10 + 120, 200));


                batchNode.AddChild(particleSystem);
                particleSystem.PositionType = CCPositionType.Free;
            }

            Schedule(ReorderSystem, 2.0f);
            Emitter = null;
        }
Пример #2
0
        public override void OnEnter()
        {
base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            Color = CCColor3B.Black;
            RemoveChild(Background, true);
            Background = null;

            //adds the texture inside the plist to the texture cache
            batchNode = new CCParticleBatchNode("Images/fire", 16000);

            AddChild(batchNode, 1, 2);

            for (int i = 0; i < 6; i++)
            {
                CCParticleSystemQuad particleSystem = new CCParticleSystemQuad("Particles/Spiral");
                particleSystem.Texture = batchNode.Texture;

                particleSystem.PositionType = CCPositionType.Grouped;
                particleSystem.TotalParticles = (200);

                particleSystem.Position = (new CCPoint(i * 15 + 100, i * 15 + 100));

                int randZ = CCRandom.Next(100);
                batchNode.AddChild(particleSystem, randZ, -1);
            }

            Schedule(RemoveSystem, 0.5f);
            Emitter = null;
        }
Пример #3
0
        public override void OnEnter()
        {
base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            Color = CCColor3B.Black;
            RemoveChild(Background, true);
            Background = null;

            CCParticleBatchNode batchNode = new CCParticleBatchNode("Images/fire", 3000);

            AddChild(batchNode, 1, 2);

            for (int i = 0; i < 5; i++)
            {
                CCParticleSystemQuad particleSystem = new CCParticleSystemQuad("Particles/SpinningPeas");

                particleSystem.PositionType = CCPositionType.Grouped;
                particleSystem.Position = (new CCPoint(i * 50, i * 50));

                particleSystem.Texture = batchNode.Texture;
                batchNode.AddChild(particleSystem);
            }


            Emitter = null;
        }
Пример #4
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            Color = CCColor3B.Black;
            RemoveChild(Background, true);
            Background = null;

            CCParticleSystemQuad emitter1 = new CCParticleSystemQuad("Particles/LavaFlow");
            emitter1.StartColor = (new CCColor4F(1, 0, 0, 1));
            CCParticleSystemQuad emitter2 = new CCParticleSystemQuad("Particles/LavaFlow");
            emitter2.StartColor = (new CCColor4F(0, 1, 0, 1));
            CCParticleSystemQuad emitter3 = new CCParticleSystemQuad("Particles/LavaFlow");
            emitter3.StartColor = (new CCColor4F(0, 0, 1, 1));

            CCSize s = WindowSize;

            emitter1.Position = (new CCPoint(s.Width / 1.25f, s.Height / 1.25f));
            emitter2.Position = (new CCPoint(s.Width / 2, s.Height / 2));
            emitter3.Position = (new CCPoint(s.Width / 4, s.Height / 4));

            emitter1.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
            emitter2.Texture = emitter1.Texture;
            emitter3.Texture = emitter1.Texture;

            CCParticleBatchNode batch = new CCParticleBatchNode(emitter1.Texture);

            batch.AddChild(emitter1, 0);
            batch.AddChild(emitter2, 0);
            batch.AddChild(emitter3, 0);

            AddChild(batch, 10);
        }
Пример #5
0
        public override void OnEnter()
        {
base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            Color = CCColor3B.Black;
            RemoveChild(Background, true);
            Background = null;

            Emitter = new CCParticleSystemQuad("Particles/LavaFlow");
            Emitter.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
            CCParticleBatchNode batch = new CCParticleBatchNode(Emitter.Texture);

            batch.AddChild(Emitter);

            AddChild(batch, NODE_ZORDER);

            Schedule(SwitchRender, 2.0f);

            CCLayer node = new CCLayer();
            AddChild(node, NODE_ZORDER);

            parent1 = batch;
            parent2 = node;
        }
Пример #6
0
        void ParticleSystemLoaded(CCParticleSystemConfig psConfig)
        {
            label.RemoveFromParent(true);

            CCParticleSystemQuad ignore = new CCParticleSystemQuad (psConfig);

            //ignore.TotalParticles = 200;
            CCNode parent1 = new CCNode ();
            CCParticleBatchNode parent2 = new CCParticleBatchNode (ignore.Texture);

            parent1.ContentSize = new CCSize (300.0f, 300.0f);

            for (int i = 0; i < 2; i++) {
                CCNode parent = (i == 0 ? parent1 : parent2);

                CCParticleSystemQuad emitter1 = new CCParticleSystemQuad (psConfig);
                //emitter1.TotalParticles = 200;
                emitter1.StartColor = (new CCColor4F (1, 0, 0, 1));
                emitter1.BlendAdditive = (false);
                CCParticleSystemQuad emitter2 = new CCParticleSystemQuad (psConfig);
                //emitter2.TotalParticles = 200;
                emitter2.StartColor = (new CCColor4F (0, 1, 0, 1));
                emitter2.BlendAdditive = (false);
                CCParticleSystemQuad emitter3 = new CCParticleSystemQuad (psConfig);
                //emitter3.TotalParticles = 200;
                emitter3.StartColor = (new CCColor4F (0, 0, 1, 1));
                emitter3.BlendAdditive = (false);

                CCSize s = Layer.VisibleBoundsWorldspace.Size;


                int neg = (i == 0 ? 1 : -1);

                emitter1.Position = (new CCPoint (s.Width / 2 - 30, s.Height / 2 + 60 * neg));
                emitter2.Position = (new CCPoint (s.Width / 2, s.Height / 2 + 60 * neg));
                emitter3.Position = (new CCPoint (s.Width / 2 + 30, s.Height / 2 + 60 * neg));

                parent.AddChild (emitter1, 0, 1);
                parent.AddChild (emitter2, 0, 2);
                parent.AddChild (emitter3, 0, 3);

                AddChild (parent, 10, 1000 + i);
            }

            Schedule(ReorderParticles, 1.0f);
        }