コード例 #1
0
ファイル: CameraController.cs プロジェクト: jrs1498/GDDGame1
 //-------------------------------------------------------------------------
 /// <summary>
 /// Default CameraController constructor. Provides clean movement for
 /// a Camera2D.
 /// </summary>
 /// <param name="camera">Camera to control</param>
 public CameraController(String name, Camera2D camera)
     : base(name)
 {
     _camera = camera;
     setRotationIntervalTarget(7);
     setZoomTarget(MIN_ZOOM);
     setFreeLook(false);
 }
コード例 #2
0
ファイル: Entity.cs プロジェクト: jrs1498/GDDGame1
        //-------------------------------------------------------------------------
        /// <summary>
        /// Draw this Entity.
        /// </summary>
        /// <param name="spriteBatch">Renders Texture2D.</param>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        /// <param name="dt">Precomputed delta time.</param>
        /// <param name="position">Screen render coordinates.</param>
        /// <param name="rotation">Rotation amount about Z axis.</param>
        /// <param name="scale">Scale amount.</param>
        public virtual void draw(
            SpriteBatch spriteBatch,
            Camera2D camera,
            GameTime gameTime,
            float dt,
            Vector2 position,
            float rotation,
            Vector2 scale)
        {
            if (_active)
            {
                _stateTime += dt;
                Direction dir = camera.getRelativeDirectionView(_directionView);

                if (_drawable is DrawableAnimated)
                {
                    (_drawable as DrawableAnimated).draw(
                        spriteBatch,
                        position,
                        _color,
                        rotation,
                        scale,
                        _stateTime,
                        _animationState,
                        dir);
                }

                else
                {
                    _drawable.draw(
                        spriteBatch,
                        position,
                        _color,
                        rotation,
                        scale);
                }
            }
        }
コード例 #3
0
ファイル: Entity.cs プロジェクト: jrs1498/GDDGame1
        //-------------------------------------------------------------------------
        /// <summary>
        /// Draw this Entity.
        /// </summary>
        /// <param name="spriteBatch">Renders Texture2D.</param>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        /// <param name="dt">Precomputed delta time.</param>
        /// <param name="position">Screen render coordinates.</param>
        /// <param name="rotation">Rotation amount about Z axis.</param>
        /// <param name="scale">Scale amount.</param>
        public virtual void draw(
            SpriteBatch     spriteBatch,
            Camera2D        camera,
            GameTime        gameTime,
            float           dt,
            Vector2         position,
            float           rotation,
            Vector2         scale)
        {
            if (_active)
            {
                _stateTime += dt;
                Direction dir = camera.getRelativeDirectionView(_directionView);

                if (_drawable is DrawableAnimated)
                    (_drawable as DrawableAnimated).draw(
                        spriteBatch,
                        position,
                        _color,
                        rotation,
                        scale,
                        _stateTime,
                        _animationState,
                        dir);

                else
                    _drawable.draw(
                        spriteBatch,
                        position,
                        _color,
                        rotation,
                        scale);
            }
        }