Example #1
0
        /** owner - ссылается на объект, кто создавал эмитер. Если указан, эмитер следует за ним*/

        public static CCParticleSystem GetEmiter(string texture, ParticleType type, int dieAfter, CCPoint where,
            Entity owner = null) {
            CCPoint pos;
            if (owner != null)
                pos = new CCPoint(owner.Texture.PixelsWide/2, owner.Texture.PixelsHigh/2);
            else
                pos = where;


            CCParticleSystem emiter = new CCParticleMeteor(pos);

            switch (type) {
                case ParticleType.ProjectileTrail:
                    emiter = new CCParticleMeteor(pos) {
                        Scale = 0.1f,
                        SpeedVar = 250,
                        Texture = CCTextureCache.SharedTextureCache.AddImage(texture)
                    };
                    if (owner != null)
                        emiter.Gravity = Entity.GetNormalPointByDirection(owner.Direction)*-2000;

                    break;
                case ParticleType.LevelUp:
                    emiter = new CCParticleSun(pos) {
                        Scale = 0.1f,
                        SpeedVar = 150,
                        Texture = CCTextureCache.SharedTextureCache.AddImage(texture)
                    };
                    break;
            }

            emiter.ScheduleOnce((float x) => emiter.RemoveFromParent(), dieAfter);

            return emiter;
        }
Example #2
0
        public IntervalLayer()
        {
            m_time0 = m_time1 = m_time2 = m_time3 = m_time4 = 0.0f;

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            // sun
			CCParticleSystem sun = new CCParticleSun(new CCPoint(s.Width / 2, s.Height / 2));
            sun.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
            sun.Position = (new CCPoint(s.Width - 32, s.Height - 32));

            sun.TotalParticles = 130;
            sun.Life = (0.6f);
            AddChild(sun);

            // timers
            m_label0 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt");
            m_label1 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt");
            m_label2 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt");
            m_label3 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt");
            m_label4 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt");

            Schedule ();

            Schedule(step1);
            Schedule(step2, 0);
            Schedule(step3, 1.0f);
            Schedule(step4, 2.0f);

            m_label0.Position = new CCPoint(s.Width * 1 / 6, s.Height / 2);
            m_label1.Position = new CCPoint(s.Width * 2 / 6, s.Height / 2);
            m_label2.Position = new CCPoint(s.Width * 3 / 6, s.Height / 2);
            m_label3.Position = new CCPoint(s.Width * 4 / 6, s.Height / 2);
            m_label4.Position = new CCPoint(s.Width * 5 / 6, s.Height / 2);

            AddChild(m_label0);
            AddChild(m_label1);
            AddChild(m_label2);
            AddChild(m_label3);
            AddChild(m_label4);

            // Sprite
            CCSprite sprite = new CCSprite(s_pPathGrossini);
            sprite.Position = new CCPoint(40, 50);

            CCJumpBy jump = new CCJumpBy (3, new CCPoint(s.Width - 80, 0), 50, 4);

            AddChild(sprite);
            sprite.RunAction(new CCRepeatForever (
                (CCFiniteTimeAction) (new CCSequence(jump, jump.Reverse())))
                );

            // pause button
            CCMenuItem item1 = new CCMenuItemFont("Pause", onPause);
            CCMenu menu = new CCMenu(item1);
            menu.Position = new CCPoint(s.Width / 2, s.Height - 50);

            AddChild(menu);
        }
 public static CCParticleSun GetPlayerShipEngineFire(PlayerShipEngineFireType tipo)
 {
     var position = new CCPoint((tipo == PlayerShipEngineFireType.Superior) ? 50 : 110, 0);
     var explosion = new CCParticleSun(position, 250);
     explosion.BlendFunc = new CCBlendFunc(770, 772);
     explosion.EmissionRate = 83.3334f;
     //explosion.AutoRemoveOnFinish = true;
     //explosion.StartSize = 15.0f;
     explosion.Speed = 30.0f;
     explosion.AnchorPoint = new CCPoint(0.5f, 0.5f);
     explosion.Gravity = new CCPoint(0, -200);
     explosion.StartSize = 60;
     explosion.Rotation = 270f;
     return explosion;
 }
Example #4
0
        private void shouldNotCrash(float dt)
        {
            Unschedule(shouldNotCrash);

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            // if the node has timers, it crashes
			CCParticleSun explosion = new CCParticleSun(s.Center);
            explosion.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire");

            // if it doesn't, it works Ok.
            //	CocosNode *explosion = [Sprite create:@"grossinis_sister2.png");

			explosion.Position = s.Center;

			RunActions(new CCRotateBy (2, 360),
				new CCCallFuncN(removeMe));

            AddChild(explosion);
        }
Example #5
0
        public override void OnEnter()
        {
base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            Emitter = new CCParticleSun(MidWindowPoint);
            Background.AddChild(Emitter, 10);

            Emitter.Texture = CCTextureCache.SharedTextureCache.AddImage(TestResource.s_fire);

			SetEmitterPosition();

        }
Example #6
0
        public override void OnEnter()
        {
            base.OnEnter(); CCSize windowSize = Layer.VisibleBoundsWorldspace.Size;

            Background.Parent.RemoveChild(Background, true);
            Background = null;

            CCParallaxNode p = new CCParallaxNode();
            AddChild(p, 5);

            CCSprite p1 = new CCSprite(TestResource.s_back3);
            CCSprite p2 = new CCSprite(TestResource.s_back3);

            p.AddChild(p1, 1, new CCPoint(0.5f, 1), new CCPoint(0, 250));
            p.AddChild(p2, 2, new CCPoint(1.5f, 1), new CCPoint(0, 50));

            Emitter = new CCParticleFlower(MidWindowPoint);

            Emitter.Texture = CCTextureCache.SharedTextureCache.AddImage(TestResource.s_fire);

            p1.AddChild(Emitter, 10);
            Emitter.Position = new CCPoint(250, 200);

            CCParticleSun par = new CCParticleSun(MidWindowPoint);
            p2.AddChild(par, 10);
            par.Texture = CCTextureCache.SharedTextureCache.AddImage(TestResource.s_fire);

            CCFiniteTimeAction move = new CCMoveBy (4, new CCPoint(300, 0));
            CCFiniteTimeAction move_back = move.Reverse();
            CCFiniteTimeAction seq = new CCSequence(move, move_back);
            p.RunAction(new CCRepeatForever ((CCFiniteTimeAction) seq));
        }
Example #7
0
        void AddSun()
        {
            circleNode = new CCDrawNode ();
            circleNode.DrawSolidCircle (CCPoint.Zero, 30.0f, CCColor4B.Yellow);
            AddChild (circleNode);

            sun = new CCParticleSun (CCPoint.Zero);
            sun.StartColor = new CCColor4F (CCColor3B.Red);
            sun.EndColor = new CCColor4F (CCColor3B.Yellow);
            AddChild (sun);
        }