Newer
Older
Cactus-CleanArchitecture / app / src / main / java / org / ntlab / radishforandroidstudio / cactusClient / factory / BulletFactory.java
package org.ntlab.radishforandroidstudio.cactusClient.factory;

import android.content.res.Resources;

import org.ntlab.radishforandroidstudio.cactusClient.models.MyBullet;
import org.ntlab.radishforandroidstudio.framework.model3D.ModelFactory;
import org.ntlab.radishforandroidstudio.framework.model3D.Object3D;
import org.ntlab.radishforandroidstudio.java3d.Appearance;
import org.ntlab.radishforandroidstudio.java3d.Material;

public abstract class BulletFactory {
    public final MyBullet create(Resources resources) {

        Appearance ap1 = createAppearance();
        ap1.setMaterial(createMaterial());

        Object3D pochaBody = null;
        try {
            pochaBody = ModelFactory.loadModel(resources, getModelName(), ap1).createObject();
            pochaBody.scale(getScale());
        } catch (Exception e) {
            e.printStackTrace();
        }

        MyBullet b = new MyBullet(pochaBody, null);
        return b;
    }

    protected abstract Material createMaterial();
    protected Appearance createAppearance() { return new Appearance(); }
    protected float getScale() { return 1.0f; };
    protected abstract String getModelName();
}