Exemplo n.º 1
0
    protected void UpdateService(T newInstance)
    {
        _service = newInstance;
        GameServiceCollection.SetService(newInstance);

        _isActive = true;
    }
Exemplo n.º 2
0
    protected void RemoveService(bool throwIfNotExists = false)
    {
        if (!GameServiceCollection.TryRemoveService <T>() && throwIfNotExists)
        {
            throw new System.Exception($"Service \"{nameof(T)}\" is currently not injected");
        }

        _isActive = false;
    }
Exemplo n.º 3
0
    protected void InjectService(bool throwIfExists = false)
    {
        if (!GameServiceCollection.TryAddService(_service) && throwIfExists)
        {
            throw new System.Exception($"Service \"{nameof(T)}\" has already been injected");
        }

        _isActive = true;
    }
Exemplo n.º 4
0
    protected void RemoveService()
    {
        GameServiceCollection.RemoveService <T>();

        _isActive = false;
    }
Exemplo n.º 5
0
 protected void InjectService()
 {
     GameServiceCollection.AddService(_service);
     _isActive = true;
 }
Exemplo n.º 6
0
    private void Start()
    {
        _battle = GameServiceCollection.GetService <BattleService>();

        _battle.StartBattle(this);
    }