diff --git a/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/factory/BulletFactory.java b/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/factory/BulletFactory.java new file mode 100644 index 0000000..f72b651 --- /dev/null +++ b/app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/factory/BulletFactory.java @@ -0,0 +1,33 @@ +package org.ntlab.radishforandroidstudio.cactusClient.factory; + +import android.content.res.Resources; + +import org.ntlab.radishforandroidstudio.cactusClient.models.Bullet; +import org.ntlab.radishforandroidstudio.framework.model3D.ModelFactory; +import org.ntlab.radishforandroidstudio.framework.model3D.Object3D; +import org.ntlab.radishforandroidstudio.framework.physics.Velocity3D; +import org.ntlab.radishforandroidstudio.java3d.Appearance; +import org.ntlab.radishforandroidstudio.java3d.Material; +import org.ntlab.radishforandroidstudio.java3d.Vector3d; + +public abstract class BulletFactory { + public final Bullet create(Resources resources) { + + Appearance ap1 = createAppearance(); + ap1.setMaterial(createMaterial()); + + Object3D pochaBody = null; + try { + pochaBody = ModelFactory.loadModel(resources, getModelName(), ap1).createObject(); + } catch (Exception e) { + e.printStackTrace(); + } + + Bullet b = new Bullet(pochaBody, null); + return b; + } + + protected abstract Material createMaterial(); + protected Appearance createAppearance() { return new Appearance(); } + protected abstract String getModelName(); +}