Пример #1
0
        private void Start()
        {
            var contexts = new Contexts();

            _systems = new Entitas.Systems()
                       .Add(new SyncModelPositionSystem(contexts))
                       .Add(new CreateViewSystem(contexts.game))
                       .Add(new InputSystem(contexts))
                       .Add(new ArenaStartupSystem(contexts))
                       .Add(new MovementSystem(contexts))
                       .Add(new RotationSystem(contexts))
                       .Add(new CameraControlSystem(contexts))
                       .Add(new SyncViewPositionSystem(contexts))
                       .Add(new SyncViewRotationSystem(contexts))
                       .Add(new FindTargetSystem(contexts))
                       .Add(new MoveToTargetSystem(contexts))
                       //HealthBar Feature
                       .Add(new CreateHealthBarSystem(contexts.game))
                       .Add(new UpdateHealthBarValueSystem(contexts.game))
                       .Add(new UpdateHealthBarPositionSystem(contexts))
                       //Player target Feature
                       .Add(new UpdatePlayerTargetSystem(contexts.game))
                       .Add(new UpdatePlayerTargetViewSystem(contexts));


            _systems.Initialize();
        }
Пример #2
0
        private void Awake()
        {
            var services = new UnityServices();
            var contexts = Contexts.sharedInstance;

            systems = CreateSystems(contexts, services);
            systems.Initialize();
        }
Пример #3
0
        //ECS
        public void ConfigureSystems(BattleRoyaleMatchModel matchModelArg, UdpSendUtils udpSendUtils,
                                     IpAddressesStorage ipAddressesStorage)
        {
            log.Info($"Создание нового матча {nameof(matchId)} {matchId}");

            //TODO это нужно убрать в отдельный класс
            Dictionary <int, (int playerId, ViewTypeId type)> possibleKillersInfo = new Dictionary <int, (int playerId, ViewTypeId type)>();


            // var test = new BattleRoyalePlayerModelFactory().Create(matchModelArg).Select(model=>model.AccountId);
            // playersIds = new HashSet<int>(test);

            contexts = ContextsPool.GetContexts();
            contexts.SubscribeId();
            TryEnableDebug();

            playerDeathHandler = new PlayerDeathHandler(matchmakerNotifier, udpSendUtils, ipAddressesStorage);
            var playersViewAreas = new PlayersViewAreas(matchModelArg.GameUnits.Players.Count);

            systems = new Entitas.Systems()
                      .Add(new MapInitSystem(contexts, matchModelArg, udpSendUtils, out var chunks))
                      .Add(new ViewAreasInitSystem(contexts, playersViewAreas))
                      // .Add(new TestEndMatchSystem(contexts))
                      .Add(new PlayerMovementHandlerSystem(contexts))
                      .Add(new PlayerAttackHandlerSystem(contexts))
                      .Add(new PlayerAbilityHandlerSystem(contexts))
                      .Add(new ParentsSystems(contexts))
                      .Add(new AISystems(contexts))
                      .Add(new MovementSystems(contexts))
                      .Add(new GlobalTransformSystem(contexts))
                      .Add(new ShootingSystems(contexts))
                      .Add(new UpdatePositionChunksSystem(contexts, chunks))
                      .Add(new CollisionSystems(contexts, chunks))
                      .Add(new EffectsSystems(contexts))
                      .Add(new TimeSystems(contexts))
                      .Add(new UpdatePossibleKillersSystem(contexts, possibleKillersInfo))

                      .Add(new PlayerExitSystem(contexts, matchModelArg.MatchId, playerDeathHandler, matchRemover))
                      .Add(new FinishMatchSystem(contexts, matchRemover, matchId))
                      .Add(new NetworkKillsSenderSystem(contexts, possibleKillersInfo, matchModelArg.MatchId, playerDeathHandler, udpSendUtils))

                      .Add(new DestroySystems(contexts))
                      // .Add(new MatchDebugSenderSystem(contexts, matchModelArg.MatchId, udpSendUtils))
                      .Add(new NetworkSenderSystems(contexts, matchModelArg.MatchId, udpSendUtils, playersViewAreas))
                      .Add(new MovingCheckerSystem(contexts))

                      .Add(new DeleteSystem(contexts))
                      .Add(new InputDeletingSystem(contexts))
                      .Add(new GameDeletingSystem(contexts))
            ;

            systems.ActivateReactiveSystems();
            systems.Initialize();
            gameStartTime = DateTime.UtcNow;
        }
Пример #4
0
 public ClientMatchSimulation(BattleUiController battleUiController, UdpSendUtils udpSendUtils,
                              BattleRoyaleClientMatchModel matchModel, PingStatisticsStorage pingStatisticsStorage)
 {
     this.battleUiController    = battleUiController;
     this.pingStatisticsStorage = pingStatisticsStorage;
     if (matchModel == null)
     {
         log.Error("Симуляция матча не запущена ");
         return;
     }
     systems = CreateSystems(udpSendUtils, matchModel, pingStatisticsStorage);
     systems.ActivateReactiveSystems();
     systems.Initialize();
 }
Пример #5
0
        private void Awake()
        {
            _services = new Services.Services
            {
                Logger                = new UnityDebugLogService(),
                ViewService           = new UnityViewService(),
                Time                  = new UnityTimeService(),
                Physics               = new UnityPhysicsService(),
                CoroutineDirector     = new UnityCoroutineDirectorService(this),
                CollidingViewRegister = new UnityCollidingViewRegister(),
                Identifiers           = new GameIdentifierService(),
                InputService          = new StandaloneInputService(),
            };

            Contexts contexts = Contexts.sharedInstance;

            _systems = new AllSystems(contexts, _services);
            _systems.Initialize();
        }
Пример #6
0
 private void OnEnable()
 {
     _systems = new GameSystems(Contexts.sharedInstance);
     _systems.Initialize();
 }
Пример #7
0
 private void Start() => systems.Initialize();
Пример #8
0
 private void InitWorld()
 {
     _systems.ActivateReactiveSystems();
     _systems.Initialize();
 }