Search in sources :

Example 1 with HitComponent

use of com.gemserk.commons.artemis.components.HitComponent in project commons-gdx by gemserk.

the class HitDetectionSystem method process.

@Override
protected void process(Entity e) {
    HitComponent hitComponent = e.getComponent(HitComponent.class);
    PhysicsComponent physicsComponent = e.getComponent(PhysicsComponent.class);
    Contacts contact = physicsComponent.getContact();
    Trigger trigger = hitComponent.getTrigger();
    if (!contact.isInContact())
        return;
    if (trigger.isAlreadyTriggered())
        return;
    trigger.trigger(e);
}
Also used : PhysicsComponent(com.gemserk.commons.artemis.components.PhysicsComponent) Trigger(com.gemserk.commons.artemis.triggers.Trigger) Contacts(com.gemserk.commons.gdx.box2d.Contacts) HitComponent(com.gemserk.commons.artemis.components.HitComponent)

Aggregations

HitComponent (com.gemserk.commons.artemis.components.HitComponent)1 PhysicsComponent (com.gemserk.commons.artemis.components.PhysicsComponent)1 Trigger (com.gemserk.commons.artemis.triggers.Trigger)1 Contacts (com.gemserk.commons.gdx.box2d.Contacts)1