feat: PreUpdate and FirstActiveFrame to Behaviour

This commit is contained in:
2023-11-30 10:39:40 +03:00
parent d2881e94df
commit bb6990a80c
3 changed files with 35 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ namespace Syntriax.Engine.Core;
public class BehaviourController : IBehaviourController
{
public Action<IBehaviourController, GameTime>? OnPreUpdate { get; set; }
public Action<IBehaviourController, GameTime>? OnUpdate { get; set; } = null;
public Action<IBehaviourController, GameTime>? OnPreDraw { get; set; } = null;
@@ -111,8 +112,10 @@ public class BehaviourController : IBehaviourController
if (!GameObject.StateEnable.Enabled)
return;
OnPreUpdate?.Invoke(this, gameTime);
OnUpdate?.Invoke(this, gameTime);
}
public void UpdatePreDraw(GameTime gameTime)
{
if (!GameObject.StateEnable.Enabled)