Search in sources :

Example 1 with AnimatorFrameListener

use of com.b3dgs.lionengine.AnimatorFrameListener in project lionengine by b3dgs.

the class CollidableFramedModel method recycle.

/*
     * CollidableFramed
     */
@Override
public void recycle() {
    for (final Collision collision : config.getCollisions()) {
        collidable.addCollision(collision);
        collidable.setEnabled(false, collision);
    }
    animatable.addListener((AnimatorFrameListener) frame -> {
        for (final Collision collision : last) {
            collidable.setEnabled(false, collision);
        }
        last = config.getCollision(Integer.valueOf(frame));
        for (final Collision collision : last) {
            collidable.setEnabled(true, collision);
            collidable.forceUpdate();
        }
    });
}
Also used : LionEngineException(com.b3dgs.lionengine.LionEngineException) Collidable(com.b3dgs.lionengine.game.feature.collidable.Collidable) Collection(java.util.Collection) Setup(com.b3dgs.lionengine.game.feature.Setup) AnimatorFrameListener(com.b3dgs.lionengine.AnimatorFrameListener) Configurer(com.b3dgs.lionengine.game.Configurer) Recyclable(com.b3dgs.lionengine.game.feature.Recyclable) Services(com.b3dgs.lionengine.game.feature.Services) Collision(com.b3dgs.lionengine.game.feature.collidable.Collision) Animatable(com.b3dgs.lionengine.game.feature.Animatable) FeatureGet(com.b3dgs.lionengine.game.feature.FeatureGet) Collections(java.util.Collections) Featurable(com.b3dgs.lionengine.game.feature.Featurable) FeatureModel(com.b3dgs.lionengine.game.feature.FeatureModel) Collision(com.b3dgs.lionengine.game.feature.collidable.Collision)

Aggregations

AnimatorFrameListener (com.b3dgs.lionengine.AnimatorFrameListener)1 LionEngineException (com.b3dgs.lionengine.LionEngineException)1 Configurer (com.b3dgs.lionengine.game.Configurer)1 Animatable (com.b3dgs.lionengine.game.feature.Animatable)1 Featurable (com.b3dgs.lionengine.game.feature.Featurable)1 FeatureGet (com.b3dgs.lionengine.game.feature.FeatureGet)1 FeatureModel (com.b3dgs.lionengine.game.feature.FeatureModel)1 Recyclable (com.b3dgs.lionengine.game.feature.Recyclable)1 Services (com.b3dgs.lionengine.game.feature.Services)1 Setup (com.b3dgs.lionengine.game.feature.Setup)1 Collidable (com.b3dgs.lionengine.game.feature.collidable.Collidable)1 Collision (com.b3dgs.lionengine.game.feature.collidable.Collision)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1