BREAKING CHANGE: renamed original Behaviour class to BehaviourInternal, and replaced it with BehaviourBase
Original Behaviour was using old methods for detecting entering/exiting universe, they are now all under the same hood and the original is kept for UniverseEntranceManager because it needs to enter the universe without itself. The internal behaviour kept under a subnamespace of "Core.Internal" for the purpose that it might come in handy for other use cases.
This commit is contained in:
@@ -4,7 +4,7 @@ using Engine.Core;
|
||||
|
||||
namespace Engine.Physics2D;
|
||||
|
||||
public class PhysicsEngine2D : Behaviour, IPreUpdate, IPhysicsEngine2D
|
||||
public class PhysicsEngine2D : Behaviour, IEnterUniverse, IExitUniverse, IPreUpdate, IPhysicsEngine2D
|
||||
{
|
||||
public Event<IPhysicsEngine2D, float> OnPhysicsIteration { get; } = new();
|
||||
public Event<IPhysicsEngine2D, float> OnPhysicsStep { get; } = new();
|
||||
@@ -224,7 +224,7 @@ public class PhysicsEngine2D : Behaviour, IPreUpdate, IPhysicsEngine2D
|
||||
rigidBody.Transform.Rotation += rigidBody.AngularVelocity * intervalDeltaTime;
|
||||
}
|
||||
|
||||
protected override void OnEnteredUniverse(IUniverse universe)
|
||||
public void EnterUniverse(IUniverse universe)
|
||||
{
|
||||
physicsPreUpdateCollector.Assign(universe);
|
||||
physicsUpdateCollector.Assign(universe);
|
||||
@@ -234,7 +234,7 @@ public class PhysicsEngine2D : Behaviour, IPreUpdate, IPhysicsEngine2D
|
||||
rigidBodyCollector.Assign(universe);
|
||||
}
|
||||
|
||||
protected override void OnExitedUniverse(IUniverse universe)
|
||||
public void ExitUniverse(IUniverse universe)
|
||||
{
|
||||
physicsPreUpdateCollector.Unassign();
|
||||
physicsUpdateCollector.Unassign();
|
||||
|
Reference in New Issue
Block a user