Exemplo n.º 1
0
        public void Reset(int bodyCapacity, int contactCapacity, int jointCapacity, FSContactManager contactManager)
        {
            BodyCapacity    = bodyCapacity;
            ContactCapacity = contactCapacity;
            JointCapacity   = jointCapacity;
            BodyCount       = 0;
            ContactCount    = 0;
            JointCount      = 0;

            _contactManager = contactManager;

            if (Bodies == null || Bodies.Length < bodyCapacity)
            {
                Bodies      = new FSBody[bodyCapacity];
                _velocities = new Velocity[bodyCapacity];
                _positions  = new Position[bodyCapacity];
            }

            if (_contacts == null || _contacts.Length < contactCapacity)
            {
                _contacts = new Contact[contactCapacity * 2];
            }

            if (_joints == null || _joints.Length < jointCapacity)
            {
                _joints = new FarseerJoint[jointCapacity * 2];
            }
        }
Exemplo n.º 2
0
 public FSWorld(FVector2 gravity, AABB span)
     : this()
 {
     Gravity = gravity;
     ContactManager = new FSContactManager(new QuadTreeBroadPhase(span));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FSWorld"/> class.
 /// </summary>
 /// <param name="gravity">The gravity.</param>
 public FSWorld(FVector2 gravity)
     : this()
 {
     ContactManager = new FSContactManager(new DynamicTreeBroadPhase());
     Gravity = gravity;
 }
Exemplo n.º 4
0
        public void Reset(int bodyCapacity, int contactCapacity, int jointCapacity, FSContactManager contactManager)
        {
            BodyCapacity = bodyCapacity;
            ContactCapacity = contactCapacity;
            JointCapacity = jointCapacity;
            BodyCount = 0;
            ContactCount = 0;
            JointCount = 0;

            _contactManager = contactManager;

            if (Bodies == null || Bodies.Length < bodyCapacity)
            {
                Bodies = new FSBody[bodyCapacity];
                _velocities = new Velocity[bodyCapacity];
                _positions = new Position[bodyCapacity];
            }

            if (_contacts == null || _contacts.Length < contactCapacity)
            {
                _contacts = new Contact[contactCapacity * 2];
            }

            if (_joints == null || _joints.Length < jointCapacity)
            {
                _joints = new FarseerJoint[jointCapacity * 2];
            }
        }