// creates a CCOrbitCamera action with radius, delta-radius,  z, deltaZ, x, deltaX
 public static CCOrbitCamera actionWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX)
 {
     CCOrbitCamera pRet = new CCOrbitCamera();
     if (pRet.initWithDuration(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX))
     {
         return pRet;
     }
     return null;
 }
        public static CCOrbitCamera actionWithDuration(float t, float radius, float deltaRadius, float angleZ, float deltaAngleZ, float angleX, float deltaAngleX)
        {
            CCOrbitCamera cCOrbitCamera = new CCOrbitCamera();

            if (cCOrbitCamera.initWithDuration(t, radius, deltaRadius, angleZ, deltaAngleZ, angleX, deltaAngleX))
            {
                return(cCOrbitCamera);
            }
            return(null);
        }
Exemple #3
0
        public override void onEnter()
        {
            base.onEnter();

            CCActionInterval inA, outA;

            m_pInScene.visible = false;

            float inDeltaZ, inAngleZ;
            float outDeltaZ, outAngleZ;

            if (m_eOrientation == tOrientation.kOrientationRightOver)
            {
                inDeltaZ  = 90;
                inAngleZ  = 270;
                outDeltaZ = 90;
                outAngleZ = 0;
            }
            else
            {
                inDeltaZ  = -90;
                inAngleZ  = 90;
                outDeltaZ = -90;
                outAngleZ = 0;
            }

            inA = (CCActionInterval)CCSequence.actions
                  (
                CCDelayTime.actionWithDuration(m_fDuration / 2),
                CCSpawn.actions
                (
                    CCOrbitCamera.actionWithDuration(m_fDuration / 2, 1, 0, inAngleZ, inDeltaZ, -45, 0),
                    CCScaleTo.actionWithDuration(m_fDuration / 2, 1),
                    CCShow.action()
                ),
                CCShow.action(),
                CCCallFunc.actionWithTarget(this, base.finish)
                  );
            outA = (CCActionInterval)CCSequence.actions
                   (
                CCSpawn.actions
                (
                    CCOrbitCamera.actionWithDuration(m_fDuration / 2, 1, 0, outAngleZ, outDeltaZ, 45, 0),
                    CCScaleTo.actionWithDuration(m_fDuration / 2, 0.5f)
                ),
                CCHide.action(),
                CCDelayTime.actionWithDuration(m_fDuration / 2)
                   );

            m_pInScene.scale = 0.5f;
            m_pInScene.runAction(inA);
            m_pOutScene.runAction(outA);
        }
        public CameraCenterTest()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCSprite sprite;
            CCOrbitCamera orbit;

            // LEFT-TOP
            sprite = new CCSprite("Images/white-512x512");
            AddChild(sprite, 0);
            sprite.Position = new CCPoint(s.Width / 5 * 1, s.Height / 5 * 1);
            sprite.Color = CCTypes.CCRed;
            sprite.TextureRect = new CCRect(0, 0, 120, 50);
            orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0);
            sprite.RunAction(new CCRepeatForever (orbit));

            // LEFT-BOTTOM
            sprite = new CCSprite("Images/white-512x512");
            AddChild(sprite, 0, 40);
            sprite.Position = (new CCPoint(s.Width / 5 * 1, s.Height / 5 * 4));
            sprite.Color = CCTypes.CCBlue;
            sprite.TextureRect = new CCRect(0, 0, 120, 50);
            orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0);
            sprite.RunAction(new CCRepeatForever (orbit));

            // RIGHT-TOP
            sprite = new CCSprite("Images/white-512x512");
            AddChild(sprite, 0);
            sprite.Position = (new CCPoint(s.Width / 5 * 4, s.Height / 5 * 1));
            sprite.Color = CCTypes.CCYellow;
            sprite.TextureRect = new CCRect(0, 0, 120, 50);
            orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0);
            sprite.RunAction(new CCRepeatForever (orbit));

            // RIGHT-BOTTOM
            sprite = new CCSprite("Images/white-512x512");
            AddChild(sprite, 0, 40);
            sprite.Position = (new CCPoint(s.Width / 5 * 4, s.Height / 5 * 4));
            sprite.Color = CCTypes.CCGreen;
            sprite.TextureRect = new CCRect(0, 0, 120, 50);
            orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0);
            sprite.RunAction(new CCRepeatForever (orbit));

            // CENTER
            sprite = new CCSprite("Images/white-512x512");
            AddChild(sprite, 0, 40);
            sprite.Position = (new CCPoint(s.Width / 2, s.Height / 2));
            sprite.Color = CCTypes.CCWhite;
            sprite.TextureRect = new CCRect(0, 0, 120, 50);
            orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0);
            sprite.RunAction(new CCRepeatForever (orbit));
        }
        public CameraOrbitTest()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCSprite p = new CCSprite(TestResource.s_back3);
            AddChild(p, 0);
            p.Position = (new CCPoint(s.Width / 2, s.Height / 2));
            p.Opacity = 128;

            CCSprite sprite;
            CCOrbitCamera orbit;
            CCCamera cam;
            CCSize ss;

            // LEFT
            s = p.ContentSize;
            sprite = new CCSprite(TestResource.s_pPathGrossini);
            sprite.Scale = (0.5f);
            p.AddChild(sprite, 0);
            sprite.Position = (new CCPoint(s.Width / 4 * 1, s.Height / 2));
            cam = sprite.Camera;
            orbit = new CCOrbitCamera(2, 1, 0, 0, 360, 0, 0);
            sprite.RunAction(new CCRepeatForever (orbit));

            // CENTER
            sprite = new CCSprite(TestResource.s_pPathGrossini);
            sprite.Scale = 1.0f;
            p.AddChild(sprite, 0);
            sprite.Position = new CCPoint(s.Width / 4 * 2, s.Height / 2);
            orbit = new CCOrbitCamera(2, 1, 0, 0, 360, 45, 0);
            sprite.RunAction(new CCRepeatForever (orbit));

            // RIGHT
            sprite = new CCSprite(TestResource.s_pPathGrossini);
            sprite.Scale = 2.0f;
            p.AddChild(sprite, 0);
            sprite.Position = new CCPoint(s.Width / 4 * 3, s.Height / 2);
            ss = sprite.ContentSize;
            orbit = new CCOrbitCamera(2, 1, 0, 0, 360, 90, -45);
            sprite.RunAction(new CCRepeatForever (orbit));

            // PARENT
            orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 90);
            p.RunAction(new CCRepeatForever (orbit));
            Scale = 1;
        }
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCOrbitCamera cCOrbitCamera = null;

            if (pZone == null || pZone.m_pCopyObject == null)
            {
                cCOrbitCamera = new CCOrbitCamera();
                pZone         = new CCZone(cCOrbitCamera);
            }
            else
            {
                cCOrbitCamera = (CCOrbitCamera)pZone.m_pCopyObject;
            }
            this.copyWithZone(pZone);
            cCOrbitCamera.initWithDuration(this.m_fDuration, this.m_fRadius, this.m_fDeltaRadius, this.m_fAngleZ, this.m_fDeltaAngleZ, this.m_fAngleX, this.m_fDeltaAngleX);
            return(cCOrbitCamera);
        }
        // super methods
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone        pNewZone = null;
            CCOrbitCamera pRet     = null;

            if (pZone != null && pZone.m_pCopyObject != null) //in case of being called at sub class
            {
                pRet = (CCOrbitCamera)(pZone.m_pCopyObject);
            }
            else
            {
                pRet  = new CCOrbitCamera();
                pZone = pNewZone = new CCZone(pRet);
            }

            copyWithZone(pZone);

            pRet.initWithDuration(m_fDuration, m_fRadius, m_fDeltaRadius, m_fAngleZ, m_fDeltaAngleZ, m_fAngleX, m_fDeltaAngleX);

            return(pRet);
        }
