feat: Added IAssignable.Unassign()
This commit is contained in:
@@ -15,6 +15,7 @@ public class BehaviourController : IBehaviourController
|
||||
|
||||
public Action<IBehaviourController, IBehaviour>? OnBehaviourAdded { get; set; } = null;
|
||||
public Action<IBehaviourController, IBehaviour>? OnBehaviourRemoved { get; set; } = null;
|
||||
public Action<IAssignable>? OnUnassigned { get; set; } = null;
|
||||
public Action<IAssignableGameObject>? OnGameObjectAssigned { get; set; } = null;
|
||||
|
||||
|
||||
@@ -95,6 +96,16 @@ public class BehaviourController : IBehaviourController
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Unassign()
|
||||
{
|
||||
if (GameObject.Initialized)
|
||||
return false;
|
||||
|
||||
_gameObject = null!;
|
||||
OnUnassigned?.Invoke(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
if (!GameObject.StateEnable.Enabled)
|
||||
|
Reference in New Issue
Block a user