refactor: Fixed Compiler Warning On Possible Null

This commit is contained in:
Syntriax 2023-11-27 11:11:58 +03:00
parent 6dec7dd720
commit 9b45bfa4fd
1 changed files with 14 additions and 1 deletions

View File

@ -37,7 +37,20 @@ public class GameManager : IEntity
public bool Initialized => _initialized; public bool Initialized => _initialized;
public IList<IGameObject> GameObjects => _gameObjects; public IList<IGameObject> GameObjects => _gameObjects;
public IStateEnable StateEnable { get { if (_stateEnable is null) Assign(new StateEnableFactory().Instantiate(this)); return _stateEnable; } } public IStateEnable StateEnable
{
get
{
if (_stateEnable is null)
{
Assign(new StateEnableFactory().Instantiate(this));
if (_stateEnable is null)
throw NotAssignedException.From(this, _stateEnable);
}
return _stateEnable;
}
}
public void RegisterGameObject(IGameObject gameObject) public void RegisterGameObject(IGameObject gameObject)
{ {