Example #1
0
        public override CCFiniteTimeAction Reverse()
        {
            CCBezierConfig r;

            r.EndPosition = -m_sConfig.EndPosition;
            r.ControlPoint1 = m_sConfig.ControlPoint2 + -m_sConfig.EndPosition;
            r.ControlPoint2 = m_sConfig.ControlPoint1 + -m_sConfig.EndPosition;

            var action = new CCBezierBy(m_fDuration, r);
            return action;
        }
Example #2
0
        public override CCFiniteTimeAction Reverse()
        {
            ccBezierConfig r;

            r.EndPosition   = -m_sConfig.EndPosition;
            r.ControlPoint1 = m_sConfig.ControlPoint2 + -m_sConfig.EndPosition;
            r.ControlPoint2 = m_sConfig.ControlPoint1 + -m_sConfig.EndPosition;

            var action = new CCBezierBy(m_fDuration, r);

            return(action);
        }
Example #3
0
 protected CCBezierBy(CCBezierBy bezierBy) : base(bezierBy)
 {
     InitWithDuration(bezierBy.m_fDuration, bezierBy.m_sConfig);
 }
Example #4
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = CCDirector.SharedDirector.WinSize;

            //
            // startPosition can be any coordinate, but since the movement
            // is relative to the Bezier curve, make it (0,0)
            //

            centerSprites(3);

            // sprite 1
            CCBezierConfig bezier;
            bezier.ControlPoint1 = new CCPoint(0, s.Height / 2);
            bezier.ControlPoint2 = new CCPoint(300, -s.Height / 2);
            bezier.EndPosition = new CCPoint(300, 100);

            var bezierForward = new CCBezierBy (3, bezier);
            var bezierBack = bezierForward.Reverse();
            var rep = new CCRepeatForever ((CCActionInterval)new CCSequence(bezierForward, bezierBack));


            // sprite 2
            m_tamara.Position = new CCPoint(80, 160);
            CCBezierConfig bezier2;
            bezier2.ControlPoint1 = new CCPoint(100, s.Height / 2);
            bezier2.ControlPoint2 = new CCPoint(200, -s.Height / 2);
            bezier2.EndPosition = new CCPoint(240, 160);

            var bezierTo1 = new CCBezierTo (2, bezier2);

            // sprite 3
            m_kathia.Position = new CCPoint(400, 160);
            var bezierTo2 = new CCBezierTo (2, bezier2);

            m_grossini.RunAction(rep);
            m_tamara.RunAction(bezierTo1);
            m_kathia.RunAction(bezierTo2);
        }
Example #5
0
        public override void RunActionsInSprite(CCSprite sprite)
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            // sprite 1
            CCBezierConfig bezier;
            bezier.ControlPoint1 = new CCPoint(0, s.Height / 2);
            bezier.ControlPoint2 = new CCPoint(300, -s.Height / 2);
            bezier.EndPosition = new CCPoint(300, 100);

            CCBezierBy bezierForward = new CCBezierBy(3, bezier);
            CCBezierBy bezierBack = (CCBezierBy) bezierForward.Reverse();
            CCSequence seq = new CCSequence(bezierForward, bezierBack);
            CCRepeatForever rep = new CCRepeatForever(seq);
            sprite.RunAction(rep);

            sprite.RunAction(
                new CCRepeatForever(
                    new CCSequence(
                        new CCMoveBy(0.05f, new CCPoint(10, 0)),
                        new CCMoveBy(0.05f, new CCPoint(-10, 0))
                        )
                    )
                );
        }
Example #6
0
        protected CCBezierBy (CCBezierBy bezierBy) : base (bezierBy)
        {
            InitWithDuration(bezierBy.m_fDuration, bezierBy.m_sConfig);

        }