Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
AroundShaderDrawStyle.cs
Go to the documentation of this file.
1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
3 using Terraria;
4 
5 namespace Loot.Api.Graphics.Shader.Style
6 {
11  {
12  public enum OffsetStyle
13  {
17  NORMAL,
21  ALTERNATE
22  }
23 
25 
26  public AroundShaderDrawStyle(OffsetStyle offsetStyle = OffsetStyle.NORMAL, ShaderDrawStyleProperties properties = null) : base(properties)
27  {
28  this.offsetStyle = offsetStyle;
29  }
30 
36  public Vector2 GetDrawOffset(int i)
37  {
38  if (offsetStyle == OffsetStyle.NORMAL)
39  {
40  return new Vector2(0, Properties.DrawDistance).RotatedBy((float)i / Properties.NumSegments * MathHelper.TwoPi);
41  }
42  if (offsetStyle == OffsetStyle.ALTERNATE)
43  {
44  var halfDist = Properties.DrawDistance / 2;
45  var offY = halfDist + halfDist * i % halfDist;
46  return new Vector2(0, offY).RotatedBy((float)i / Properties.NumSegments * MathHelper.TwoPi);
47  }
48  return Vector2.Zero;
49  }
50 
51  public override void DrawShader(SpriteBatch spriteBatch, ShaderEntity entity)
52  {
53  var centerPos = entity.DrawData.position;
54  for (int i = 0; i < Properties.NumSegments; i++)
55  {
56  entity.DrawData.position = centerPos + GetDrawOffset(i);
57  base.DrawShader(spriteBatch, entity);
58  }
59  }
60  }
61 }
Vector2 GetDrawOffset(int i)
Gets the draw offset for the shader Different styles can be programmed to achieve different looks ...
AroundShaderDrawStyle(OffsetStyle offsetStyle=OffsetStyle.NORMAL, ShaderDrawStyleProperties properties=null)
override void DrawShader(SpriteBatch spriteBatch, ShaderEntity entity)
Defines a Shader entity, part of GraphicsEntity<T> The entity defines a particular &#39;shader&#39; "of" the ...
Definition: ShaderEntity.cs:16
Defines a drawing style that will draw a shader around the subject