Exemplo n.º 1
0
        public CCSkewToState (CCSkewTo action, CCNode target)
            : base (action, target)
        { 
            EndSkewX = action.SkewToX;
            EndSkewY = action.SkewToY;

            StartSkewX = target.SkewX;

            if (StartSkewX > 0)
            {
                StartSkewX = StartSkewX % 180f;
            }
            else
            {
                StartSkewX = StartSkewX % -180f;
            }

            DeltaX = EndSkewX - StartSkewX;

            if (DeltaX > 180)
            {
                DeltaX -= 360;
            }
            if (DeltaX < -180)
            {
                DeltaX += 360;
            }

            StartSkewY = target.SkewY;

            if (StartSkewY > 0)
            {
                StartSkewY = StartSkewY % 360f;
            }
            else
            {
                StartSkewY = StartSkewY % -360f;
            }

            DeltaY = EndSkewY - StartSkewY;

            if (DeltaY > 180)
            {
                DeltaY -= 360;
            }
            if (DeltaY < -180)
            {
                DeltaY += 360;
            }
        }
Exemplo n.º 2
0
        public CCSkewToState(CCSkewTo action, CCNode target)
            : base(action, target)
        {
            EndSkewX = action.SkewToX;
            EndSkewY = action.SkewToY;

            StartSkewX = target.SkewX;

            if (StartSkewX > 0)
            {
                StartSkewX = StartSkewX % 180f;
            }
            else
            {
                StartSkewX = StartSkewX % -180f;
            }

            DeltaX = EndSkewX - StartSkewX;

            if (DeltaX > 180)
            {
                DeltaX -= 360;
            }
            if (DeltaX < -180)
            {
                DeltaX += 360;
            }

            StartSkewY = target.SkewY;

            if (StartSkewY > 0)
            {
                StartSkewY = StartSkewY % 360f;
            }
            else
            {
                StartSkewY = StartSkewY % -360f;
            }

            DeltaY = EndSkewY - StartSkewY;

            if (DeltaY > 180)
            {
                DeltaY -= 360;
            }
            if (DeltaY < -180)
            {
                DeltaY += 360;
            }
        }
Exemplo n.º 3
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_tamara.RemoveFromParentAndCleanup(true);
            m_grossini.RemoveFromParentAndCleanup(true);
            m_kathia.RemoveFromParentAndCleanup(true);

            // Get window size so that we can center the box layer
            var winSize = CCDirector.SharedDirector.WinSize;

            var boxSize = new CCSize(100.0f, 100.0f);

            var box = new CCLayerColor(new CCColor4B(255, 255, 0, 255));

            box.AnchorPoint = new CCPoint(0, 0);
            box.Position    = new CCPoint(winSize.Center.X - (boxSize.Width / 2), winSize.Center.Y - (boxSize.Height / 2));
            box.ContentSize = boxSize;

            var uL = new CCLayerColor(new CCColor4B(255, 0, 0, 255));

            box.AddChild(uL);
            uL.ContentSize = new CCSize(markrside, markrside);
            uL.Position    = new CCPoint(0.0f, boxSize.Height - markrside);
            uL.AnchorPoint = new CCPoint(0, 0);

            var uR = new CCLayerColor(new CCColor4B(0, 0, 255, 255));

            box.AddChild(uR);
            uR.ContentSize = new CCSize(markrside, markrside);
            uR.Position    = new CCPoint(boxSize.Width - markrside, boxSize.Height - markrside);
            uR.AnchorPoint = new CCPoint(0, 0);
            AddChild(box);

            var actionTo      = new CCSkewTo(2, 0.0f, 2.0f);
            var rotateTo      = new CCRotateTo(2, 61.0f);
            var actionScaleTo = new CCScaleTo(2, -0.44f, 0.47f);

            var actionScaleToBack = new CCScaleTo(2, 1.0f, 1.0f);
            var rotateToBack      = new CCRotateTo(2, 0);
            var actionToBack      = new CCSkewTo(2, 0, 0);

            box.RunAction(CCSequence.FromActions(actionTo, actionToBack));
            box.RunAction(CCSequence.FromActions(rotateTo, rotateToBack));
            box.RunAction(CCSequence.FromActions(actionScaleTo, actionScaleToBack));
        }
Exemplo n.º 4
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(3);

            var actionTo     = new CCSkewTo(2, 37.2f, -37.2f);
            var actionToBack = new CCSkewTo(2, 0, 0);
            var actionBy     = new CCSkewBy(2, 0.0f, -90.0f);
            var actionBy2    = new CCSkewBy(2, 45.0f, 45.0f);
            var actionByBack = actionBy.Reverse();

            m_tamara.RunAction(CCSequence.FromActions(actionTo, actionToBack));
            m_grossini.RunAction(CCSequence.FromActions(actionBy, actionByBack));

            m_kathia.RunAction(CCSequence.FromActions(actionBy2, actionBy2.Reverse()));
        }
