refactor: Possible Bugs
This commit is contained in:
parent
ed15238dcd
commit
385defd8e6
|
@ -12,17 +12,15 @@ public class Collider2DCircleBehaviour : BehaviourOverride, ICircleCollider2D
|
||||||
public Action<ICollider2D, ICollider2D>? OnCollisionPreResolve { get; set; } = null;
|
public Action<ICollider2D, ICollider2D>? OnCollisionPreResolve { get; set; } = null;
|
||||||
public Action<ICollider2D, ICollider2D>? OnCollisionResolved { get; set; } = null;
|
public Action<ICollider2D, ICollider2D>? OnCollisionResolved { get; set; } = null;
|
||||||
|
|
||||||
public Action<IAssignableTransform>? OnTransformAssigned { get; set; } = null;
|
|
||||||
|
|
||||||
|
|
||||||
public Circle CircleWorld { get; protected set; } = new(Vector2D.Zero, 1f);
|
public Circle CircleWorld { get; protected set; } = new(Vector2D.Zero, 1f);
|
||||||
public Circle CircleLocal { get; set; } = new(Vector2D.Zero, 1f);
|
public Circle CircleLocal { get; set; } = new(Vector2D.Zero, 1f);
|
||||||
public IRigidBody2D? RigidBody2D { get; set; } = null;
|
public IRigidBody2D? RigidBody2D { get; set; } = null;
|
||||||
|
|
||||||
|
|
||||||
ITransform IAssignableTransform.Transform => GameObject.Transform;
|
ITransform IAssignableTransform.Transform => Transform;
|
||||||
|
Action<IAssignableTransform>? IAssignableTransform.OnTransformAssigned { get => GameObject.OnTransformAssigned; set => GameObject.OnTransformAssigned = value; }
|
||||||
public bool Assign(ITransform transform) => GameObject.Assign(transform);
|
bool IAssignableTransform.Assign(ITransform transform) => GameObject.Assign(transform);
|
||||||
|
|
||||||
public virtual void Recalculate() => CircleWorld = Transform.TransformCircle(CircleLocal).Displace(Transform.Position);
|
public virtual void Recalculate() => CircleWorld = Transform.TransformCircle(CircleLocal).Displace(Transform.Position);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,6 @@ public class Collider2DShapeBehaviour : BehaviourOverride, IShapeCollider2D
|
||||||
public Action<ICollider2D, ICollider2D>? OnCollisionPreResolve { get; set; } = null;
|
public Action<ICollider2D, ICollider2D>? OnCollisionPreResolve { get; set; } = null;
|
||||||
public Action<ICollider2D, ICollider2D>? OnCollisionResolved { get; set; } = null;
|
public Action<ICollider2D, ICollider2D>? OnCollisionResolved { get; set; } = null;
|
||||||
|
|
||||||
public Action<IAssignableTransform>? OnTransformAssigned { get; set; } = null;
|
|
||||||
|
|
||||||
|
|
||||||
public Shape ShapeWorld => _shapeWorld;
|
public Shape ShapeWorld => _shapeWorld;
|
||||||
public Shape ShapeLocal { get; set; } = new([new(1f, 1f), new(-1f, 1f), new(-1f, -1f), new(1f, -1f)]);
|
public Shape ShapeLocal { get; set; } = new([new(1f, 1f), new(-1f, 1f), new(-1f, -1f), new(1f, -1f)]);
|
||||||
|
@ -21,9 +19,9 @@ public class Collider2DShapeBehaviour : BehaviourOverride, IShapeCollider2D
|
||||||
|
|
||||||
protected Shape _shapeWorld = new([new(1f, 1f), new(-1f, 1f), new(-1f, -1f), new(1f, -1f)]);
|
protected Shape _shapeWorld = new([new(1f, 1f), new(-1f, 1f), new(-1f, -1f), new(1f, -1f)]);
|
||||||
|
|
||||||
ITransform IAssignableTransform.Transform => GameObject.Transform;
|
ITransform IAssignableTransform.Transform => Transform;
|
||||||
|
Action<IAssignableTransform>? IAssignableTransform.OnTransformAssigned { get => GameObject.OnTransformAssigned; set => GameObject.OnTransformAssigned = value; }
|
||||||
public bool Assign(ITransform transform) => GameObject.Assign(transform);
|
bool IAssignableTransform.Assign(ITransform transform) => GameObject.Assign(transform);
|
||||||
|
|
||||||
public virtual void Recalculate() => Transform.TransformShape(ShapeLocal, ref _shapeWorld);
|
public virtual void Recalculate() => Transform.TransformShape(ShapeLocal, ref _shapeWorld);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue