Ejemplo 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;
    }
Ejemplo n.º 2
0
        private async Task ExpandGlobeInternalAsync(IGlobe globe, ISectorNode sectorNode)
        {
            await _biomeInitializer.MaterializeLevelAsync(sectorNode).ConfigureAwait(false);

            // Фиксируем новый узел, как известную, материализованную часть мира.
            // Далее этот узел будет обрабатываться при каждом изменении мира.
            globe.AddSectorNode(sectorNode);
        }
        public async Task CreateSectorAsync()
        {
            if (_humanPlayer.SectorNode is null)
            {
                var scheme = _schemeService.GetScheme <ILocationScheme>(LOCATION_SID);

                var biome = await _biomeInitializer.InitBiomeAsync(scheme).ConfigureAwait(false);

                var sectorNode = biome.Sectors.First();

                _humanPlayer.BindSectorNode(sectorNode);

                CurrentSector = sectorNode.Sector;
            }
            else
            {
                await _biomeInitializer.MaterializeLevelAsync(_humanPlayer.SectorNode).ConfigureAwait(false);

                CurrentSector = _humanPlayer.SectorNode.Sector;
            }
        }