Exemplo n.º 5
0
        public override void onEnter()
        {
            base.onEnter();

            centerSprites(3);

            CCActionInterval   actionTo     = CCSkewTo.actionWithDuration(2, 37.2f, -37.2f);
            CCActionInterval   actionToBack = CCSkewTo.actionWithDuration(2, 0, 0);
            CCActionInterval   actionBy     = CCSkewBy.actionWithDuration(2, 0.0f, -90.0f);
            CCActionInterval   actionBy2    = CCSkewBy.actionWithDuration(2, 45.0f, 45.0f);
            CCFiniteTimeAction actionByBack = actionBy.reverse();

            m_tamara.runAction(CCSequence.actions(actionTo, actionToBack));
            m_grossini.runAction(CCSequence.actions(actionBy, actionByBack));

            m_kathia.runAction(CCSequence.actions(actionBy2, actionBy2.reverse()));
        }
Exemplo n.º 6
0
        public override void onEnter()
        {
            // todo: CCLayerColor hasn't been implemented

            base.onEnter();

            m_tamara.removeFromParentAndCleanup(true);
            m_grossini.removeFromParentAndCleanup(true);
            m_kathia.removeFromParentAndCleanup(true);

            CCSize boxSize = new CCSize(100.0f, 100.0f);

            CCLayerColor box = CCLayerColor.layerWithColor(new ccColor4B(255, 255, 0, 255));

            box.anchorPoint = new CCPoint(0, 0);
            box.position    = new CCPoint(190, 110);
            box.contentSize = boxSize;

            CCLayerColor uL = CCLayerColor.layerWithColor(new ccColor4B(255, 0, 0, 255));

            box.addChild(uL);
            uL.contentSize = new CCSize(markrside, markrside);
            uL.position    = new CCPoint(0.0f, boxSize.height - markrside);
            uL.anchorPoint = new CCPoint(0, 0);

            CCLayerColor uR = CCLayerColor.layerWithColor(new ccColor4B(0, 0, 255, 255));

            box.addChild(uR);
            uR.contentSize = new CCSize(markrside, markrside);
            uR.position    = new CCPoint(boxSize.width - markrside, boxSize.height - markrside);
            uR.anchorPoint = new CCPoint(0, 0);
            addChild(box);

            CCActionInterval actionTo      = CCSkewTo.actionWithDuration(2, 0.0f, 2.0f);
            CCActionInterval rotateTo      = CCRotateTo.actionWithDuration(2, 61.0f);
            CCActionInterval actionScaleTo = CCScaleTo.actionWithDuration(2, -0.44f, 0.47f);

            CCActionInterval actionScaleToBack = CCScaleTo.actionWithDuration(2, 1.0f, 1.0f);
            CCActionInterval rotateToBack      = CCRotateTo.actionWithDuration(2, 0);
            CCActionInterval actionToBack      = CCSkewTo.actionWithDuration(2, 0, 0);

            box.runAction(CCSequence.actions(actionTo, actionToBack));
            box.runAction(CCSequence.actions(rotateTo, rotateToBack));
            box.runAction(CCSequence.actions(actionScaleTo, actionScaleToBack));
        }
Exemplo n.º 7
0
        public static CCSkewTo actionWithDuration(float t, float sx, float sy)
        {
            CCSkewTo pSkewTo = new CCSkewTo();

            if (pSkewTo != null)
            {
                if (pSkewTo.initWithDuration(t, sx, sy))
                {
                    //pSkewTo->autorelease();
                }
                else
                {
                    //CC_SAFE_DELETE(pSkewTo);
                }
            }

            return(pSkewTo);
        }
Exemplo n.º 8
0
        public static CCSkewTo actionWithDuration(float t, float sx, float sy)
        {
            CCSkewTo pSkewTo = new CCSkewTo();

            if (pSkewTo != null)
            {
                if (pSkewTo.initWithDuration(t, sx, sy))
                {
                    //pSkewTo->autorelease();
                }
                else
                {
                    //CC_SAFE_DELETE(pSkewTo);
                }
            }

            return pSkewTo;
        }
Exemplo n.º 9
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone   pNewZone = null;
            CCSkewTo pCopy    = null;

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

            base.copyWithZone(pZone);

            pCopy.initWithDuration(Duration, m_fEndSkewX, m_fEndSkewY);

            //CC_SAFE_DELETE(pNewZone);
            return(pCopy);
        }
Exemplo n.º 10
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone pNewZone = null;
            CCSkewTo pCopy = null;

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

            base.copyWithZone(pZone);

            pCopy.initWithDuration(Duration, m_fEndSkewX, m_fEndSkewY);

            //CC_SAFE_DELETE(pNewZone);
            return pCopy;
        }
Exemplo n.º 11
0
 protected CCSkewTo(CCSkewTo skewTo) : base(skewTo)
 {
     InitWithDuration(skewTo.m_fDuration, skewTo.m_fEndSkewX, skewTo.m_fStartSkewY);
 }
Exemplo n.º 12
0
 protected CCSkewTo(CCSkewTo skewTo) : base(skewTo)
 {
     InitWithDuration(skewTo.m_fDuration, skewTo.m_fEndSkewX, skewTo.m_fStartSkewY);
 }