Ejemplo n.º 1
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_nOrder = 0;
            Color = CCTypes.CCBlack;
            RemoveChild(m_background, true);
            m_background = null;

            CCParticleSystemQuad ignore = new CCParticleSystemQuad("Particles/SmallSun");
            //ignore.TotalParticles = 200;
            CCNode parent1 = new CCNode ();
            CCParticleBatchNode parent2 = new CCParticleBatchNode(ignore.Texture);
            ignore.UnscheduleUpdate();

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

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

                CCSize s = CCDirector.SharedDirector.WinSize;

                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);
        }