Example #1
0
 public MapInitSystem(Contexts contexts, BattleRoyaleMatchModel matchModel, UdpSendUtils udpSendUtils, out PositionChunks chunks)
 {
     gameContext       = contexts.game;
     this.matchModel   = matchModel;
     this.udpSendUtils = udpSendUtils;
     chunks            = new PositionChunks(mapIntRadius);
 }
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log($"Запущен {nameof(StubSpawner)}.");

        var contexts = Contexts.sharedInstance;

        contexts.SubscribeId();
        gameContext = contexts.game;

        PositionChunks chunks = new PositionChunks(2);

        systems = new Systems()
                  .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 DestroySystems(contexts))
        ;

        systems.ActivateReactiveSystems();
        systems.Initialize();

        var collidersDrawer = FindObjectOfType <CollidersDrawer>();

        collidersDrawer.ChangeContext(gameContext);
    }
Example #3
0
    public UpdatePositionChunksSystem(Contexts contexts, PositionChunks positionChunks)
    {
        chunks      = positionChunks;
        gameContext = contexts.game;
        var matcher = GameMatcher.AllOf(GameMatcher.Collidable, GameMatcher.CircleCollider, GameMatcher.Position);

        transformGroup = gameContext.GetGroup(matcher);
        buffer         = new List <GameEntity>(PredictedCapacity);
    }
Example #4
0
    public CollisionDetectionSystem(Contexts contexts, PositionChunks positionChunks)
    {
        chunks      = positionChunks;
        gameContext = contexts.game;
        var matcher = GameMatcher.AllOf(GameMatcher.Collidable, GameMatcher.CircleCollider, GameMatcher.Position);

        collidableGroup = gameContext.GetGroup(matcher);
        buffer          = new List <GameEntity>(predictedCapacity);
        idsToIndexes    = new Dictionary <ushort, int>(predictedCapacity);
        collidables     = new CollisionInfo[predictedCapacity];
    }
Example #5
0
 public CollisionSystems(Contexts contexts, PositionChunks chunks) : base("Collision Systems")
 {
     Add(new AddCollidersToRectSystem(contexts));
     Add(new AddCollidersToPathSystem(contexts));
     Add(new AddCollidersToCircleSystem(contexts));
     Add(new AddGlobalCollisionComponentsSystem(contexts));
     Add(new ConcaveColliderDetectionSystem(contexts));
     Add(new UpdateGlobalCollisionComponentsSystem(contexts));
     Add(new CollisionDetectionSystem(contexts, chunks));
     Add(new CollisionFixedPenetrationDetectionSystem(contexts));
     Add(new CollisionPenetrationAvoidanceSystem(contexts));
 }