private void checkPickupCollision(Object pickup, Object o) { if (o instanceof Player || o instanceof PlayerRagDoll.Part) { events.queueEvent(EventType.PICKUP_TOUCHED, pickup); } else { events.queueEvent(EventType.PICKUP_DESTROYED, pickup); } }
private void checkRocket(Object o1, Object o2) { if (o1 instanceof Rocket && rocketCollidesWith(o2)) { events.queueEvent(EventType.ROCKET_HIT, o1); } else if (o2 instanceof Rocket && rocketCollidesWith(o1)) { events.queueEvent(EventType.ROCKET_HIT, o2); } }
private void checkPlayerCollision(Object o, Vector2 position) { // pickup checked already if (o instanceof Pickup) return; // rocket checked already if (o instanceof Rocket) return; final PlayerContactPool.PlayerContact playerContact = playerContactPool.obtain(); playerContact.object = o; // parts are small and dont really intersect, so just getting first one is ok playerContact.position = position; events.queueEvent(EventType.PLAYER_PART_TOUCHED, playerContact); }
private boolean checkSensor(Fixture sensor, Fixture other) { final SensorType type = (SensorType) sensor.getUserData(); final Object sensorData = sensor.getBody().getUserData(); final Object otherData = other.getBody().getUserData(); if (type == null) return false; switch (type) { case SCORE: if (otherData instanceof Player) { events.queueEvent(EventType.PLAYER_SCORED, sensorData); } return true; default: break; } return false; }
private void checkPlayerEndTouch(Object o) { if (o instanceof Pickup) return; events.queueEvent(EventType.PLAYER_TOUCHED_END); }