public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; //adds the texture inside the plist to the texture cache m_pBatchNode = new CCParticleBatchNode("Images/fire", 16000); AddChild(m_pBatchNode, 1, 2); for (int i = 0; i < 6; i++) { CCParticleSystemQuad particleSystem = new CCParticleSystemQuad("Particles/Spiral"); particleSystem.Texture = m_pBatchNode.Texture; particleSystem.PositionType = CCPositionType.kCCPositionTypeGrouped; particleSystem.TotalParticles = (200); particleSystem.Position = (new CCPoint(i * 15 + 100, i * 15 + 100)); int randZ = Random.Next(100); m_pBatchNode.AddChild(particleSystem, randZ, -1); } Schedule(removeSystem, 0.5f); m_emitter = null; }
/** creates an initializes a CCParticleSystemQuad from a plist file. This plist files can be creted manually or with Particle Designer: */ public static CCParticleSystemQuad particleWithFile(string plistFile) { CCParticleSystemQuad pRet = new CCParticleSystemQuad(); if (pRet != null && pRet.initWithFile(plistFile)) { return pRet; } return pRet; }
public static CCParticleSystemQuad particleWithDictionary(Dictionary <string, object> dic) { CCParticleSystemQuad quad = new CCParticleSystemQuad(); if ((quad != null) && quad.initWithDictionary(dic)) { return(quad); } return(quad); }
/** creates an initializes a CCParticleSystemQuad from a plist file. * This plist files can be creted manually or with Particle Designer: */ public static CCParticleSystemQuad particleWithFile(string plistFile) { CCParticleSystemQuad pRet = new CCParticleSystemQuad(); if (pRet != null && pRet.initWithFile(plistFile)) { return(pRet); } return(pRet); }
public static CCParticleSystemQuad particleWithFile(string plistFile) { CCParticleSystemQuad quad = new CCParticleSystemQuad(); if ((quad != null) && quad.initWithFile(plistFile)) { return(quad); } return(quad); }
private void removeSystem(float dt) { int nChildrenCount = m_pBatchNode.ChildrenCount; if (nChildrenCount > 0) { CCLog.Log("remove random system"); int uRand = Random.Next(nChildrenCount - 1); m_pBatchNode.RemoveChild(m_pBatchNode.Children[uRand], true); CCParticleSystemQuad particleSystem = new CCParticleSystemQuad("Particles/Spiral"); //add new particleSystem.PositionType = CCPositionType.kCCPositionTypeGrouped; particleSystem.TotalParticles = (200); particleSystem.Position = (new CCPoint(Random.Next(300), Random.Next(400))); CCLog.Log("add a new system"); int randZ = Random.Next(100); particleSystem.Texture = m_pBatchNode.Texture; m_pBatchNode.AddChild(particleSystem, randZ, -1); } }
public override void OnEnter() { base.OnEnter(); Color = new CCColor3B(0, 0, 0); RemoveChild(m_background, true); m_background = null; m_emitter = new CCParticleSystemQuad(); string filename = "Particles/" + m_title; m_emitter.InitWithFile(filename); AddChild(m_emitter, 10); m_emitter.BlendAdditive = true; setEmitterPosition(); }
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(); }
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); }
public override void onEnter() { base.onEnter(); Color = new ccColor3B(0,0,0); removeChild(m_background, true); m_background = null; CCParticleSystemQuad system = new CCParticleSystemQuad(); system.initWithFile("Images/SpinningPeasPlist"); system.setTextureWithRect(CCTextureCache.sharedTextureCache().addImage("Images/particles"), new CCRect(0,0,32,32)); addChild(system, 10); m_emitter = system; m_nIndex = 0; schedule(updateQuads, 2.0f); }
public override void onEnter() { base.onEnter(); m_emitter = new CCParticleSystemQuad(); m_emitter.initWithTotalParticles(300); //m_emitter.autorelease(); m_background.addChild(m_emitter, 10); ////m_emitter.release(); // win32 : Remove this line m_emitter.Texture = CCTextureCache.sharedTextureCache().addImage(TestResource.s_stars2); // duration m_emitter.Duration = -1; // gravity m_emitter.setGravity( new CCPoint(0,0)); // angle m_emitter.Angle = 90; m_emitter.AngleVar = 360; // speed of particles m_emitter.setSpeed(160); m_emitter.setSpeedVar(20); // radial m_emitter.setRadialAccel(-120); m_emitter.setRadialAccelVar(0); // tagential m_emitter.setTangentialAccel(30); m_emitter.setTangentialAccelVar(0); // emitter position m_emitter.position = new CCPoint(160,240); m_emitter.PosVar = new CCPoint(0,0); // life of particles m_emitter.Life = 3; m_emitter.LifeVar = 1; // spin of particles m_emitter.StartSpin = 0; m_emitter.StartSpinVar = 0; m_emitter.EndSpin = 0; m_emitter.EndSpinVar = 2000; // color of particles ccColor4F startColor = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f); m_emitter.StartColor = startColor; ccColor4F startColorVar = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f); m_emitter.StartColorVar = startColorVar; ccColor4F endColor = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f); m_emitter.EndColor = endColor; ccColor4F endColorVar = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f); m_emitter.EndColorVar = endColorVar; // size, in pixels m_emitter.StartSize = 30.0f; m_emitter.StartSizeVar = 00.0f; m_emitter.EndSize = (float)eParticleShowingProperty.kParticleStartSizeEqualToEndSize; // emits per second m_emitter.EmissionRate = m_emitter.TotalParticles/m_emitter.Life; // additive m_emitter.IsBlendAdditive = false; setEmitterPosition(); }
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(); }
public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_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.kCCPositionTypeGrouped; particleSystem.Position = (new CCPoint(i * 50, i * 50)); particleSystem.Texture = batchNode.Texture; batchNode.AddChild(particleSystem); } m_emitter = null; }
public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; CCTextureCache.SharedTextureCache.AddImage("Images/particles"); for (int i = 0; i < 5; i++) { CCParticleSystemQuad particleSystem = new CCParticleSystemQuad("Particles/SpinningPeas"); particleSystem.Position = (new CCPoint(i * 50, i * 50)); particleSystem.PositionType = CCPositionType.kCCPositionTypeGrouped; AddChild(particleSystem); } m_emitter = null; }
public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; m_emitter = new CCParticleSystemQuad("Particles/LavaFlow"); m_emitter.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire"); CCParticleBatchNode batch = new CCParticleBatchNode(m_emitter.Texture); batch.AddChild(m_emitter); AddChild(batch, 10); Schedule(switchRender, 2.0f); CCLayer node = new CCLayer(); AddChild(node); m_pParent1 = batch; m_pParent2 = node; }
public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; m_emitter = new CCParticleSystemQuad("Particles/TestPremultipliedAlpha"); AddChild(m_emitter, 10); }
public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; m_emitter = new CCParticleSystemQuad("Particles/BoilingFoam"); // Particle Designer "normal" blend func causes black halo on premul textures (ignores multiplication) //this->emitter.blendFunc = (ccBlendFunc){ GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA }; // Cocos2d "normal" blend func for premul causes alpha to be ignored (oversaturates colors) var tBlendFunc = new CCBlendFunc(OGLES.GL_ONE, OGLES.GL_ONE_MINUS_SRC_ALPHA); m_emitter.BlendFunc = tBlendFunc; //Debug.Assert(m_emitter.OpacityModifyRGB, "Particle texture does not have premultiplied alpha, test is useless"); // Toggle next line to see old behavior // this->emitter.opacityModifyRGB = NO; m_emitter.StartColor = new CCColor4F(1, 1, 1, 1); m_emitter.EndColor = new CCColor4F(1, 1, 1, 0); m_emitter.StartColorVar = new CCColor4F(0, 0, 0, 0); m_emitter.EndColorVar = new CCColor4F(0, 0, 0, 0); AddChild(m_emitter, 10); }
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)); }
public override void OnEnter() { base.OnEnter(); Color = new CCColor3B(0, 0, 0); RemoveChild(m_background, true); m_background = null; var system = new CCParticleSystemQuad(); system.InitWithFile("Particles/SpinningPeas"); system.SetTextureWithRect(CCTextureCache.SharedTextureCache.AddImage("Images/particles"), new CCRect(0, 0, 32, 32)); AddChild(system, 10); m_emitter = system; m_nIndex = 0; Schedule(updateQuads, 2.0f); }
public static new CCParticleSystemQuad Create(string plistFile) { var pRet = new CCParticleSystemQuad(); pRet.InitWithFile(plistFile); return pRet; }
public override void onEnter() { base.onEnter(); Color = new ccColor3B(0, 0, 0); removeChild(m_background, true); m_background = null; m_emitter = new CCParticleSystemQuad(); // string filename = "Images/" + m_title + ".plist"; string filename = "Images/" + m_title; m_emitter.initWithFile(filename); addChild(m_emitter, 10); m_emitter.IsBlendAdditive = true; setEmitterPosition(); }
public static CCParticleSystemQuad Create(int numberOfParticles) { var pRet = new CCParticleSystemQuad(); pRet.InitWithTotalParticles(numberOfParticles); return pRet; }
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 = (float)eParticleShowingProperty.kCCParticleDurationInfinity; // radius mode m_emitter.EmitterMode = (int)eParticleMode.kCCParticleModeRadius; // radius mode: start and end radius in pixels m_emitter.setStartRadius(50); m_emitter.setStartRadiusVar(0); m_emitter.setEndRadius((float)eParticleShowingProperty.kCCParticleStartRadiusEqualToEndRadius); m_emitter.setEndRadiusVar(0); // radius mode: degrees per second m_emitter.setRotatePerSecond(0); m_emitter.setRotatePerSecondVar(0); // angle m_emitter.Angle = 90; m_emitter.AngleVar = 0; // emitter position CCSize size = CCDirector.sharedDirector().getWinSize(); 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 ccColor4F startColor = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f); m_emitter.StartColor = startColor; ccColor4F startColorVar = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f); m_emitter.StartColorVar = startColorVar; ccColor4F endColor = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f); m_emitter.EndColor = endColor; ccColor4F 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 = (float)eParticleShowingProperty.kCCParticleStartSizeEqualToEndSize; // emits per second m_emitter.EmissionRate = m_emitter.TotalParticles / m_emitter.Life; // additive m_emitter.IsBlendAdditive = false; CCRotateBy rot = CCRotateBy.actionWithDuration(16, 360); m_emitter.runAction(CCRepeatForever.actionWithAction(rot)); }
public static new CCParticleSystemQuad Create() { var p = new CCParticleSystemQuad(); p.Init(); return p; }
public void createParticleSystem() { CCParticleSystem particleSystem = null; /* * Tests: * 1: Point Particle System using 32-bit textures (PNG) * 2: Point Particle System using 16-bit textures (PNG) * 3: Point Particle System using 8-bit textures (PNG) * 4: Point Particle System using 4-bit textures (PVRTC) * 5: Quad Particle System using 32-bit textures (PNG) * 6: Quad Particle System using 16-bit textures (PNG) * 7: Quad Particle System using 8-bit textures (PNG) * 8: Quad Particle System using 4-bit textures (PVRTC) */ removeChildByTag(PerformanceParticleTest.kTagParticleSystem, true); // remove the "fire.png" from the TextureCache cache. CCTexture2D texture = CCTextureCache.sharedTextureCache().addImage("Images/fire"); CCTextureCache.sharedTextureCache().removeTexture(texture); if (subtestNumber <= 3) { particleSystem = new CCParticleSystemPoint(); } else { particleSystem = new CCParticleSystemQuad(); } switch (subtestNumber) { case 1: CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA8888); particleSystem.initWithTotalParticles((uint)quantityParticles); particleSystem.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire"); break; case 2: CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA4444); particleSystem.initWithTotalParticles((uint)quantityParticles); particleSystem.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire"); break; case 3: CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_A8); particleSystem.initWithTotalParticles((uint)quantityParticles); particleSystem.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire"); break; // case 4: // particleSystem->initWithTotalParticles(quantityParticles); // ////---- particleSystem.texture = [[CCTextureCache sharedTextureCache] addImage:@"fire.pvr"]; // particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png")); // break; case 4: CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA8888); particleSystem.initWithTotalParticles((uint)quantityParticles); particleSystem.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire"); break; case 5: CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA4444); particleSystem.initWithTotalParticles((uint)quantityParticles); particleSystem.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire"); break; case 6: CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_A8); particleSystem.initWithTotalParticles((uint)quantityParticles); particleSystem.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire"); break; // case 8: // particleSystem->initWithTotalParticles(quantityParticles); // ////---- particleSystem.texture = [[CCTextureCache sharedTextureCache] addImage:@"fire.pvr"]; // particleSystem->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png")); // break; default: particleSystem = null; CCLog.Log("Shall not happen!"); break; } addChild(particleSystem, 0, PerformanceParticleTest.kTagParticleSystem); doTest(); // restore the default pixel format CCTexture2D.setDefaultAlphaPixelFormat(CCTexture2DPixelFormat.kCCTexture2DPixelFormat_RGBA8888); }
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; }
public CCParticleSystemQuad Clone() { var p = new CCParticleSystemQuad(); p.InitWithTotalParticles(m_uTotalParticles); // angle p.m_fAngle = m_fAngle; p.m_fAngleVar = m_fAngleVar; // duration p.m_fDuration = m_fDuration; // blend function p.m_tBlendFunc = m_tBlendFunc; // color p.m_tStartColor = m_tStartColor; p.m_tStartColorVar = m_tStartColorVar; p.m_tEndColor = m_tEndColor; p.m_tEndColorVar = m_tEndColorVar; // particle size p.m_fStartSize = m_fStartSize; p.m_fStartSizeVar = m_fStartSizeVar; p.m_fEndSize = m_fEndSize; p.m_fEndSizeVar = m_fEndSizeVar; // position p.Position = Position; p.m_tPosVar = m_tPosVar; // Spinning p.m_fStartSpin = m_fStartSpin; p.m_fStartSpinVar = m_fStartSpinVar; p.m_fEndSpin = m_fEndSpin; p.m_fEndSpinVar = m_fEndSpinVar; p.m_nEmitterMode = m_nEmitterMode; p.modeA = modeA; p.modeB = modeB; // life span p.m_fLife = m_fLife; p.m_fLifeVar = m_fLifeVar; // emission Rate p.m_fEmissionRate = m_fEmissionRate; p.m_bOpacityModifyRGB = m_bOpacityModifyRGB; p.m_pTexture = m_pTexture; p.AutoRemoveOnFinish = AutoRemoveOnFinish; return p; }
public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_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 = CCDirector.SharedDirector.WinSize; 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); }