Beispiel #1
0
        public override void OnEnter()
        {
            base.OnEnter();

            GameView.DepthTesting = true;

            CCRect visibleBounds = VisibleBoundsWorldspace;

            // To reuse a grid the grid size and the grid type must be the same.
            // in this case:
            //     Lens3D is Grid3D and it's size is (15,10)
            //     Waves3D is Grid3D and it's size is (15,10)

            var lens  = new CCLens3D(0.0f, new CCGridSize(15, 10), visibleBounds.Center, 200);
            var waves = new CCWaves3D(10, new CCGridSize(15, 10), 18, 30);


            var reuse = new CCReuseGrid(1);
            var delay = new CCDelayTime(8);

            //bgNode.AnchorPoint = CCPoint.AnchorMiddle;
            var orbit      = new CCOrbitCamera(5, 1.0f, 2, 0, 180, 0, -90);
            var orbit_back = orbit.Reverse();

            //bgNode.RepeatForever(orbit, orbit_back);
            bgNode.RunActions(lens, delay, reuse, waves);
        }
Beispiel #2
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCNode target = GetChildByTag(EffectAdvanceScene.kTagBackground);

            // To reuse a grid the grid size and the grid type must be the same.
            // in this case:
            //     Lens3D is Grid3D and it's size is (15,10)
            //     Waves3D is Grid3D and it's size is (15,10)

            CCSize           size  = CCDirector.SharedDirector.WinSize;
            CCActionInterval lens  = new CCLens3D(0.0f, new CCGridSize(15, 10), new CCPoint(size.Width / 4, size.Height / 4), 240);
            CCActionInterval waves = new CCWaves3D(10, new CCGridSize(15, 10), 18, 15);


            CCFiniteTimeAction reuse = new CCReuseGrid(1);
            CCActionInterval   delay = new CCDelayTime(8);

            CCActionInterval   orbit      = new CCOrbitCamera(5, 1, 2, 0, 180, 0, -90);
            CCFiniteTimeAction orbit_back = orbit.Reverse();

            target.RunAction(new CCRepeatForever((new CCSequence(orbit, orbit_back))));
            target.RunAction(new CCSequence(lens, delay, reuse, waves));
        }
Beispiel #3
0
            public static Lens3DTarget Create(CCLens3D pAction)
            {
                var pRet = new Lens3DTarget();

                pRet.m_pLens3D = pAction;
                return(pRet);
            }
Beispiel #4
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCRect visibleBounds = VisibleBoundsWorldspace;

            CCCamera contentCamera = contentLayer.Camera;

            contentCamera.Projection             = CCCameraProjection.Projection3D;
            contentCamera.PerspectiveAspectRatio = 1.0f;

            CCPoint3 cameraCenter = contentCamera.CenterInWorldspace;
            CCPoint3 cameraTarget = contentCamera.TargetInWorldspace;

            float targeCenterLength = (cameraTarget - cameraCenter).Length;


            contentCamera.NearAndFarPerspectiveClipping = new CCPoint(0.15f, 100.0f);

            contentCamera.PerspectiveFieldOfView = (float)Math.Atan(visibleBounds.Size.Height / (2.0f * targeCenterLength));

            var lens      = new CCLens3D(10, new CCGridSize(64, 48), new CCPoint(100, 180), 80);
            var move      = new CCJumpBy(5, new CCPoint(600, 0), 100, 5);
            var move_back = move.Reverse();

            CCLens3DState lensState = bgNode.RunAction(lens) as CCLens3DState;

            var target = new Lens3DTarget(lensState);

            // Please make sure the target has been added to its parent.
            AddChild(target);

            target.AddActions(false, move, move_back);
        }
Beispiel #5
0
        public override void onEnter()
        {
            base.onEnter();

            CCActionInterval lens = CCLens3D.actionWithPosition(new CCPoint(100, 180), 150, new ccGridSize(32, 24), 10);

            //id move = [MoveBy::actionWithDuration:5 position:ccp(400,0)];

            /**
             * @todo we only support CCNode run actions now.
             */
            //  CCActionInterval* move = CCJumpBy::actionWithDuration(5, ccp(380,0), 100, 4);
            //  CCActionInterval* move_back = move->reverse();
            //  CCActionInterval* seq = (CCActionInterval *)(CCSequence::actions( move, move_back, NULL));
            //  CCActionManager::sharedManager()->addAction(seq, lens, false);

            runAction(lens);
        }
Beispiel #6
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCRect visibleBounds = VisibleBoundsWorldspace;

            var lens      = new CCLens3D(10, new CCGridSize(64, 48), new CCPoint(100, 180), 80);
            var move      = new CCJumpBy(5, new CCPoint(600, 0), 100, 5);
            var move_back = move.Reverse();

            CCLens3DState lensState = bgNode.RunAction(lens) as CCLens3DState;

            var target = new Lens3DTarget(lensState);

            // Please make sure the target has been added to its parent.
            AddChild(target);

            target.AddActions(false, move, move_back);
        }
