Пример #1
0
        public override void doTest()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;
            CCParticleSystem particleSystem = (CCParticleSystem)GetChildByTag(PerformanceParticleTest.kTagParticleSystem);

            // duration
            particleSystem.Duration = -1;

            // gravity
            particleSystem.Gravity = (new CCPoint(0, -90));

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

            // radial
            particleSystem.RadialAccel = (0);
            particleSystem.RadialAccelVar = (0);

            // speed of particles
            particleSystem.Speed = (180);
            particleSystem.SpeedVar = (50);

            // emitter position
            particleSystem.Position = new CCPoint(s.Width / 2, 100);
            particleSystem.PosVar = new CCPoint(s.Width / 2, 0);

            // life of particles
            particleSystem.Life = 2.0f;
            particleSystem.LifeVar = 1;

            // emits per frame
            particleSystem.EmissionRate = particleSystem.TotalParticles / particleSystem.Life;

            // color of particles
            CCColor4F startColor = new CCColor4F { R = 0.5f, G = 0.5f, B = 0.5f, A = 1.0f };
            particleSystem.StartColor = startColor;

            CCColor4F startColorVar = new CCColor4F { R = 0.5f, G = 0.5f, B = 0.5f, A = 1.0f };
            particleSystem.StartColorVar = startColorVar;

            CCColor4F endColor = new CCColor4F { R = 0.1f, G = 0.1f, B = 0.1f, A = 0.2f };
            particleSystem.EndColor = endColor;

            CCColor4F endColorVar = new CCColor4F { R = 0.1f, G = 0.1f, B = 0.1f, A = 0.2f };
            particleSystem.EndColorVar = endColorVar;

            // size, in pixels
            particleSystem.EndSize = 64.0f;
            particleSystem.StartSize = 64.0f;
            particleSystem.EndSizeVar = 0;
            particleSystem.StartSizeVar = 0;

            // additive
            particleSystem.BlendAdditive = false;
        }
Пример #2
0
        protected virtual CCColor4F[] ParsePropTypeColor4FVar(CCNode node, CCNode parent, CCBReader reader)
        {
            float red = reader.ReadFloat();
            float green = reader.ReadFloat();
            float blue = reader.ReadFloat();
            float alpha = reader.ReadFloat();
            float redVar = reader.ReadFloat();
            float greenVar = reader.ReadFloat();
            float blueVar = reader.ReadFloat();
            float alphaVar = reader.ReadFloat();

            var colors = new CCColor4F[2];
            colors[0].R = red;
            colors[0].G = green;
            colors[0].B = blue;
            colors[0].A = alpha;

            colors[1].R = redVar;
            colors[1].G = greenVar;
            colors[1].B = blueVar;
            colors[1].A = alphaVar;

            return colors;
        }
Пример #3
0
 protected virtual void OnHandlePropTypeColor4FVar(CCNode node, CCNode parent, string propertyName, CCColor4F[] colorVar,
                                                   CCBReader reader)
 {
     CCLog.Log("Unexpected property type: '{0}'!", propertyName);
     Debug.Assert(false);
 }
Пример #4
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_emitter = new CCParticleSystemQuad();
            m_emitter.InitWithTotalParticles(50);
            //m_emitter.autorelease();

            m_background.AddChild(m_emitter, 10);
            ////m_emitter.release();	// win32 :  use this line or remove this line and use autorelease()
            m_emitter.Texture = CCTextureCache.SharedTextureCache.AddImage(TestResource.s_stars1);

            m_emitter.Duration = -1;

            // gravity
            m_emitter.Gravity = (new CCPoint(0, 0));

            // angle
            m_emitter.Angle = 90;
            m_emitter.AngleVar = 360;

            // speed of particles
            m_emitter.Speed = (160);
            m_emitter.SpeedVar = (20);

            // radial
            m_emitter.RadialAccel = (-120);
            m_emitter.RadialAccelVar = (0);

            // tagential
            m_emitter.TangentialAccel = (30);
            m_emitter.TangentialAccelVar = (0);

            // emitter position
            m_emitter.Position = new CCPoint(160, 240);
            m_emitter.PosVar = new CCPoint(0, 0);

            // life of particles
            m_emitter.Life = 4;
            m_emitter.LifeVar = 1;

            // spin of particles
            m_emitter.StartSpin = 0;
            m_emitter.StartSizeVar = 0;
            m_emitter.EndSpin = 0;
            m_emitter.EndSpinVar = 0;

            // color of particles
            var startColor = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f);
            m_emitter.StartColor = startColor;

            var startColorVar = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f);
            m_emitter.StartColorVar = startColorVar;

            var endColor = new CCColor4F(0.1f, 0.1f, 0.1f, 0.2f);
            m_emitter.EndColor = endColor;

            var endColorVar = new CCColor4F(0.1f, 0.1f, 0.1f, 0.2f);
            m_emitter.EndColorVar = endColorVar;

            // size, in pixels
            m_emitter.StartSize = 80.0f;
            m_emitter.StartSizeVar = 40.0f;
            m_emitter.EndSize = CCParticleSystem.kParticleStartSizeEqualToEndSize;

            // emits per second
            m_emitter.EmissionRate = m_emitter.TotalParticles / m_emitter.Life;

            // additive
            m_emitter.BlendAdditive = true;

            setEmitterPosition();
        }
