How to use the nexus.board function in nexus

To help you get started, we’ve selected a few nexus examples, based on popular ways it is used in public projects.

github vonWolfehaus / von-grid / editor / modules / main.js View on Github external
// listen to the orbit controls to disable the raycaster while user adjusts the view
	scene.controls.addEventListener('wheel', onControlWheel);

	var grid = new vg.HexGrid({
		rings: 5,
		cellSize: 10
	});
	var board = new vg.Board(grid);
	var mouse = new vg.MouseCaster(board.group, scene.camera, canvas);
	var input = new Input(board.group, mouse);
	var plane = new EditorPlane(board.group, grid, mouse);

	nexus.input = input;
	nexus.plane = plane;
	nexus.board = board;
	nexus.grid = grid;
	nexus.scene = scene;
	nexus.mouse = mouse;

	var boardSize = 20; // TODO: get from settings
	plane.generatePlane(boardSize * boardSize * 1.8, boardSize * boardSize * 1.8);
	plane.addHoverMeshToGroup(scene.container);

	board.generateOverlay(boardSize);

	tower.tileAction.add(onMapChange, this);

	// scene.add(board.group);
	scene.focusOn(board.group);

	if (map) {
github vonWolfehaus / von-grid / editor / modules / tools / addTile.js View on Github external
function addTile(cell) {
		if (!cell || nexus.board.getTileAtCell(cell)) return;

		var newCell = new vg.Cell();
		newCell.copy(cell);
		newCell.h = Math.abs(nexus.mouse.wheel * nexus.board.tileHeightStep);

		var newTile = tilemaker.getTile(newCell, ui.activeTile.slotid);

		nexus.board.addTile(newTile);

		tower.tileAction.dispatch(tower.TILE_ADD, newTile);

		return newTile;
	}
github vonWolfehaus / von-grid / editor / modules / Editor.js View on Github external
function addTile(cell) {
		if (!cell || nexus.board.getTileAtCell(cell)) return;

		var newCell = new vg.Cell();
		newCell.copy(cell);
		newCell.h = Math.abs(nexus.mouse.wheel * heightStep);

		var newTile = nexus.grid.generateTile(newCell, 0.95);

		nexus.board.addTile(newTile);

		tower.tileAction.dispatch(tower.TILE_ADD, newTile);

		return newTile;
	}
github vonWolfehaus / von-grid / editor / modules / tools / addTile.js View on Github external
function addTile(cell) {
		if (!cell || nexus.board.getTileAtCell(cell)) return;

		var newCell = new vg.Cell();
		newCell.copy(cell);
		newCell.h = Math.abs(nexus.mouse.wheel * nexus.board.tileHeightStep);

		var newTile = tilemaker.getTile(newCell, ui.activeTile.slotid);

		nexus.board.addTile(newTile);

		tower.tileAction.dispatch(tower.TILE_ADD, newTile);

		return newTile;
	}
github vonWolfehaus / von-grid / editor / modules / tilemaker.js View on Github external
t.material = mat;
			t.mesh.material = mat;
			t.cell = cell;
			cell.tile = t;
			t.position.copy(nexus.grid.cellToPixel(cell));
			t.position.y = t.cell.h * nexus.board.tileHeightStep;
		}
		else {
			t = new vg.Tile({
				cell: cell,
				geometry: map.mesh || nexus.gen.geoGen.tileGeo,
				material: materials[matid]
			});
		}

		nexus.board.addTile(t);

		return t;
	}
github vonWolfehaus / von-grid / editor / modules / Editor.js View on Github external
function addTile(cell) {
		if (!cell || nexus.board.getTileAtCell(cell)) return;

		var newCell = new vg.Cell();
		newCell.copy(cell);
		newCell.h = Math.abs(nexus.mouse.wheel * heightStep);

		var newTile = nexus.grid.generateTile(newCell, 0.95);

		nexus.board.addTile(newTile);

		tower.tileAction.dispatch(tower.TILE_ADD, newTile);

		return newTile;
	}
github vonWolfehaus / von-grid / editor / app.js View on Github external
function addTile(cell) {
		if (!cell || nexus.board.getTileAtCell(cell)) return;

		var newCell = new vg.Cell();
		newCell.copy(cell);
		newCell.h = Math.abs(nexus.mouse.wheel * heightStep);

		var newTile = nexus.grid.generateTile(newCell, 0.95);

		nexus.board.addTile(newTile);

		tower.tileAction.dispatch(tower.TILE_ADD, newTile);

		return newTile;
	}
github vonWolfehaus / von-grid / editor / app.js View on Github external
function addTile(cell) {
		if (!cell || nexus.board.getTileAtCell(cell)) return;

		var newCell = new vg.Cell();
		newCell.copy(cell);
		newCell.h = Math.abs(nexus.mouse.wheel * heightStep);

		var newTile = nexus.grid.generateTile(newCell, 0.95);

		nexus.board.addTile(newTile);

		tower.tileAction.dispatch(tower.TILE_ADD, newTile);

		return newTile;
	}
github vonWolfehaus / von-grid / editor / modules / tilemaker.js View on Github external
function resetHeightStep(newHeightStep) {
		if (!nexus.board) return;
		var i, t;
		var step = newHeightStep || nexus.board.tileHeightStep;
		for (i = 0; t = nexus.board.tiles[i]; i++) {
			t.position.y = t.cell.h * step;
		}
	}