Search in sources :

Example 1 with ActionableModel

use of com.b3dgs.lionengine.game.feature.ActionableModel in project lionengine by b3dgs.

the class UtilActionnable method createActionable.

/**
 * Create the actionable.
 *
 * @param media The media.
 * @param services The services.
 * @return The prepared actionable.
 */
public static ActionableModel createActionable(Media media, Services services) {
    final Setup setup = new Setup(media);
    final Featurable featurable = new FeaturableModel(services, setup);
    final ActionableModel actionable = new ActionableModel(services, setup);
    actionable.prepare(featurable);
    return actionable;
}
Also used : ActionableModel(com.b3dgs.lionengine.game.feature.ActionableModel) FeaturableModel(com.b3dgs.lionengine.game.feature.FeaturableModel) Setup(com.b3dgs.lionengine.game.feature.Setup) Featurable(com.b3dgs.lionengine.game.feature.Featurable)

Example 2 with ActionableModel

use of com.b3dgs.lionengine.game.feature.ActionableModel in project lionengine by b3dgs.

the class ActionableModelTest method testObjectIsAction.

/**
 * Test execution when object is an action itself.
 */
@Test
void testObjectIsAction() {
    clicked.set(true);
    final Setup setup = new Setup(media);
    final ObjectAction object = new ObjectAction(services, setup, executed);
    final ActionableModel actionable = new ActionableModel(services, setup);
    actionable.prepare(object);
    actionable.update(1.0);
    assertTrue(executed.get());
}
Also used : ActionableModel(com.b3dgs.lionengine.game.feature.ActionableModel) Setup(com.b3dgs.lionengine.game.feature.Setup) Test(org.junit.jupiter.api.Test)

Aggregations

ActionableModel (com.b3dgs.lionengine.game.feature.ActionableModel)2 Setup (com.b3dgs.lionengine.game.feature.Setup)2 Featurable (com.b3dgs.lionengine.game.feature.Featurable)1 FeaturableModel (com.b3dgs.lionengine.game.feature.FeaturableModel)1 Test (org.junit.jupiter.api.Test)1