package net.anzix.fsz.world;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Vector3;
import com.ardor3d.scenegraph.shape.Box;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import net.anzix.fsz.NodeRepository;
import net.anzix.fsz.eventbus.Event;
import net.anzix.fsz.eventbus.EventListener;
import net.anzix.fsz.eventbus.event.Init;
import net.anzix.fsz.math.Double2D;
/**
*
* @author elek
*/
@Singleton
public class FlatTerrain implements EventListener, Terrain {
double width = 100;
double height = 100;
@Inject
private NodeRepository nodes;
@Inject
Physics physics;
public void onEvent(Event event) {
if (event instanceof Init) {
Box floor = new Box("Floor", new Vector3(), width, 1, height);
floor.setTranslation(0, -30, 0);
// floor.setRandomColors();
floor.setSolidColor(ColorRGBA.GREEN);
nodes.attachToParent(NodeRepository.ROOT_NODE,floor);
nodes.getNode(NodeRepository.ROOT_NODE).updateGeometricState(0);
physics.addFloor(floor);
}
}
public Double2D getSize() {
return new Double2D(width, height);
}
}