public PhysicsObjectsFactory(EcsWorld world, EcsWorld worldConstraints)
 {
     this.world            = world;
     this.worldConstraints = worldConstraints;
     rigidBodies           = world.GetPool <RigidBody>();
     staticBodies          = world.GetPool <StaticBody>();
     velocities            = world.GetPool <Velocity>();
     poses            = world.GetPool <Pose>();
     bodyMasks        = world.GetPool <BodyMask>();
     circleShapes     = world.GetPool <Circle>();
     segmentShapes    = world.GetPool <Segment>();
     meshShapes       = world.GetPool <Mesh>();
     aaboxShapes      = world.GetPool <AABox>();
     bboxes           = world.GetPool <BoundingBox>();
     springsBodyBody  = worldConstraints.GetPool <SpringBodyBody>();
     springsBodySpace = worldConstraints.GetPool <SpringBodySpace>();
 }
 public void Init()
 {
     _world.GetPool <Movable> ().SetCapacity(_lss.Count);
     for (int i = 0, iMax = _lss.Count; i < iMax; i++)
     {
         ref var movable = ref _world.NewEntity().Get <Movable> ();
         movable.Position = new Float3(Random.Range(-100f, 100f), Random.Range(-100f, 100f), Random.Range(-100f, 100f));
         movable.View     = Object.Instantiate(_lss.Prefab, movable.Position, Quaternion.identity);
     }
Exemple #3
0
 public void Init()
 {
     _world.GetPool <Movable>().SetCapacity(_lss.Count);
     for (int i = 0, iMax = _lss.Count; i < iMax; i++)
     {
         ref var movable = ref _world.NewEntity().Get <Movable>();
         movable.Position = new Float3(
             Random.Range(-100f, 100f),
             Random.Range(-100f, 100f),
             Random.Range(-100f, 100f));
     }
Exemple #4
0
 private void RegisterAutoReset()
 {
     world
     .GetPool <CameraTargetFollowComponent>()
     .SetAutoReset(CameraTargetFollowComponent.CustomReset);
 }
Exemple #5
0
        public int AddLabel(string text, Vector2 position)
        {
            var entity = world.NewEntity();

            var            posPool = world.GetPool <UIPosition>();
            ref UIPosition p       = ref posPool.Add(entity);