BREAKING CHANGE: Renamed IInitialize.Initialized to IsInitialized
This commit is contained in:
parent
fdc38fc800
commit
1f8fa78b76
@ -37,7 +37,7 @@ public abstract class BaseEntity : IEntity
|
||||
}
|
||||
}
|
||||
|
||||
public bool Initialized
|
||||
public bool IsInitialized
|
||||
{
|
||||
get => _initialized;
|
||||
private set
|
||||
@ -55,7 +55,7 @@ public abstract class BaseEntity : IEntity
|
||||
|
||||
public bool Assign(IStateEnable stateEnable)
|
||||
{
|
||||
if (Initialized)
|
||||
if (IsInitialized)
|
||||
return false;
|
||||
|
||||
_stateEnable = stateEnable;
|
||||
@ -67,7 +67,7 @@ public abstract class BaseEntity : IEntity
|
||||
protected virtual void UnassignInternal() { }
|
||||
public bool Unassign()
|
||||
{
|
||||
if (Initialized)
|
||||
if (IsInitialized)
|
||||
return false;
|
||||
|
||||
UnassignInternal();
|
||||
@ -79,24 +79,24 @@ public abstract class BaseEntity : IEntity
|
||||
protected virtual void InitializeInternal() { }
|
||||
public bool Initialize()
|
||||
{
|
||||
if (Initialized)
|
||||
if (IsInitialized)
|
||||
return false;
|
||||
|
||||
InitializeInternal();
|
||||
|
||||
Initialized = true;
|
||||
IsInitialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual void FinalizeInternal() { }
|
||||
public bool Finalize()
|
||||
{
|
||||
if (!Initialized)
|
||||
if (!IsInitialized)
|
||||
return false;
|
||||
|
||||
FinalizeInternal();
|
||||
|
||||
Initialized = false;
|
||||
IsInitialized = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ public interface IInitialize
|
||||
/// <summary>
|
||||
/// The value indicating whether the entity has been initialized.
|
||||
/// </summary>
|
||||
bool Initialized { get; }
|
||||
bool IsInitialized { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the entity.
|
||||
|
@ -36,7 +36,7 @@ public abstract class BehaviourBase : BaseEntity, IBehaviour
|
||||
|
||||
public bool Assign(IBehaviourController behaviourController)
|
||||
{
|
||||
if (Initialized)
|
||||
if (IsInitialized)
|
||||
return false;
|
||||
|
||||
_behaviourController = behaviourController;
|
||||
|
@ -113,7 +113,7 @@ public class BehaviourController : IBehaviourController
|
||||
|
||||
public bool Assign(IGameObject gameObject)
|
||||
{
|
||||
if (GameObject is not null && GameObject.Initialized)
|
||||
if (GameObject is not null && GameObject.IsInitialized)
|
||||
return false;
|
||||
|
||||
_gameObject = gameObject;
|
||||
@ -123,7 +123,7 @@ public class BehaviourController : IBehaviourController
|
||||
|
||||
public bool Unassign()
|
||||
{
|
||||
if (GameObject is not null && GameObject.Initialized)
|
||||
if (GameObject is not null && GameObject.IsInitialized)
|
||||
return false;
|
||||
|
||||
_gameObject = null!;
|
||||
|
@ -67,7 +67,7 @@ public class GameObject : BaseEntity, IGameObject
|
||||
|
||||
public bool Assign(ITransform transform)
|
||||
{
|
||||
if (Initialized)
|
||||
if (IsInitialized)
|
||||
return false;
|
||||
|
||||
_transform = transform;
|
||||
@ -77,7 +77,7 @@ public class GameObject : BaseEntity, IGameObject
|
||||
|
||||
public bool Assign(IBehaviourController behaviourController)
|
||||
{
|
||||
if (Initialized)
|
||||
if (IsInitialized)
|
||||
return false;
|
||||
|
||||
_behaviourController = behaviourController;
|
||||
@ -87,7 +87,7 @@ public class GameObject : BaseEntity, IGameObject
|
||||
|
||||
public bool Assign(IGameManager gameManager)
|
||||
{
|
||||
if (Initialized)
|
||||
if (IsInitialized)
|
||||
return false;
|
||||
|
||||
_gameManager = gameManager;
|
||||
@ -112,6 +112,6 @@ public class GameObject : BaseEntity, IGameObject
|
||||
controller.BehaviourController.OnBehaviourAdded += OnBehaviourAdded;
|
||||
controller.BehaviourController.OnBehaviourRemoved += OnBehaviourRemoved;
|
||||
}
|
||||
private void OnBehaviourRemoved(IBehaviourController _, IBehaviour behaviour) { if (Initialized) behaviour.Initialize(); }
|
||||
private void OnBehaviourAdded(IBehaviourController _, IBehaviour behaviour) { if (Initialized) behaviour.Finalize(); }
|
||||
private void OnBehaviourRemoved(IBehaviourController _, IBehaviour behaviour) { if (IsInitialized) behaviour.Initialize(); }
|
||||
private void OnBehaviourAdded(IBehaviourController _, IBehaviour behaviour) { if (IsInitialized) behaviour.Finalize(); }
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class StateEnable : IStateEnable
|
||||
|
||||
public bool Assign(IEntity entity)
|
||||
{
|
||||
if (_entity is not null && _entity.Initialized)
|
||||
if (_entity is not null && _entity.IsInitialized)
|
||||
return false;
|
||||
|
||||
_entity = entity;
|
||||
|
@ -262,7 +262,7 @@ public class Transform : ITransform
|
||||
|
||||
public bool Assign(IGameObject gameObject)
|
||||
{
|
||||
if (GameObject is not null && GameObject.Initialized)
|
||||
if (GameObject is not null && GameObject.IsInitialized)
|
||||
return false;
|
||||
|
||||
GameObject = gameObject;
|
||||
@ -272,7 +272,7 @@ public class Transform : ITransform
|
||||
|
||||
public bool Unassign()
|
||||
{
|
||||
if (GameObject is not null && GameObject.Initialized)
|
||||
if (GameObject is not null && GameObject.IsInitialized)
|
||||
return false;
|
||||
|
||||
GameObject = null!;
|
||||
|
Loading…
x
Reference in New Issue
Block a user