Esempio n. 1
0
    private async Task InitServicesAsync()
    {
        var sectorNode = _humanPlayer.SectorNode;

        if (sectorNode == null)
        {
            var introLocationScheme = _schemeService.GetScheme <ILocationScheme>("intro");
            var biom = await _biomeInitializer.InitBiomeAsync(introLocationScheme);

            sectorNode = biom.Sectors.Single(x => x.State == SectorNodeState.SectorMaterialized);
        }
        else if (sectorNode.State == SectorNodeState.SchemeKnown)
        {
            await _biomeInitializer.MaterializeLevelAsync(sectorNode);
        }

        _humanPlayer.BindSectorNode(sectorNode);
        await _sectorManager.CreateSectorAsync();

        sectorNode.Sector.ScoreManager = _scoreManager;

        _staticObjectManager = sectorNode.Sector.StaticObjectManager;

        _staticObjectManager.Added   += StaticObjectManager_Added;
        _staticObjectManager.Removed += StaticObjectManager_Removed;

        _playerState.TaskSource = _humanActorTaskSource;

        _sectorManager.CurrentSector.HumanGroupExit += Sector_HumanGroupExit;
    }
Esempio n. 2
0
    private async Task InitServicesAsync()
    {
        LogicStateTreePatterns.Factory = _logicStateFactory;

        await _sectorManager.CreateSectorAsync();

        _sectorManager.CurrentSector.ScoreManager = _scoreManager;

        _propContainerManager.Added   += PropContainerManager_Added;
        _propContainerManager.Removed += PropContainerManager_Removed;

        _playerState.TaskSource = _humanActorTaskSource;

        _gameLoop.ActorTaskSources = new[] {
            _humanActorTaskSource,
            _monsterActorTaskSource
        };

        _sectorManager.CurrentSector.HumanGroupExit += Sector_HumanGroupExit;
    }