public ViewAreasInitSystem(Contexts contexts, PlayersViewAreas playersViewAreas) { viewAreas = playersViewAreas; var gameContext = contexts.game; players = gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.Player).NoneOf(GameMatcher.Bot)); }
public MaxHpUpdaterSystem(Contexts contexts, int matchId, UdpSendUtils udpSendUtils, PlayersViewAreas playersViewAreas) { this.matchId = matchId; this.udpSendUtils = udpSendUtils; viewAreas = playersViewAreas; gameContext = contexts.game; withMaxHp = gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.MaxHealthPoints, GameMatcher.ViewType)); knownMaxHps = new Dictionary <ushort, Dictionary <ushort, ushort> >(playersViewAreas.Count); }
//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; }
public static List <GameEntity> GetVisibleObjects(PlayersViewAreas viewAreas, PlayersViewAreas.PlayerViewAreaInfo viewArea, IEnumerable <GameEntity> entities) { if (viewAreas.sendAll) { return(entities.ToList()); } var playerVisible = viewArea.lastVisible; return(entities.Where(withView => playerVisible.Contains(withView.id.value)).ToList()); }
public HidesSenderSystem(Contexts contexts, int matchId, UdpSendUtils udpSendUtils, PlayersViewAreas playersViewAreas) { this.matchId = matchId; this.udpSendUtils = udpSendUtils; viewAreas = playersViewAreas; gameContext = contexts.game; players = gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.Player).NoneOf(GameMatcher.Bot)); var grandMatcher = GameMatcher.AllOf(GameMatcher.GlobalTransform).NoneOf(GameMatcher.Parent); grandObjects = gameContext.GetGroup(grandMatcher); removedObjects = gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.Destroyed, GameMatcher.Position, GameMatcher.Direction, GameMatcher.ViewType)); removedObjectIdsBuffer = new List <ushort>(); }
public UnhiddenStoppedSenderSystem(Contexts contexts, int matchId, UdpSendUtils udpSendUtils, PlayersViewAreas playersViewAreas) { this.matchId = matchId; viewAreas = playersViewAreas; this.udpSendUtils = udpSendUtils; gameContext = contexts.game; withTransforms = gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.ViewType, GameMatcher.Position, GameMatcher.Direction).NoneOf(GameMatcher.Moving)); withRadiuses = gameContext.GetGroup(GameMatcher.AllOf(GameMatcher.ViewType, GameMatcher.CircleCollider, GameMatcher.NonstandardRadius) .NoneOf(GameMatcher.CircleScaling)); }
protected ReactivePlayersVisionSystem(Contexts contexts, int matchId, UdpSendUtils udpSendUtils, PlayersViewAreas playersViewAreas) : base(contexts.game) { this.matchId = matchId; viewAreas = playersViewAreas; this.udpSendUtils = udpSendUtils; }
public RadiusesUpdaterSystem(Contexts contexts, int matchId, UdpSendUtils udpSendUtils, PlayersViewAreas playersViewAreas) : base(contexts, matchId, udpSendUtils, playersViewAreas) { }
public NetworkSenderSystems(Contexts contexts, int matchId, UdpSendUtils udpSendUtils, PlayersViewAreas viewAreas) : base("Network Sender Systems") { Add(new FrameRateSenderSystem(contexts, matchId, udpSendUtils)); Add(new HidesSenderSystem(contexts, matchId, udpSendUtils, viewAreas)); Add(new ChangingPositionsSenderSystem(contexts, matchId, udpSendUtils, viewAreas)); Add(new UnhiddenStoppedSenderSystem(contexts, matchId, udpSendUtils, viewAreas)); Add(new RadiusesUpdaterSystem(contexts, matchId, udpSendUtils, viewAreas)); Add(new FinalRadiusesSystem(contexts, matchId, udpSendUtils, viewAreas)); Add(new ParentsSenderSystem(contexts, matchId, udpSendUtils)); Add(new DetachesSenderSystem(contexts, matchId, udpSendUtils)); Add(new HealthUpdaterSystem(contexts, matchId, udpSendUtils, viewAreas)); Add(new MaxHpUpdaterSystem(contexts, matchId, udpSendUtils, viewAreas)); Add(new TeamsUpdaterSystem(contexts, matchId, udpSendUtils)); Add(new CooldownInfoUpdaterSystem(contexts, matchId, udpSendUtils)); Add(new CooldownUpdaterSystem(contexts, matchId, udpSendUtils)); Add(new DestroysSenderSystem(contexts, matchId, udpSendUtils)); }
public ChangingPositionsSenderSystem(Contexts contexts, int matchId, UdpSendUtils udpSendUtils, PlayersViewAreas playersViewAreas) : base(contexts, matchId, udpSendUtils, playersViewAreas) { }