Beispiel #1
0
        /**
         * A display object rig to access pan, rotation and zoom actions.
         * @param viewport the starting viewable rectangle including position
         * @param startPosition Point reprsenting the position that the camera will return to on reset
         * @param easingPan The value used to determine how much the camera should move each step towards its target in X and Y.
         * @param easingZoom The value used to determine how much the camera should move each step towards its target for scale.
         * @param easingRotate The value used to determine how much the camera should move each step towards its target for rotation.
         * @param boundingRect A Rectangle that constrains the movement of the camera
         */
        public CameraSprite(Rectangle viewport, Point startPosition=null, float easingPan=1f, float easingZoom=1f, float easingRotate=1, Rectangle boundingRect=null, Juggler juggler=null)
        {
            _juggler = juggler;

            _harness=new Harness();  // The harness is a container to manage rotation, scale and shaking without modifying the pivot and other properties of the main camera.
            _world=new World(this);

            _viewport=viewport;

            this.startPosition=startPosition;

            _easingPan=easingPan;
            _easingZoom=easingZoom;
            _easingRotate=easingRotate;

            if (boundingRect != null)
            {
                this.boundingRect=boundingRect;
            }
            else
            {
                this.boundingRect=NO_BOUNDS.toRectangle();
            }

            _harness.center=new Point(_viewport.x + _viewport.width / 2, _viewport.y + _viewport.height / 2);
            base.addChildAt(_harness, 0);
            _harness.addChild(_world);
        }
Beispiel #2
0
 public FrameSprite(Juggler juggler)
     : base()
 {
     mJuggler = juggler;
 }
Beispiel #3
0
 void Awake()
 {
     mJuggler = new Juggler();
 }