Пример #5
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_emitter = new CCParticleSystemQuad();
            m_emitter.InitWithTotalParticles(1000);
            //m_emitter.autorelease();

            m_background.AddChild(m_emitter, 10);
            ////m_emitter.release();

            CCSize s = CCDirector.SharedDirector.WinSize;

            // duration
            m_emitter.Duration = -1;

            // gravity
            m_emitter.Gravity = (new CCPoint(0, 0));

            // angle
            m_emitter.Angle = 0;
            m_emitter.AngleVar = 360;

            // radial
            m_emitter.RadialAccel = (70);
            m_emitter.RadialAccelVar = (10);

            // tagential
            m_emitter.TangentialAccel = (80);
            m_emitter.TangentialAccelVar = (0);

            // speed of particles
            m_emitter.Speed = (50);
            m_emitter.SpeedVar = (10);

            // emitter position
            m_emitter.Position = new CCPoint(s.Width / 2, s.Height / 2);
            m_emitter.PosVar = new CCPoint(0, 0);

            // life of particles
            m_emitter.Life = 2.0f;
            m_emitter.LifeVar = 0.3f;

            // emits per frame
            m_emitter.EmissionRate = m_emitter.TotalParticles / m_emitter.Life;

            // color of particles
            var startColor = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f);
            m_emitter.StartColor = startColor;

            var startColorVar = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f);
            m_emitter.StartColorVar = startColorVar;

            var endColor = new CCColor4F(0.1f, 0.1f, 0.1f, 0.2f);
            m_emitter.EndColor = endColor;

            var endColorVar = new CCColor4F(0.1f, 0.1f, 0.1f, 0.2f);
            m_emitter.EndColorVar = endColorVar;

            // size, in pixels
            m_emitter.StartSize = 1.0f;
            m_emitter.StartSizeVar = 1.0f;
            m_emitter.EndSize = 32.0f;
            m_emitter.EndSizeVar = 8.0f;

            // texture
            m_emitter.Texture = CCTextureCache.SharedTextureCache.AddImage(TestResource.s_fire);

            // additive
            m_emitter.BlendAdditive = false;

            setEmitterPosition();
        }
