예제 #1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            Color drawCol = this.Colour;

            if (this.flashTimer > TimeSpan.Zero)
            {
                drawCol = Color.Lerp(this.Colour, Color.White, (float)(this.flashTimer.TotalMilliseconds / this.flashTime.TotalMilliseconds));
            }

            spriteBatch.Draw(texture, Level.TwoDToIso(Position), null, drawCol, 0.0f, new Vector2(Tile.SIDE_LENGTH, 0), 1.0f, SpriteEffects.None, 1.0f);
        }
예제 #2
0
        /// <summary>
        /// Gets the transformation matrix of the camera for use with SpriteBatch.Begin().
        /// </summary>
        /// <returns>This camera's transformation matrix.</returns>
        public Matrix GetTransformMatrix()
        {
            if (transformMatrixDirty)
            {
                Vector2 screenPosition = zoom * Level.TwoDToIso(position);
                translationVector = new Vector3(-(float)Math.Floor(screenPosition.X - (float)State.ScreenManager.Instance.ScreenWidth / 2.0f), -(float)Math.Floor(screenPosition.Y - (float)State.ScreenManager.Instance.ScreenHeight / 2.0f), 0.0f);
                scaleVector       = new Vector3(zoom, zoom, 1);

                Matrix.CreateTranslation(ref translationVector, out translationMatrix);
                Matrix.CreateScale(ref scaleVector, out scaleMatrix);

                transformMatrix = scaleMatrix * translationMatrix;
            }

            return(transformMatrix);
        }
예제 #3
0
        public void Draw(SpriteBatch spriteBatch)
        {
            foreach (MapRow row in Rows)
            {
                foreach (Tile tile in row.Columns)
                {
                    tile.Draw(spriteBatch);
                }
            }

            this.Player.Draw(spriteBatch);

            Vector2 textOffset = -hudFont.MeasureString(this.Score.ToString()) * new Vector2(0.5f, 0.0f);

            spriteBatch.DrawString(hudFont, this.Score.ToString(), new Vector2(0, -30) + textOffset, Color.White);
            textOffset = -hudFont.MeasureString("Stage " + this.Stage.ToString()) * new Vector2(0.5f, 0.0f);
            spriteBatch.DrawString(hudFont, "Stage " + this.Stage.ToString(), Level.TwoDToIso(new Vector2(Bounds.Right, Bounds.Bottom + 10)) + textOffset, Color.White);
        }
예제 #4
0
 public void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Draw(this.crossHairTexture, Level.TwoDToIso(this.TwoDPosition), null, Color.White, 0.0f, new Vector2(10, 5), 1.0f, SpriteEffects.None, 0.1f);
     spriteBatch.Draw(this.texture, Level.ThreeDToIso(this.Position), null, this.Colour, 0.0f, new Vector2(7, 15), 1.0f, SpriteEffects.None, 0.0f);
 }