Search in sources :

Example 16 with TransformableModel

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

the class UtilAttackable method prepare.

/**
 * Create the featurable.
 *
 * @param featurable The featurable to prepare.
 */
public static void prepare(Featurable featurable) {
    final Animator animator = new AnimatorMock();
    animator.play(new Animation("test", 1, 1, 1.0, false, false));
    featurable.addFeature(new AnimatableModel(animator));
    featurable.addFeature(new TransformableModel());
}
Also used : Animator(com.b3dgs.lionengine.Animator) AnimatableModel(com.b3dgs.lionengine.game.feature.AnimatableModel) TransformableModel(com.b3dgs.lionengine.game.feature.TransformableModel) Animation(com.b3dgs.lionengine.Animation) AnimatorMock(com.b3dgs.lionengine.core.drawable.AnimatorMock)

Example 17 with TransformableModel

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

the class CollidableModelTest method createFeaturable.

/**
 * Create a featurable test.
 *
 * @param config The configuration reference.
 * @param services The services reference.
 * @return The featurable test.
 */
public static FeaturableModel createFeaturable(Media config, Services services) {
    final Setup setup = new Setup(config);
    final FeaturableModel featurable = new FeaturableModel(services, setup);
    final Transformable transformable = featurable.addFeatureAndGet(new TransformableModel(services, setup));
    transformable.setLocation(1.0, 2.0);
    transformable.setSize(2, 2);
    featurable.addFeature(new CollidableModel(services, setup));
    return featurable;
}
Also used : TransformableModel(com.b3dgs.lionengine.game.feature.TransformableModel) Transformable(com.b3dgs.lionengine.game.feature.Transformable) FeaturableModel(com.b3dgs.lionengine.game.feature.FeaturableModel) Setup(com.b3dgs.lionengine.game.feature.Setup) UtilSetup(com.b3dgs.lionengine.game.feature.UtilSetup)

Example 18 with TransformableModel

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

the class CollidableFramedModelTest method createFeaturable.

/**
 * Create a featurable test.
 *
 * @param config The configuration reference.
 * @param services The services reference.
 * @return The featurable test.
 */
public static FeaturableModel createFeaturable(Media config, Services services) {
    final Setup setup = new Setup(config);
    final FeaturableModel featurable = new FeaturableModel(services, setup);
    final Transformable transformable = featurable.addFeatureAndGet(new TransformableModel(services, setup));
    transformable.setLocation(1.0, 2.0);
    featurable.addFeature(new AnimatableModel(services, setup));
    featurable.addFeatureAndGet(new CollidableModel(services, setup));
    featurable.addFeature(new CollidableFramedModel(services, setup));
    return featurable;
}
Also used : CollidableModel(com.b3dgs.lionengine.game.feature.collidable.CollidableModel) AnimatableModel(com.b3dgs.lionengine.game.feature.AnimatableModel) TransformableModel(com.b3dgs.lionengine.game.feature.TransformableModel) Transformable(com.b3dgs.lionengine.game.feature.Transformable) FeaturableModel(com.b3dgs.lionengine.game.feature.FeaturableModel) Setup(com.b3dgs.lionengine.game.feature.Setup) UtilSetup(com.b3dgs.lionengine.game.feature.UtilSetup)

Example 19 with TransformableModel

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

the class UtilLaunchable method createLauncher.

/**
 * Create launcher.
 *
 * @param services The services.
 * @param setup The setup.
 * @param featurable The featurable.
 * @return The extractable.
 */
public static Launcher createLauncher(Services services, Setup setup, Featurable featurable) {
    services.add(new Factory(services));
    services.add(new Handler(services));
    if (!featurable.hasFeature(Transformable.class)) {
        featurable.addFeature(new TransformableModel(services, setup));
    }
    final LauncherModel launcher = new LauncherModel(services, setup);
    launcher.prepare(featurable);
    launcher.recycle();
    launcher.setOffset(1, 2);
    launcher.setDelay(100);
    return launcher;
}
Also used : TransformableModel(com.b3dgs.lionengine.game.feature.TransformableModel) Factory(com.b3dgs.lionengine.game.feature.Factory) Handler(com.b3dgs.lionengine.game.feature.Handler) Transformable(com.b3dgs.lionengine.game.feature.Transformable)

Example 20 with TransformableModel

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

the class UtilLaunchable method createLaunchable.

/**
 * Create launchable.
 *
 * @param services The services.
 * @param setup The setup.
 * @param featurable The featurable.
 * @return The launchable.
 */
public static Launchable createLaunchable(Services services, Setup setup, Featurable featurable) {
    featurable.addFeature(new TransformableModel(services, setup));
    final Launchable launchable = new LaunchableModel(services, setup);
    launchable.prepare(featurable);
    launchable.setLocation(0.0, 0.0);
    launchable.setVector(new Force(0.0, 1.0));
    return launchable;
}
Also used : TransformableModel(com.b3dgs.lionengine.game.feature.TransformableModel) Force(com.b3dgs.lionengine.game.Force)

Aggregations

TransformableModel (com.b3dgs.lionengine.game.feature.TransformableModel)37 Test (org.junit.jupiter.api.Test)20 FeaturableModel (com.b3dgs.lionengine.game.feature.FeaturableModel)19 Transformable (com.b3dgs.lionengine.game.feature.Transformable)17 Setup (com.b3dgs.lionengine.game.feature.Setup)12 Featurable (com.b3dgs.lionengine.game.feature.Featurable)11 Identifiable (com.b3dgs.lionengine.game.feature.Identifiable)10 UtilSetup (com.b3dgs.lionengine.game.feature.UtilSetup)9 Media (com.b3dgs.lionengine.Media)6 AtomicReference (java.util.concurrent.atomic.AtomicReference)6 AnimatableModel (com.b3dgs.lionengine.game.feature.AnimatableModel)5 Services (com.b3dgs.lionengine.game.feature.Services)5 UtilTransformable (com.b3dgs.lionengine.game.feature.UtilTransformable)5 MapTileGame (com.b3dgs.lionengine.game.feature.tile.map.MapTileGame)5 Medias (com.b3dgs.lionengine.Medias)4 Handler (com.b3dgs.lionengine.game.feature.Handler)4 BeforeEach (org.junit.jupiter.api.BeforeEach)4 Animation (com.b3dgs.lionengine.Animation)3 UtilAssert.assertEquals (com.b3dgs.lionengine.UtilAssert.assertEquals)3 UtilAssert.assertTrue (com.b3dgs.lionengine.UtilAssert.assertTrue)3