Пример #6
0
        public override void OnEnter()
        {
            base.OnEnter();

            Color = new CCColor3B(0, 0, 0);
            RemoveChild(m_background, true);
            m_background = null;

            m_emitter = new CCParticleSystemQuad();
            m_emitter.InitWithTotalParticles(100);
            AddChild(m_emitter, 10);
            m_emitter.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");

            // duration
            m_emitter.Duration = CCParticleSystem.kCCParticleDurationInfinity;

            // radius mode
            m_emitter.EmitterMode = CCEmitterMode.kCCParticleModeRadius;

            // radius mode: start and end radius in pixels
            m_emitter.StartRadius = (50);
            m_emitter.StartRadiusVar = (0);
            m_emitter.EndRadius = (CCParticleSystem.kCCParticleStartRadiusEqualToEndRadius);
            m_emitter.EndRadiusVar = (0);

            // radius mode: degrees per second
            m_emitter.RotatePerSecond = (0);
            m_emitter.RotatePerSecondVar = (0);

            // angle
            m_emitter.Angle = 90;
            m_emitter.AngleVar = 0;

            // emitter position
            CCSize size = CCDirector.SharedDirector.WinSize;
            m_emitter.Position = new CCPoint(size.Width / 2, size.Height / 2);
            m_emitter.PosVar = new CCPoint(0, 0);

            // life of particles
            m_emitter.Life = 5;
            m_emitter.LifeVar = 0;

            // spin of particles
            m_emitter.StartSpin = 0;
            m_emitter.StartSpinVar = 0;
            m_emitter.EndSpin = 0;
            m_emitter.EndSpinVar = 0;

            // color of particles
            var startColor = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f);
            m_emitter.StartColor = startColor;

            var startColorVar = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f);
            m_emitter.StartColorVar = startColorVar;

            var endColor = new CCColor4F(0.1f, 0.1f, 0.1f, 0.2f);
            m_emitter.EndColor = endColor;

            var endColorVar = new CCColor4F(0.1f, 0.1f, 0.1f, 0.2f);
            m_emitter.EndColorVar = endColorVar;

            // size, in pixels
            m_emitter.StartSize = 16;
            m_emitter.StartSizeVar = 0;
            m_emitter.EndSize = CCParticleSystem.kCCParticleStartSizeEqualToEndSize;

            // emits per second
            m_emitter.EmissionRate = m_emitter.TotalParticles / m_emitter.Life;

            // additive
            m_emitter.BlendAdditive = false;

            CCRotateBy rot = new CCRotateBy (16, 360);
            m_emitter.RunAction(new CCRepeatForever (rot));
        }
Пример #7
0
 public CCV2F_C4F_T2F()
 {
     Vertices = new CCVertex2F();
     Colors = new CCColor4F();
     TexCoords = new CCTex2F();
 }
Пример #8
0
        public override void OnEnter()
        {
            base.OnEnter();

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

            m_pBatchNode = CCParticleBatchNode.Create("Images/stars-grayscale", 3000);

            AddChild(m_pBatchNode, 1, 2);

            for (int i = 0; i < 3; i++)
            {
                var particleSystem = new CCParticleSystemQuad();
                particleSystem.InitWithTotalParticles(200);
                particleSystem.Texture = (m_pBatchNode.Texture);

                // duration
                particleSystem.Duration = CCParticleSystem.kCCParticleDurationInfinity;

                // radius mode
                particleSystem.EmitterMode = CCEmitterMode.kCCParticleModeRadius;

                // radius mode: 100 pixels from center
                particleSystem.StartRadius = (100);
                particleSystem.StartRadiusVar = (0);
                particleSystem.EndRadius = (CCParticleSystem.kCCParticleStartRadiusEqualToEndRadius);
                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.PosVar = (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.kCCParticleStartSizeEqualToEndSize;

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

                // additive

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

                m_pBatchNode.AddChild(particleSystem);
                particleSystem.PositionType = CCPositionType.kCCPositionTypeFree;

                //[pBNode addChild:particleSystem z:10 tag:0);
            }

            Schedule(reorderSystem, 2.0f);
            m_emitter = null;
        }
Пример #9
0
 /** Returns a ccColor4F from a ccColor4B.
  @since v0.99.1
  */
 public static CCColor4F CreateColor(CCColor4B c)
 {
     CCColor4F c4 = new CCColor4F(c.R / 255.0f, c.G / 255.0f, c.B / 255.0f, c.A / 255.0f);
     return c4;
 }
Пример #10
0
 /** returns YES if both ccColor4F are equal. Otherwise it returns NO.
  @since v0.99.1
  */
 public static bool ColorsAreEqual(CCColor4F a, CCColor4F b)
 {
     return a.R == b.R && a.G == b.G && a.B == b.B && a.A == b.A;
 }
Пример #11
0
 /** returns YES if both ccColor4F are equal. Otherwise it returns NO.
  * @since v0.99.1
  */
 public static bool ColorsAreEqual(CCColor4F a, CCColor4F b)
 {
     return(a.R == b.R && a.G == b.G && a.B == b.B && a.A == b.A);
 }
Пример #12
0
        /** Returns a ccColor4F from a ccColor4B.
         * @since v0.99.1
         */
        public static CCColor4F CreateColor(CCColor4B c)
        {
            CCColor4F c4 = new CCColor4F(c.R / 255.0f, c.G / 255.0f, c.B / 255.0f, c.A / 255.0f);

            return(c4);
        }
Пример #13
0
 public CCV2F_C4F_T2F()
 {
     Vertices  = new CCVertex2F();
     Colors    = new CCColor4F();
     TexCoords = new CCTex2F();
 }