feat(gui): add time GUI

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
pobadoba
2026-05-06 11:16:54 +09:00
parent 47d4ba8bfe
commit 021877902a
3 changed files with 48 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ import { gridCellToWorld, isWalkableCell } from "./game/grid.js";
// Initialize Babylon.js engine and scene
const canvas = document.getElementById("renderCanvas");
const engine = new BABYLON.Engine(canvas, true);
const canvasTime = document.getElementById("canvas-time");
const scene = new BABYLON.Scene(engine);
scene.clearColor = new BABYLON.Color4(0.05, 0.07, 0.1, 1);
@@ -99,6 +100,9 @@ engine.runRenderLoop(() => {
sphereMaterial.diffuseColor = sharedState.runtime.hasKey
? new BABYLON.Color3(0.25, 0.8, 0.45)
: new BABYLON.Color3(0.2, 0.55, 0.95);
if (canvasTime) {
canvasTime.textContent = `${sharedState.runtime.elapsedSeconds.toFixed(1)}s`;
}
scene.render();
});
@@ -146,7 +150,8 @@ function buildLevelFromGrid(grid) {
floor.position = new BABYLON.Vector3(0, 0, 0);
floor.checkCollisions = true;
const fm = new BABYLON.StandardMaterial('floorMat', scene);
fm.diffuseColor = new BABYLON.Color3(0.08, 0.08, 0.09);
fm.specularColor = new BABYLON.Color3(0.1, 0.1, 0.1);
fm.diffuseColor = new BABYLON.Color3(0.58, 0.58, 0.59);
floor.material = fm;
levelMeshes.push(floor);