本文整理汇总了Java中com.badlogic.gdx.physics.box2d.Contact.getFixtureB方法的典型用法代码示例。如果您正苦于以下问题:Java Contact.getFixtureB方法的具体用法?Java Contact.getFixtureB怎么用?Java Contact.getFixtureB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.physics.box2d.Contact
的用法示例。
在下文中一共展示了Contact.getFixtureB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override public void endContact(Contact contact) {
Fixture fixture = null;
Ball ball = ballWithBody(contact.getFixtureA().getBody());
if (ball != null) {
fixture = contact.getFixtureB();
}
else {
ball = ballWithBody(contact.getFixtureB().getBody());
if (ball != null) {
fixture = contact.getFixtureA();
}
}
if (ball != null) {
contactedBalls.add(ball);
contactedFixtures.add(fixture);
}
}
示例2: beginContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void beginContact(Contact contact) {
Fixture fixA = contact.getFixtureA();
Fixture fixB = contact.getFixtureB();
ContactHandler handler;
handler = beginContactFunctions.get(fixA.getFilterData().categoryBits);
if (handler != null)
handler.handle(fixA, fixB);
handler = beginContactFunctions.get(fixB.getFilterData().categoryBits);
if (handler != null)
handler.handle(fixB, fixA);
}
示例3: endContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void endContact(Contact contact) {
Fixture fixA = contact.getFixtureA();
Fixture fixB = contact.getFixtureB();
ContactHandler handler;
handler = endContactFunctions.get(fixA.getFilterData().categoryBits);
if (handler != null)
handler.handle(fixA, fixB);
handler = endContactFunctions.get(fixB.getFilterData().categoryBits);
if (handler != null)
handler.handle(fixB, fixA);
}
示例4: endContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {
Fixture fixA = contact.getFixtureA();
Fixture fixB = contact.getFixtureB();
if (fixA.getUserData() == "bottom" || fixB.getUserData() == "bottom") {
Fixture bottom = fixA.getUserData() == "bottom" ? fixA : fixB;
Fixture object = bottom == fixA ? fixB : fixA;
//resets object touched
if (object.getUserData() != null &&
InteractiveTileObject.class.isAssignableFrom(object.getUserData().getClass())) {
isObjectTouched = NoObjectionGame.DEFAULT;
}
}
}
示例5: endContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {
Fixture fixtureA = contact.getFixtureA();
Fixture fixtureB = contact.getFixtureB();
// 夹具为空时,碰撞直接返回不执行。
if (fixtureA == null || fixtureB == null) {
return;
}
//孙悟空跳跃结束
if (fixtureA.getUserData() != null && fixtureA.getUserData().equals("foot")) {
// 计数器减1
platformNum--;
}
if (fixtureB.getUserData() != null && fixtureB.getUserData().equals("foot")) {
// 计数器减1
platformNum--;
}
}
示例6: handleFootContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
private void handleFootContact(Contact contact, boolean onBeginContact) {
Fixture footSensor = getFootSensor();
if (contact.getFixtureA() == footSensor || contact.getFixtureB() == footSensor) {
Fixture otherFixture =
(footSensor == contact.getFixtureA()) ? contact.getFixtureB() : contact.getFixtureA();
if (!otherFixture.isSensor()) {
if (onBeginContact) {
if (numFootContacts == 0) {
land();
}
numFootContacts++;
} else {
numFootContacts--;
}
numFootContacts = Math.max(0, numFootContacts);
}
}
}
示例7: beginContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void beginContact(Contact contact) {
// TODO Auto-generated method stub
Fixture fixtureA = contact.getFixtureA();
Fixture fixtureB = contact.getFixtureB();
//logger.info("contact");
if (state == GAME_RUNNING) {
if (fixtureA.getFilterData().categoryBits == CATEGORY_PLAYER &&
fixtureB.getFilterData().categoryBits == CATEGORY_ENEMY) {
//fixtureA.getFilterData().maskBits = 0;
state = GAME_OVER_SETUP;
}
else if (fixtureA.getFilterData().categoryBits == CATEGORY_ENEMY &&
fixtureB.getFilterData().categoryBits == CATEGORY_PLAYER) {
//fixtureB.getFilterData().maskBits = 0;
state = GAME_OVER_SETUP;
}
}
if ((fixtureA.isSensor() == true && fixtureB.getFilterData().categoryBits == CATEGORY_PLAYER)
|| (fixtureB.isSensor() == true && fixtureA.getFilterData().categoryBits == CATEGORY_PLAYER)) {
state = BALL_DESTROYED;
}
}
示例8: endContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {
// End the collision.
Fixture fixtureA = contact.getFixtureA(), fixtureB = contact.getFixtureB();
// This is another way for guessing which fixture are you working with. If you have
// the reference to that fixture you can just check if both variable reference the
// same instance.
if (fixtureA == minijoeFixture && fixtureB == floorFixture) {
isJumping = true;
}
if (fixtureA == floorFixture && fixtureB == minijoeFixture) {
isJumping = true;
}
}
示例9: beginContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void beginContact(Contact contact) {
Fixture fixA = contact.getFixtureA();
Fixture fixB = contact.getFixtureB();
if (fixA.getUserData() instanceof Player || fixB.getUserData() instanceof Player) {
Fixture objA = fixA.getUserData() instanceof Player ? fixA : fixB;
((Player) objA.getUserData()).setTouching(true);
collision.play();
}
}
示例10: endContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {
Fixture fixA = contact.getFixtureA();
Fixture fixB = contact.getFixtureB();
if (fixA.getUserData() instanceof Player || fixB.getUserData() instanceof Player) {
Fixture objA = fixA.getUserData() instanceof Player ? fixA : fixB;
((Player) objA.getUserData()).setTouching(false);
}
}
示例11: beginContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
public void beginContact(Contact contact)
{
if (contact == null || contact.getFixtureA() == null || contact.getFixtureB() == null ||
contact.getFixtureA().getBody() == null || contact.getFixtureB().getBody() == null ||
(GameEntity)contact.getFixtureA().getBody().getUserData() == null ||
(GameEntity)contact.getFixtureB().getBody().getUserData() == null)
{
return;
}
Fixture fA = contact.getFixtureA();
Fixture fB = contact.getFixtureB();
Body a = contact.getFixtureA().getBody();
Body b = contact.getFixtureB().getBody();
GameEntity geA = (GameEntity)a.getUserData();
GameEntity geB = (GameEntity)b.getUserData();
if (geA.getType() == EntityType.CHAINLINK && geB.getType() == EntityType.CHAINLINK)
{
return;
}
geA.collide(geB);
testPlayerCoin(geA, geB, true);
testPlayerSensor(geA, geB, true);
testPlayerMud(geA, geB, fA, fB, true);
testPlayerWater(geA, geB, fA, fB, true);
testPlayerTower(geA, geB, fA, fB, true);
testPlayerChair(geA, geB, true);
testPlayerBridge(geA, geB, fA, fB, true);
testPlayerSpotlight(geA, geB, fA, fB, true);
testCarrierCopChainLink(geA, geB, true);
testSteelHorseWall(geA, geB, true);
}
示例12: endContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
public void endContact(Contact contact)
{
if (contact == null || contact.getFixtureA() == null || contact.getFixtureB() == null ||
contact.getFixtureA().getBody() == null || contact.getFixtureB().getBody() == null ||
(GameEntity)contact.getFixtureA().getBody().getUserData() == null ||
(GameEntity)contact.getFixtureB().getBody().getUserData() == null)
{
return;
}
Fixture fA = contact.getFixtureA();
Fixture fB = contact.getFixtureB();
Body a = contact.getFixtureA().getBody();
Body b = contact.getFixtureB().getBody();
GameEntity geA = (GameEntity)a.getUserData();
GameEntity geB = (GameEntity)b.getUserData();
testPlayerCoin(geA, geB, false);
testPlayerSensor(geA, geB, false);
testPlayerMud(geA, geB, fA, fB, false);
testPlayerWater(geA, geB, fA, fB, false);
testPlayerTower(geA, geB, fA, fB, false);
testPlayerChair(geA, geB, false);
testPlayerBridge(geA, geB, fA, fB, false);
testPlayerSpotlight(geA, geB, fA, fB, false);
testCarrierCopChainLink(geA, geB, false);
testSteelHorseWall(geA, geB, false);
}
示例13: beginContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void beginContact(Contact contact) {
final Fixture a = contact.getFixtureA();
final Fixture b = contact.getFixtureB();
if (a == null || b == null)
return;
if ((a.getUserData().equals("food") && b.getUserData().equals("player"))) {
playerHitsFood(b, a);
} else if ((b.getUserData().equals("food") && a.getUserData().equals("player"))) {
playerHitsFood(a, b);
} else if ((b.getUserData().equals("food") && a.getUserData().equals("block"))) {
foodHitsBlock(b, a);
} else if ((a.getUserData().equals("food") && b.getUserData().equals("block"))) {
foodHitsBlock(a, b);
} else if ((a.getUserData().equals("player") && b.getUserData().equals("enemy"))) {
playerHitsEnemy(a, b);
} else if ((a.getUserData().equals("player") && b.getUserData().equals("plate"))) {
playerHitsPlate(a, b);
} else if ((b.getUserData().equals("player") && a.getUserData().equals("plate"))) {
playerHitsPlate(b, a);
} else if ((b.getUserData().equals("player") && a.getUserData().equals("goal"))) {
playerHitsGoal(b, a);
} else if ((b.getUserData().equals("player") && a.getUserData().equals("agariologic"))) {
playerHitsAgarLogic(b, a);
} else if ((a.getUserData().equals("food") && b.getUserData().equals("enemy"))) {
foodHitsEnemy(a, b);
} else if ((b.getUserData().equals("food") && a.getUserData().equals("enemy"))) {
foodHitsEnemy(b, a);
}
}
示例14: beginContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void beginContact(Contact contact) {
Fixture fixtureA = contact.getFixtureA();
Fixture fixtureB = contact.getFixtureB();
ContactListener listener = get(
fixtureA.getFilterData().categoryBits,
fixtureB.getFilterData().categoryBits
);
if (listener != null) {
listener.beginContact(contact);
}
}
示例15: endContact
import com.badlogic.gdx.physics.box2d.Contact; //导入方法依赖的package包/类
@Override
public void endContact(Contact contact) {
Fixture fixtureA = contact.getFixtureA();
Fixture fixtureB = contact.getFixtureB();
ContactListener listener = get(
fixtureA.getFilterData().categoryBits,
fixtureB.getFilterData().categoryBits
);
if (listener != null) {
listener.endContact(contact);
}
}