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