ObjectCircle
public class ObjectCircle : MonoBehaviour
{
public SCircle circle = new SCircle();
public SCircle GetWorldCircle()
{
SCircle n = new SCircle();
if (circle != null)
{
n.position.x = circle.position.x + (sfloat)transform.position.x;
n.position.y = circle.position.y + (sfloat)transform.position.y;
n.radius = circle.radius;
}
return n;
}
}
A Unity component which holds a SCircle to represent a circle belonging to a Unity game object. This could represent damage or hitbox areas for combat or perhaps an area where an event triggers.
There are classes added to the editor folder so the circle can be seen when a game object with this component is selected in the editor view in Unity.
Methods
public SCircle GetWorldCircle()
The SCircle’s x,y positions are relative the game objects, however this method converts that position to world coordinates so it can be used correctly in any mathematical calculations