Exemple #8
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 = CCLens3D.Create(new CCPoint(size.Width / 2, size.Height / 2), 240, new CCGridSize(15, 10), 0.0f);
            CCActionInterval waves = CCWaves3D.Create(18, 15, new CCGridSize(15, 10), 10);

            CCFiniteTimeAction reuse = CCReuseGrid.Create(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 ((CCSequence.FromActions(orbit, orbit_back))));
            target.RunAction(CCSequence.FromActions(lens, delay, reuse, waves));
        }
        // super methods
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone pNewZone = null;
            CCOrbitCamera pRet = null;
            if (pZone != null && pZone.m_pCopyObject != null) //in case of being called at sub class
                pRet = (CCOrbitCamera)(pZone.m_pCopyObject);
            else
            {
                pRet = new CCOrbitCamera();
                pZone = pNewZone = new CCZone(pRet);
            }

            copyWithZone(pZone);

            pRet.initWithDuration(m_fDuration, m_fRadius, m_fDeltaRadius, m_fAngleZ, m_fDeltaAngleZ, m_fAngleX, m_fDeltaAngleX);

            return pRet;
        }
Exemple #10
0
        public override void onEnter()
        {
            float single;
            float single1;
            float single2;
            float single3;

            base.onEnter();
            this.m_pInScene.visible = false;
            if (this.m_eOrientation != tOrientation.kOrientationLeftOver)
            {
                single  = -90f;
                single1 = 90f;
                single2 = -90f;
                single3 = 0f;
            }
            else
            {
                single  = 90f;
                single1 = 270f;
                single2 = 90f;
                single3 = 0f;
            }
            CCFiniteTimeAction[] cCFiniteTimeActionArray  = new CCFiniteTimeAction[] { CCDelayTime.actionWithDuration(this.m_fDuration / 2f), null, null };
            CCFiniteTimeAction[] cCFiniteTimeActionArray1 = new CCFiniteTimeAction[] { CCOrbitCamera.actionWithDuration(this.m_fDuration / 2f, 1f, 0f, single1, single, 90f, 0f), CCScaleTo.actionWithDuration(this.m_fDuration / 2f, 1f), CCShow.action() };
            cCFiniteTimeActionArray[1] = CCSpawn.actions(cCFiniteTimeActionArray1);
            cCFiniteTimeActionArray[2] = CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish));
            CCActionInterval cCActionInterval = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray);

            CCFiniteTimeAction[] cCFiniteTimeActionArray2 = new CCFiniteTimeAction[3];
            CCFiniteTimeAction[] cCFiniteTimeActionArray3 = new CCFiniteTimeAction[] { CCOrbitCamera.actionWithDuration(this.m_fDuration / 2f, 1f, 0f, single3, single2, 90f, 0f), CCScaleTo.actionWithDuration(this.m_fDuration / 2f, 0.5f) };
            cCFiniteTimeActionArray2[0] = CCSpawn.actions(cCFiniteTimeActionArray3);
            cCFiniteTimeActionArray2[1] = CCHide.action();
            cCFiniteTimeActionArray2[2] = CCDelayTime.actionWithDuration(this.m_fDuration / 2f);
            CCActionInterval cCActionInterval1 = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray2);

            this.m_pInScene.scale = 0.5f;
            this.m_pInScene.runAction(cCActionInterval);
            this.m_pOutScene.runAction(cCActionInterval1);
        }
