From 15788f2eca29647fbce98c9650f03f11d62b6976 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Sat, 27 Jan 2024 20:20:28 +0300 Subject: [PATCH] refactor: Improved Shape & Circle Code Readability --- Engine.Physics2D/Collider2DCircleBehaviour.cs | 5 ++--- Engine.Physics2D/Collider2DShapeBehaviour.cs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Engine.Physics2D/Collider2DCircleBehaviour.cs b/Engine.Physics2D/Collider2DCircleBehaviour.cs index a11be89..d652636 100644 --- a/Engine.Physics2D/Collider2DCircleBehaviour.cs +++ b/Engine.Physics2D/Collider2DCircleBehaviour.cs @@ -1,4 +1,3 @@ -using Syntriax.Engine.Core; using Syntriax.Engine.Physics2D.Abstract; using Syntriax.Engine.Physics2D.Primitives; @@ -6,8 +5,8 @@ namespace Syntriax.Engine.Physics2D; public class Collider2DCircleBehaviour : Collider2DBehaviourBase, ICircleCollider2D { - public Circle CircleWorld { get; protected set; } = new(Vector2D.Zero, 1f); - public Circle CircleLocal { get; set; } = new(Vector2D.Zero, 1f); + public Circle CircleWorld { get; protected set; } = Circle.UnitCircle; + public Circle CircleLocal { get; set; } = Circle.UnitCircle; public override void CalculateCollider() => CircleWorld = Transform.TransformCircle(CircleLocal); diff --git a/Engine.Physics2D/Collider2DShapeBehaviour.cs b/Engine.Physics2D/Collider2DShapeBehaviour.cs index ca2b076..f225ad0 100644 --- a/Engine.Physics2D/Collider2DShapeBehaviour.cs +++ b/Engine.Physics2D/Collider2DShapeBehaviour.cs @@ -5,10 +5,9 @@ namespace Syntriax.Engine.Physics2D; public class Collider2DShapeBehaviour : Collider2DBehaviourBase, IShapeCollider2D { - public Shape ShapeWorld => _shapeWorld; - public Shape ShapeLocal { get; set; } = new([new(1f, 1f), new(-1f, 1f), new(-1f, -1f), new(1f, -1f)]); + public Shape ShapeWorld { get; protected set; } = Shape.Box; + public Shape ShapeLocal { get; set; } = Shape.Box; - protected Shape _shapeWorld = new([new(1f, 1f), new(-1f, 1f), new(-1f, -1f), new(1f, -1f)]); public override void CalculateCollider() => Transform.TransformShape(ShapeLocal, ref _shapeWorld);