@Override public void initApp() { // addDefaultLight(); addDebugActions(); // init game GameTestImpl game = (GameTestImpl) Game.getInstance(); game.setApplication(this); // create level Rect2i bounds = new Rect2i(-20, -20, 20, 20); Level level = TestUtils.createLevel( bounds, TestUtils.createRandomFlatDrawingMap( bounds.getWidth(), bounds.getHeight(), TestUtils.TEST_TILES_3, TestUtils.TEST_TILES_COUNT_X_3, TestUtils.TEST_TILES_COUNT_Y_3, new Point2i(0, 7), new Point2i(15, 7), new Point2i(16, 7), new Point2i(17, 7), new Point2i(18, 7), new Point2i(19, 7), new Point2i(20, 7), new Point2i(21, 7), new Point2i(22, 7)), TestUtils.createFlatMovingMap(bounds.getWidth(), bounds.getHeight()), MVCContainer.create(), MVCContainer.create()); LevelAppState levelAppState = new LevelAppState(level); stateManager.callNext(levelAppState, new HashMap<>()); // create player at the center // createPlayer(level, 0, 0, 0); createAnimatedPlayer(level, 0, 0, 0, SINBAD); game.setPlayer(playerModel); // create positional audio view AudioView.Positional audioView = new JMEAudioView(); ((JMEAudioView) audioView).setBufferMode(JMEAudioView.BufferMode.BUFFERED); ((JMEAudioView) audioView).setAudioFile(POINT_AUDIO_FILE); audioView.setPositional(true); audioView.setPosition(5, 7, 0); audioView.setLooping(true); audioView.setRefDistance(0.02f); audioView.setVolume(2); audioView.play(); level.getObjects().addView(audioView); // create background audio view AudioView background = new JMEAudioView(BACKGROUND_AUDIO_FILE, JMEAudioView.BufferMode.BUFFERED); background.setLooping(true); background.setVolume(0.05f); background.play(); level.getObjects().addView(background); // add light LightView.Ambient ambient = new JMELightView.Ambient(); ambient.setColor(new ColorRGBA(0.2f, 0.2f, 0.2f, 1)); level.getObjects().addView(ambient); LightView.Directional directional = new JMELightView.Directional(); directional.setColor(new ColorRGBA(0.5f, 0.5f, 0.4f, 1)); directional.setDirection(new Vector3f(0.0f, -0.5f, -0.4f).normalizeLocal()); level.getObjects().addView(directional); // visualizate point audio LightView.Point point3 = new JMELightView.Point(); point3.setColor(new ColorRGBA(5, 5, 5, 1)); point3.setPosition(5, 7, 6); point3.setRadius(10); point3.setShadowEnabled(false); level.getObjects().addView(point3); // add FXAA-view JMEFXAAView fxaa = new JMEFXAAView(); level.getObjects().addView(fxaa); }
private LevelElementNodeFactory( List<EditorLevelElement<?, ?, ?>> elements, MVCContainer container) { this.elements = elements; container.addListener(this); }