diff options
Diffstat (limited to 'Penguloon/Objects')
| -rw-r--r-- | Penguloon/Objects/ObjectBase.cs | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/Penguloon/Objects/ObjectBase.cs b/Penguloon/Objects/ObjectBase.cs index d1ed0d4..19a222c 100644 --- a/Penguloon/Objects/ObjectBase.cs +++ b/Penguloon/Objects/ObjectBase.cs @@ -56,11 +56,15 @@ namespace Penguloon.Objects this.Position = position; CreateUpgrades(); + + RangeCircle = ContentManager.GetTexture("UI/circle"); } public ObjectBase(Map map) { this.Map = map; + + RangeCircle = ContentManager.GetTexture("UI/circle"); } public virtual void CreateUpgrades() @@ -151,9 +155,6 @@ namespace Penguloon.Objects public void Draw(float deltaTime) { - if(RangeCircle == null) - RangeCircle = CreateCircle((int)Range * 2); - float rot = (float)Rotation + (float)MathHelper.PiOver2; if (!ShouldRotate) @@ -199,35 +200,7 @@ namespace Penguloon.Objects public abstract void DrawUnique(float deltaTime); - public Texture2D CreateCircle(int radius) - { - Texture2D texture = new Texture2D(Map.ParentScene.Main.GraphicsDevice, radius, radius); - Color[] colorData = new Color[radius * radius]; - - float diam = radius / 2f; - float diamsq = diam * diam; - - for (int x = 0; x < radius; x++) - { - for (int y = 0; y < radius; y++) - { - int index = x * radius + y; - Vector2 pos = new Vector2(x - diam, y - diam); - if (pos.LengthSquared() <= diamsq) - { - colorData[index] = Color.FromNonPremultiplied(200, 0, 0, 50); - } - else - { - colorData[index] = Color.Transparent; - } - } - } - - texture.SetData(colorData); - return texture; - } - + private double GetRotation(Vector2 enemyPos) { double radians = Math.Atan2(enemyPos.Y - Center.Y, enemyPos.X - Center.X); |
