예제 #1
0
    private void Sector_HumanGroupExit(object sender, SectorExitEventArgs e)
    {
        // Персонаж игрока выходит из сектора.
        var actor = _playerState.ActiveActor.Actor;

        _humanPlayer.SectorNode.Sector.ActorManager.Remove(actor);

        // Отписываемся от событий в этом секторе
        UnscribeSectorDependentEvents();

        _interuptCommands = true;
        _commandBlockerService.DropBlockers();

        var activeActor    = _humanActorTaskSource.ActiveActor;
        var survivalModule = activeActor.Person.GetModule <ISurvivalModule>();

        survivalModule.Dead -= HumanPersonSurvival_Dead;

        _playerState.ActiveActor       = null;
        _playerState.SelectedViewModel = null;
        _playerState.HoverViewModel    = null;
        _humanActorTaskSource.SwitchActiveActor(null);

        var nextSectorNode = e.Transition.SectorNode;

        _humanPlayer.BindSectorNode(nextSectorNode);

        StartLoadScene();
    }
예제 #2
0
        private static void CurrentSector_HumanGroupExit(object sender, SectorExitEventArgs e)
        {
            Console.WriteLine("Exit");

            _changeSector = true;
            var sectorManager = _sectorServiceContainer.GetInstance <ISectorManager>();

            sectorManager.CurrentSector.HumanGroupExit -= CurrentSector_HumanGroupExit;
        }
예제 #3
0
    private void Sector_HumanGroupExit(object sender, SectorExitEventArgs e)
    {
        _interuptCommands = true;
        _commandBlockerService.DropBlockers();
        _humanActorTaskSource.CurrentActor.Person.Survival.Dead -= HumanPersonSurvival_Dead;
        _playerState.ActiveActor       = null;
        _playerState.SelectedViewModel = null;
        _playerState.HoverViewModel    = null;
        _humanActorTaskSource.SwitchActor(null);

        if (_humanPlayer.GlobeNode == null)
        {
            // intro

            if (e.Transition.SectorSid == null)
            {
                AddResourceToCurrentPerson("history-book");
                _humanPlayer.SectorSid = null;
                SceneManager.LoadScene("globe");
                SaveGameProgress();
                return;
            }
            else
            {
                _humanPlayer.SectorSid = e.Transition.SectorSid;
                StartLoadScene();
                return;
            }
        }

        var currentLocation = _humanPlayer.GlobeNode.Scheme;

        if (currentLocation?.SectorLevels == null)
        {
            _humanPlayer.SectorSid = null;
            SceneManager.LoadScene("globe");
            SaveGameProgress();
            return;
        }

        if (e.Transition.SectorSid == null)
        {
            _humanPlayer.SectorSid = null;
            SceneManager.LoadScene("globe");
            SaveGameProgress();
        }
        else
        {
            _humanPlayer.SectorSid = e.Transition.SectorSid;
            StartLoadScene();
        }
    }
예제 #4
0
        private void CurrentSector_HumanGroupExit(object sender, SectorExitEventArgs e)
        {
            ProcessSectorExit();
            _changeSector = true;

            var sectorManager = ServiceScope.ServiceProvider.GetRequiredService <ISectorManager>();

            sectorManager.CurrentSector.HumanGroupExit -= CurrentSector_HumanGroupExit;

            var humanPlayer = ServiceScope.ServiceProvider.GetRequiredService <HumanPlayer>();

            humanPlayer.BindSectorNode(e.Transition.SectorNode);
        }