本文整理汇总了Java中com.badlogic.gdx.physics.box2d.Fixture.setFilterData方法的典型用法代码示例。如果您正苦于以下问题:Java Fixture.setFilterData方法的具体用法?Java Fixture.setFilterData怎么用?Java Fixture.setFilterData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.physics.box2d.Fixture
的用法示例。
在下文中一共展示了Fixture.setFilterData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: die
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public void die(DeathType death)
{
if(alive)
{
if (grabbed != null)
{
stopGrabbing(false);
}
gameWorld.startRespawnClock(this);
Fixture f = body.getFixtureList().get(0);
Filter fi = f.getFilterData();
fi.categoryBits = BodyFactory.CAT_DECEASED;
fi.maskBits = BodyFactory.MASK_DECEASED;
f.setFilterData(fi);
body.getFixtureList().set(0, f);
super.die(death);
}
}
示例2: swapWorldLayers
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public void swapWorldLayers(LayerHandler lh)
{
removeFromWorldLayers(lh);
lh.addEntityToLayer(this, LayerHandler.ground);
swapped = true;
Fixture f = body.getFixtureList().get(0);
Filter fi = f.getFilterData();
fi.categoryBits = BodyFactory.CAT_IMPASSABLE;
fi.maskBits = BodyFactory.MASK_SHERIFF_GROUND;
f.setFilterData(fi);
body.getFixtureList().set(0, f);
canFire = false;
TimerManager.addTimer(swapTimer);
}
示例3: die
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public void die(DeathType death)
{
if(alive)
{
if (gameWorld instanceof BossFight)
{
((BossFight)gameWorld).startRespawnClock(this);
}
else
{
gameWorld.startRespawnClock(this);
}
if(death == DeathType.CAPTURE)
{
shouldMakeCorpse = false;
CGCWorld.addToDestroyList(this);
if (Options.storedTrackingOption)
{
ChaseApp.stats.getStatByIndex(getCurrentMapIndex()).captures++;
}
}
else
{
Fixture f = body.getFixtureList().get(0);
Filter fi = f.getFilterData();
fi.categoryBits = BodyFactory.CAT_DECEASED;
fi.maskBits = BodyFactory.MASK_DECEASED;
f.setFilterData(fi);
body.getFixtureList().set(0, f);
}
fixKeyIDs(playerID);
super.die(death);
alive = false;
}
rightJoint = null;
}
示例4: die
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public void die()
{
removeFromWorldLayers(CGCWorld.getLH());
swapped = true;
Fixture f = body.getFixtureList().get(0);
Filter fi = f.getFilterData();
fi.categoryBits = BodyFactory.CAT_NON_INTERACTIVE;
fi.maskBits = BodyFactory.MASK_NON_INTERACTIVE;
f.setFilterData(fi);
body.getFixtureList().set(0, f);
body.setUserData(this);
if (leftShooter != null)
{
if (rightShooter != null)
{
rightShooter.dismount();
}
leftShooter.dismount();
sheriff.addTargeter();
}
sheriff.swapWorldLayers(CGCWorld.getLH());
sheriff.getBody().setUserData(sheriff);
TimerManager.removeTimer(dieClock);
}
示例5: load
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
@Override
public void load(OverlapScene scene, Entity entity,
ObjectMap<String, String> value)
{
PhysicsComponent physics = Mappers.physics.get(entity);
Filter filter = new Filter();
filter.categoryBits = physicsSystem.getCategories().getBits("box");
for(Fixture fixture : physics.body.getFixtureList())
{
fixture.setFilterData(filter);
}
}
示例6: kill
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public void kill() {
currentState = State.DEAD;
Filter filter = new Filter();
filter.maskBits = MarioBros.NOTHING_BIT;
for (Fixture fixture : b2body.getFixtureList()) {
fixture.setFilterData(filter);
}
b2body.applyLinearImpulse(new Vector2(0, 5f), b2body.getWorldCenter(), true);
}
示例7: kill
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
private void kill() {
MarioBros.manager.get("audio/music/mario_music.ogg", Music.class).stop();
MarioBros.manager.get("audio/sounds/mariodie.wav", Sound.class).play();
marioIsDead = true;
Filter filter = new Filter();
filter.maskBits = MarioBros.NOTHING_BIT;
for (Fixture fixture : b2body.getFixtureList()) {
fixture.setFilterData(filter);
}
b2body.applyLinearImpulse(new Vector2(0, 3), b2body.getWorldCenter(), true);
}
示例8: setFilter
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
public void setFilter(short category, short mask){
for (Fixture f : scene.getFixtures()){
Filter filter = f.getFilterData();
filter.categoryBits = category;
filter.maskBits = mask;
f.setFilterData(filter);
}
}
示例9: load
import com.badlogic.gdx.physics.box2d.Fixture; //导入方法依赖的package包/类
@Override
public void load(final OverlapScene scene, Entity entity, ObjectMap<String, String> value)
{
TransformComponent transform = Mappers.transform.get(entity);
PhysicsComponent physics = new PhysicsComponent();
final SensorComponent sensor = new SensorComponent();
// Create default sensor body
Body body;
BodyDef bodyDef = new BodyDef();
bodyDef.allowSleep = true;
bodyDef.awake = true;
bodyDef.type = BodyType.StaticBody;
body = physicsSystem.getWorld().createBody(bodyDef);
body.setUserData(entity);
FixtureDef fixtureDef = new FixtureDef();
fixtureDef.isSensor = true;
PolygonShape polygon = new PolygonShape();
polygon.setAsBox(.5f, .5f);
fixtureDef.shape = polygon;
Filter filter = new Filter();
filter.categoryBits = physicsSystem.getCategories().getBits("sensor");
Fixture fixture = body.createFixture(fixtureDef);
fixture.setFilterData(filter);
sensor.sensorFixture = fixture;
polygon.dispose();
body.setTransform(transform.position, transform.angle);
physics.body = body;
sensor.isEnabled = true;
sensor.sensorReactionEnter = new Runnable()
{
@Override
public void run()
{
if(sensor.isEnabled)
{
EventManager.fireEvent(scene, new Event(EventType.END_OF_LEVEL, false, false));
sensor.isEnabled = false;
}
}
};
sensor.isPlayerSensible = true;
sensor.isBoxSensible = false;
entity.add(physics);
entity.add(sensor);
}