Esempio n. 1
0
        protected override void OnCreate()
        {
            _capacity = TrafficConfig.Instance.MaxVehicles;

            VehicleFactory.Init(EntityManager);
            for (var j = 0; j < _capacity; j++)
            {
                VehicleFactory.AddVehicle(EntityManager);
            }

            _bound = RoadGraph.Instance.BoundingBox;

            _BVH    = new BVHConstructor(_capacity);
            _rdGens = Utils.GetRandomizerPerThread();

            //_vehicleGroup = EntityManager.CreateEntityQuery(typeof(VehicleData), typeof(BVHAABB), typeof(Translation),
            //    typeof(Rotation), typeof(HitResult));
            _vehicleGroup = GetEntityQuery(new EntityQueryDesc()
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadWrite <Translation>(),
                    ComponentType.ReadWrite <Rotation>(),
                    ComponentType.ReadWrite <VehicleData>(),
                    ComponentType.ReadWrite <BVHAABB>(),
                    ComponentType.ReadWrite <HitResult>()
                },
                Options = EntityQueryOptions.FilterWriteGroup
            });
            _roadSegmentGroup = GetEntityQuery(new EntityQueryDesc()
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadOnly <RoadSegment>(),
                },
                Options = EntityQueryOptions.FilterWriteGroup
            });
            _roadNodeGroup = GetEntityQuery(new EntityQueryDesc()
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadOnly <RoadNode>(),
                },
                Options = EntityQueryOptions.FilterWriteGroup
            });
        }
Esempio n. 2
0
        protected override void OnCreateManager()
        {
            Capacity = TrafficConfig.Instance.MaxVehicles;

            VehicleFactory.Init(EntityManager);
            for (var j = 0; j < Capacity; j++)
            {
                VehicleFactory.AddVehicle(EntityManager);
            }

            var seeds = Utils.GetRandomSeed(Capacity);

            _randSeed = new NativeArray <uint>(seeds, Allocator.Persistent);
            _randSeed.CopyFrom(seeds);
            _bound = RoadGraph.Instance.BoundingBox;

            _BVH = new BVHConstructor(Capacity);
        }
Esempio n. 3
0
        protected override void OnCreateManager()
        {
            _capacity = TrafficConfig.Instance.MaxVehicles;

            VehicleFactory.Init(EntityManager);
            for (var j = 0; j < _capacity; j++)
            {
                VehicleFactory.AddVehicle(EntityManager);
            }

            _bound = RoadGraph.Instance.BoundingBox;

            _BVH    = new BVHConstructor(_capacity);
            _rdGens = Utils.GetRandomizerPerThread();

            _vehicleGroup = EntityManager.CreateEntityQuery(typeof(VehicleData), typeof(BVHAABB), typeof(Translation),
                                                            typeof(Rotation), typeof(HitResult));
            _roadSegmentGroup = EntityManager.CreateEntityQuery(typeof(RoadSegment));
            _roadNodeGroup    = EntityManager.CreateEntityQuery(typeof(RoadNode));
        }
Esempio n. 4
0
        protected override void OnCreateManager()
        {
            Capacity = TrafficConfig.Instance.MaxVehicles;

            VehicleFactory.Init(EntityManager);
            for (var j = 0; j < Capacity; j++)
            {
                VehicleFactory.AddVehicle(EntityManager);
            }

            var seeds = Utils.GetRandomSeed(Capacity);

            _randSeed = new NativeArray <uint>(seeds, Allocator.Persistent);
            _randSeed.CopyFrom(seeds);
            _bound = RoadGraph.Instance.BoundingBox;

            _BVH = new BVHConstructor(Capacity);

            _vehicleGroup     = GetComponentGroup(typeof(VehicleData), typeof(BVHAABB), typeof(Position), typeof(Rotation), typeof(HitResult));
            _roadSegmentGroup = GetComponentGroup(typeof(RoadSegment));
            _roadNodeGroup    = GetComponentGroup(typeof(RoadNode));
        }