예제 #1
0
        public IntervalLayer()
        {
            m_time0 = m_time1 = m_time2 = m_time3 = m_time4 = 0.0f;

            CCSize s = CCDirector.SharedDirector.WinSize;

            // sun
            CCParticleSystem sun = new CCParticleSun();
            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");

            ScheduleUpdate();

            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 (
                (CCActionInterval) (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);
        }
예제 #2
0
 public override void OnEnter()
 {
     base.OnEnter();
     TouchEnabled = true;
     var sun = new CCParticleSun();
     sun.Position = CCDirector.SharedDirector.WinSize.Center;
     AddChild(sun);
 }
예제 #3
0
        public override void TouchesBegan(List<CCTouch> touches)
        {
            foreach (CCTouch t in touches)
            {
                // ask director the the window size
                CCSize size = CCDirector.SharedDirector.WinSize;

                CCPoint center = new CCPoint(size.Width / 2, size.Height / 2);
                CCPoint end = t.Location;
                float fadeTime = CCMacros.CCRandomBetween0And1() * 5f;
                CCLightningStreak s = new CCLightningStreak(center, end, fadeTime, 15f, 4.0f, new CCColor3B(0, 0, 255), TestResource.s_fire);
                s.Duration = .5f;
                AddChild(s);
                var target = new CCParticleSun();
                target.Scale = 0.2f;
                target.Position = end;
                AddChild(target);
                target.RunAction(new CCSequence(new CCFadeOut(fadeTime), new CCRemoveSelf()));
            }
        }
예제 #4
0
        private void shouldNotCrash(float dt)
        {
            Unschedule((shouldNotCrash));

            CCSize s = CCDirector.SharedDirector.WinSize;

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

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

            explosion.Position = new CCPoint(s.Width / 2, s.Height / 2);

            RunAction(CCSequence.FromActions(
                new CCRotateBy (2, 360),
                new CCCallFuncN((removeMe))
                          ));

            AddChild(explosion);
        }
예제 #5
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_background.Parent.RemoveChild(m_background, true);
            m_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));

            m_emitter = new CCParticleFlower();

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

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

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

            CCActionInterval move = new CCMoveBy (4, new CCPoint(300, 0));
            CCFiniteTimeAction move_back = move.Reverse();
            CCFiniteTimeAction seq = new CCSequence(move, move_back);
            p.RunAction(new CCRepeatForever ((CCActionInterval) seq));
        }
예제 #6
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_emitter = new CCParticleSun();
            m_background.AddChild(m_emitter, 10);

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

            setEmitterPosition();
        }