示例#1
0
    protected void UpdateService(T newInstance)
    {
        _service = newInstance;
        GameServiceCollection.SetService(newInstance);

        _isActive = true;
    }
示例#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;
    }
示例#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;
    }
示例#4
0
    protected void RemoveService()
    {
        GameServiceCollection.RemoveService <T>();

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

        _battle.StartBattle(this);
    }