Exemple #11
0
        public override void OnEnter()
        {
            // todo : CCOrbitCamera hasn't been implement

            base.OnEnter();

            centerSprites(3);

            var orbit1 = new CCOrbitCamera(2, 1, 0, 0, 180, 0, 0);
            var action1 = CCSequence.FromActions(orbit1,orbit1.Reverse());

            var orbit2 = new CCOrbitCamera(2, 1, 0, 0, 180, -45, 0);
            var action2 = CCSequence.FromActions(orbit2, orbit2.Reverse());

            var orbit3 = new CCOrbitCamera(2, 1, 0, 0, 180, 90, 0);
            var action3 = CCSequence.FromActions(orbit3, orbit3.Reverse());

            m_kathia.RunAction(new CCRepeatForever (action1));
            m_tamara.RunAction(new CCRepeatForever (action2));
            m_grossini.RunAction(new CCRepeatForever (action3));

            var move = new CCMoveBy (3, new CCPoint(100, -100));
            var move_back = move.Reverse();
            var seq = CCSequence.FromActions(move, move_back);
            var rfe = new CCRepeatForever (seq);
            m_kathia.RunAction(rfe);
            m_tamara.RunAction((CCAction) (rfe.Copy()));
            m_grossini.RunAction((CCAction) (rfe.Copy()));
        }
        public override void onEnter()
        {
            float single;
            float single1;
            float single2;
            float single3;

            base.onEnter();
            this.m_pInScene.visible = false;
            if (this.m_eOrientation != tOrientation.kOrientationRightOver)
            {
                single  = -90f;
                single1 = 90f;
                single2 = -90f;
                single3 = 0f;
            }
            else
            {
                single  = 90f;
                single1 = 270f;
                single2 = 90f;
                single3 = 0f;
            }
            CCFiniteTimeAction[] cCFiniteTimeActionArray = new CCFiniteTimeAction[] { CCDelayTime.actionWithDuration(this.m_fDuration / 2f), CCShow.action(), CCOrbitCamera.actionWithDuration(this.m_fDuration / 2f, 1f, 0f, single1, single, 0f, 0f), CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish)) };
            CCActionInterval     cCActionInterval        = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray);

            CCFiniteTimeAction[] cCFiniteTimeActionArray1 = new CCFiniteTimeAction[] { CCOrbitCamera.actionWithDuration(this.m_fDuration / 2f, 1f, 0f, single3, single2, 0f, 0f), CCHide.action(), CCDelayTime.actionWithDuration(this.m_fDuration / 2f) };
            CCActionInterval     cCActionInterval1        = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray1);

            this.m_pInScene.runAction(cCActionInterval);
            this.m_pOutScene.runAction(cCActionInterval1);
        }
Exemple #13
0
 protected CCOrbitCamera(CCOrbitCamera copy)
     : base(copy)
 {
     Init(copy.m_fRadius, copy.m_fDeltaRadius, copy.m_fAngleZ, copy.m_fDeltaAngleZ, copy.m_fAngleX, copy.m_fDeltaAngleX);
 }