public void DrawGraphicsEvent(GraphicsEvent graphicsEvent) { var spriteEffect = graphicsEvent as SpriteGraphicsEffect; if (spriteEffect != null) { var progress = spriteEffect.GetProgress(Game.Match.GameTime); var texture = Game.Content.Load <Texture2D>("Textures/" + spriteEffect.SpriteName); var pos = WorldToScreen(spriteEffect.Position(Game.Match.GameTime)); var rotation = spriteEffect.Rotation(Game.Match.GameTime); var scale = spriteEffect.Scale(Game.Match.GameTime); SpriteBatch.Draw( texture, position: pos, rotation: rotation, scale: new Vector2(scale, scale), origin: new Vector2(texture.Width / 2, texture.Height / 2) ); } var textEffect = graphicsEvent as TextEffect; if (textEffect != null) { var progress = textEffect.GetProgress(Game.Match.GameTime); var pos = WorldToScreen(textEffect.Position(Game.Match.GameTime)); var rotation = textEffect.Rotation(Game.Match.GameTime); var scale = textEffect.Scale(Game.Match.GameTime); var opacity = textEffect.Opacity(Game.Match.GameTime); DrawText( textEffect.Text, pos, scale * textEffect.TextSize, new Color(textEffect.TextColor, (int)((opacity * 255) * textEffect.TextColor.A)), 2, true, true ); } }
public void DrawGraphicsEvent(GraphicsEvent graphicsEvent) { var spriteEffect = graphicsEvent as SpriteGraphicsEffect; if(spriteEffect != null) { var progress = spriteEffect.GetProgress(Game.Match.GameTime); var texture = Game.Content.Load<Texture2D>("Textures/"+spriteEffect.SpriteName); var pos = WorldToScreen(spriteEffect.Position(Game.Match.GameTime)); var rotation = spriteEffect.Rotation(Game.Match.GameTime); var scale = spriteEffect.Scale(Game.Match.GameTime); SpriteBatch.Draw( texture, position: pos, rotation: rotation, scale: new Vector2(scale, scale), origin: new Vector2(texture.Width / 2, texture.Height / 2) ); } var textEffect = graphicsEvent as TextEffect; if (textEffect != null) { var progress = textEffect.GetProgress(Game.Match.GameTime); var pos = WorldToScreen(textEffect.Position(Game.Match.GameTime)); var rotation = textEffect.Rotation(Game.Match.GameTime); var scale = textEffect.Scale(Game.Match.GameTime); var opacity = textEffect.Opacity(Game.Match.GameTime); DrawText( textEffect.Text, pos, scale * textEffect.TextSize, new Color(textEffect.TextColor, (int)((opacity * 255) * textEffect.TextColor.A)), 2, true, true ); } }