예제 #1
0
 public SensorInfo(Unit unit, Fixture fixture, int maxSense)
 {
     _unit = unit;
     _fixture = fixture;
     _fixture.SetUserData(this);
     _max = maxSense;
     _sensedUnits = new Unit[maxSense];
     _count = 0;
 }
예제 #2
0
        public Unit CreateUnit(UnitDef unitDef)
        {
            var bodydef = new BodyDef();
            bodydef.type = unitDef.BodyType;
            bodydef.angle = unitDef.RotateZ;
            bodydef.fixedRotation = unitDef.FixedRotation;
            bodydef.position.X = B2Value(unitDef.X);
            bodydef.position.Y = B2Value(unitDef.Y);
            Body body = _world.CreateBody(bodydef);

            var unit = new Unit(body, this);
            unit.Group = unitDef.Group;
            body.SetUserData(unit);
            return unit;
        }