Beispiel #7
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCRect visibleBounds = VisibleBoundsWorldspace;

            var radius = 150;
            var lens   = new CCLens3D(10, new CCGridSize(64, 48), new CCPoint(100, visibleBounds.Center.Y - radius / 2), radius);
            var jumpBy = new CCJumpBy(5, new CCPoint(600, 0), 100, 5);

            CCLens3DState lensState = bgNode.RunAction(lens) as CCLens3DState;

            var target = new Lens3DTarget(lensState);

            // Please make sure the target has been added to its parent.
            AddChild(target);

            target.AddActions(false, jumpBy, jumpBy.Reverse());
        }
Beispiel #8
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCRect visibleBounds = VisibleBoundsWorldspace;

            // To reuse a grid the grid size and the grid type must be the same.
            // in this case:
            //     Lens3D is Grid3D and it's size is (15,10)
            //     Waves3D is Grid3D and it's size is (15,10)


            CCCamera contentCamera = contentLayer.Camera;

            contentCamera.Projection             = CCCameraProjection.Projection3D;
            contentCamera.PerspectiveAspectRatio = 1.0f;

            CCPoint3 cameraCenter = contentCamera.CenterInWorldspace;
            CCPoint3 cameraTarget = contentCamera.TargetInWorldspace;

            float targeCenterLength = (cameraTarget - cameraCenter).Length;


            contentCamera.NearAndFarPerspectiveClipping = new CCPoint(0.1f, 100.0f);

            contentCamera.PerspectiveFieldOfView = (float)Math.PI / 3.0f; //(float)Math.Atan(visibleBounds.Size.Height / (2.0f * targeCenterLength));

            var lens  = new CCLens3D(0.0f, new CCGridSize(15, 10), bgNode.ContentSize.Center, 90);
            var waves = new CCWaves3D(10, new CCGridSize(15, 10), 18, 15);


            var reuse = new CCReuseGrid(1);
            var delay = new CCDelayTime(8);

            bgNode.AnchorPoint = CCPoint.AnchorMiddle;
            var orbit      = new CCOrbitCamera(5, 30.0f, 2, 20, 180, 0, -90);
            var orbit_back = orbit.Reverse();

            bgNode.RepeatForever(orbit, orbit_back);
            bgNode.RunActions(lens, delay, reuse, waves);
        }
Beispiel #9
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCLens3D   lens      = new CCLens3D(10, new CCGridSize(32, 24), new CCPoint(100, 180), 150);
            CCJumpBy   move      = new CCJumpBy(5, new CCPoint(380, 0), 100, 4);
            var        move_back = (CCActionInterval)move.Reverse();
            CCSequence seq       = new CCSequence(move, move_back);

            /* In cocos2d-iphone, the type of action's target is 'id', so it supports using the instance of 'CCLens3D' as its target.
             *  While in cocos2d-x, the target of action only supports CCNode or its subclass,
             *  so we make an encapsulation for CCLens3D to achieve that.
             */

            CCDirector director = CCDirector.SharedDirector;
            CCNode     target   = Lens3DTarget.Create(lens);

            // Please make sure the target been added to its parent.
            AddChild(target);

            director.ActionManager.AddAction(seq, target, false);
            RunAction(lens);
        }
Beispiel #10
0
        public override void onEnter()
        {
            base.onEnter();

            CCNode target = getChildByTag(EffectAdvanceScene.kTagBackground);

            // To reuse a grid the grid size and the grid type must be the same.
            // in this case:
            //     Lens3D is Grid3D and it's size is (15,10)
            //     Waves3D is Grid3D and it's size is (15,10)

            CCSize           size  = CCDirector.sharedDirector().getWinSize();
            CCActionInterval lens  = CCLens3D.actionWithPosition(new CCPoint(size.width / 2, size.height / 2), 240, new ccGridSize(15, 10), 0.0f);
            CCActionInterval waves = CCWaves3D.actionWithWaves(18, 15, new ccGridSize(15, 10), 10);

            CCFiniteTimeAction reuse = CCReuseGrid.actionWithTimes(1);
            CCActionInterval   delay = CCDelayTime.actionWithDuration(8);

            CCActionInterval   orbit      = CCOrbitCamera.actionWithDuration(5, 1, 2, 0, 180, 0, -90);
            CCFiniteTimeAction orbit_back = orbit.reverse();

            target.runAction(CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(orbit, orbit_back))));
            target.runAction(CCSequence.actions(lens, delay, reuse, waves));
        }
Beispiel #11
0
        public new static CCActionInterval actionWithDuration(float t)
        {
            CCSize size = CCDirector.sharedDirector().getWinSize();

            return(CCLens3D.actionWithPosition(new CCPoint(size.width / 2, size.height / 2), 240, new ccGridSize(15, 10), t));
        }