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:
@@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Engine.Core;
|
||||
|
||||
public class DrawManager : Behaviour
|
||||
public class DrawManager : Behaviour, IEnterUniverse, IExitUniverse
|
||||
{
|
||||
// We use Descending order because draw calls are running from last to first
|
||||
private static Comparer<int> SortByDescendingPriority() => Comparer<int>.Create((x, y) => y.CompareTo(x));
|
||||
@@ -30,7 +30,7 @@ public class DrawManager : Behaviour
|
||||
postDrawEntities[i].PostDraw();
|
||||
}
|
||||
|
||||
protected override void OnEnteredUniverse(IUniverse universe)
|
||||
public void EnterUniverse(IUniverse universe)
|
||||
{
|
||||
preDrawEntities.Assign(universe);
|
||||
drawEntities.Assign(universe);
|
||||
@@ -41,7 +41,7 @@ public class DrawManager : Behaviour
|
||||
universe.OnPostDraw.AddListener(OnPostDraw);
|
||||
}
|
||||
|
||||
protected override void OnExitedUniverse(IUniverse universe)
|
||||
public void ExitUniverse(IUniverse universe)
|
||||
{
|
||||
preDrawEntities.Unassign();
|
||||
drawEntities.Unassign();
|
||||
|
@@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Engine.Core;
|
||||
|
||||
public class UniverseEntranceManager : Behaviour
|
||||
public class UniverseEntranceManager : Internal.BehaviourIndependent
|
||||
{
|
||||
// We use Ascending order because we are using reverse for loop to call them
|
||||
private static Comparer<int> SortByAscendingPriority() => Comparer<int>.Create((x, y) => x.CompareTo(y));
|
||||
|
@@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Engine.Core;
|
||||
|
||||
public class UpdateManager : Behaviour
|
||||
public class UpdateManager : Behaviour, IEnterUniverse, IExitUniverse
|
||||
{
|
||||
// We use Ascending order because we are using reverse for loop to call them
|
||||
private static Comparer<int> SortByAscendingPriority() => Comparer<int>.Create((x, y) => x.CompareTo(y));
|
||||
@@ -16,7 +16,7 @@ public class UpdateManager : Behaviour
|
||||
|
||||
private readonly List<IFirstFrameUpdate> toCallFirstFrameUpdates = new(32);
|
||||
|
||||
protected override void OnEnteredUniverse(IUniverse universe)
|
||||
public void EnterUniverse(IUniverse universe)
|
||||
{
|
||||
firstFrameUpdates.Assign(universe);
|
||||
lastFrameUpdates.Assign(universe);
|
||||
@@ -30,7 +30,7 @@ public class UpdateManager : Behaviour
|
||||
universe.OnPostUpdate.AddListener(OnPostUpdate);
|
||||
}
|
||||
|
||||
protected override void OnExitedUniverse(IUniverse universe)
|
||||
public void ExitUniverse(IUniverse universe)
|
||||
{
|
||||
firstFrameUpdates.Unassign();
|
||||
lastFrameUpdates.Unassign();
|
||||
|
Reference in New Issue
Block a user