예제 #1
0
        void MoveClouds()
        {
            if ((windSpeedChanged == true) &&
                (windSpeed > 0))
            {
                CCRepeatForever cloudsAnimation;
                float           targetPositionX      = (windBlowingRight == true ? layerWidth + 350 : -350f);
                CCSequence      cloudsMovingSequence = new CCSequence(new CCMoveBy(0, new CCPoint(0, 0)));
                CCMoveTo        moveAcrossTo         = new CCMoveTo(windSpeed * 3f, new CCPoint(targetPositionX, cloudsParallax.PositionY));
                CCEaseSineIn    easeInAcrossTo       = new CCEaseSineIn(moveAcrossTo);

                cloudsMovingSequence = new CCSequence(moveAcrossTo,
                                                      new CCCallFunc(() => cloudsParallax.PositionX = (windBlowingRight == true ? -350f :
                                                                                                       layerWidth + 350)));
                cloudsAnimation = new CCRepeatForever(cloudsMovingSequence);

                cloudsParallax.StopAllActions();
                cloudsParallax.RunActions(easeInAcrossTo, cloudsAnimation);
            }
            else if (windSpeed < float.Epsilon)
            {
                float         targetPositionX = (windBlowingRight == true ? previousWindSpeed * 7 : previousWindSpeed * -7);
                CCEaseSineOut easeOutBy       = new CCEaseSineOut(new CCMoveBy(previousWindSpeed * 1.2f, new CCPoint(targetPositionX, 0)));

                cloudsParallax.StopAllActions();
                cloudsParallax.RunAction(easeOutBy);
            }
        }
예제 #2
0
        void MoveClouds(float dy)
        {
            parallaxClouds.StopAllActions();
            var moveClouds = new CCMoveBy(1.0f, new CCPoint(0, dy * 0.1f));

            parallaxClouds.RunAction(moveClouds);
        }