Exemplo n.º 1
0
        public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime, Vector2 offset, Camera camera, DebugGeometry debugGeometry)
        {
            var tex = GetTexture();
            var s = Math.Max(tex.Region.Width, tex.Region.Height);
            spriteBatch.Draw(tex.Texture, Position + offset, tex.Region, Color * Alpha, Rotation, new Vector2(tex.Region.Width / 2, tex.Region.Height / 2), Size / s, SpriteEffects.None, 0f);

            // DrawHP
            if (DrawHP)
            {
                Vector2 start = new Vector2(-10f, -Size / 2 - 5f);
                start = new Vector2(start.X * Maf.Cos(-camera.FollowedObject.Rotation) + start.Y * Maf.Sin(-camera.FollowedObject.Rotation), -start.X * Maf.Sin(-camera.FollowedObject.Rotation) + start.Y * Maf.Cos(-camera.FollowedObject.Rotation));
                debugGeometry.DrawLine(Position + start + offset, 20f, camera.FollowedObject.Rotation, Color.Red);
                debugGeometry.DrawLine(Position + start + offset, 20f * HP / MaxHP, camera.FollowedObject.Rotation, Color.Green);
            }
        }
Exemplo n.º 2
0
 protected override void LoadContent()
 {
     _spriteBatch = new SpriteBatch(GraphicsDevice);
     _debugGeometry = new DebugGeometry(GraphicsDevice);
     TextureManager.LoadTextures(GraphicsDevice, Content);
     //_song = Content.Load<Song>("Music/SOUP - Q7");
 }