mirror of
https://github.com/eliasstepanik/2DEngine.git
synced 2026-01-11 21:18:27 +00:00
33 lines
838 B
C#
33 lines
838 B
C#
using System.Numerics;
|
|
using Raylib_cs;
|
|
using RaylibTest.Support;
|
|
|
|
namespace RaylibTest.Shapes;
|
|
|
|
public class Circle : GameObject
|
|
{
|
|
public float Radius { get; set; }
|
|
public Color Color { get; set; }
|
|
|
|
public Circle(Vector2 position, float radius, Color color) : base(position)
|
|
{
|
|
Radius = radius;
|
|
Color = color;
|
|
}
|
|
|
|
public override void Draw()
|
|
{
|
|
base.Draw();
|
|
Raylib.DrawCircleV(Position,Radius, Color);
|
|
}
|
|
|
|
public bool Intersects(Circle other)
|
|
{
|
|
return Raylib.CheckCollisionCircles(Position, Radius, other.Position, other.Radius);
|
|
}
|
|
|
|
public bool Intersects(Rectangle other)
|
|
{
|
|
return Raylib.CheckCollisionCircleRec(Position, Radius, new Raylib_cs.Rectangle(other.Position.X,other.Position.Y,other.Size.X,other.Size.Y));
|
|
}
|
|
} |