예제 #1
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);
                }
            }
        }
예제 #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);
            }
        }