Пример #1
0
        public void CreateUnit(int unitID, float radius, Vector2 position, CollisionType type)
        {
            if (type != CollisionType.None)
            {
                Body body = BodyFactory.CreateCircle(collisionWorld, radius, 1f, position, type == CollisionType.Dynamic ? BodyType.Dynamic : BodyType.Static, unitID);

                unitBodies.Add(unitID, new BodyWrapper(body));
            }
            else
            {
                NoCollisionBody noCollisionBody = new NoCollisionBody(position, radius);
                BodyWrapper     bodyWrapper     = new BodyWrapper(noCollisionBody);

                unitBodies.Add(unitID, bodyWrapper);
                noCollisionUnitBodies.Add(unitID, bodyWrapper);
            }
        }
Пример #2
0
 public BodyWrapper(NoCollisionBody noCollisionBody)
 {
     IsCollisionBody = false;
     Body            = null;
     NoCollisionBody = noCollisionBody;
 }
Пример #3
0
 public BodyWrapper(Body body)
 {
     IsCollisionBody = true;
     Body            = body;
     NoCollisionBody = null;
 }