draw busses

This commit is contained in:
Evan Scamehorn
2025-12-02 15:02:30 -06:00
parent 68ca45f58e
commit dc0659b1df
3 changed files with 118 additions and 2 deletions

View File

@@ -19,6 +19,13 @@ export class RouteManager {
this.onRouteChanged = null;
this.gameManager = null;
this.vehicleSystem = null;
this.latestPathPoints = [];
}
setVehicleSystem(vs) {
this.vehicleSystem = vs;
}
setGameManager(gm) {
@@ -127,6 +134,11 @@ export class RouteManager {
// 2. Pay
this.gameManager.deductFunds(cost);
// Spawn bus
if (this.vehicleSystem && this.latestPathPoints.length > 0) {
this.vehicleSystem.addBusToRoute(this.latestPathPoints);
}
// 3. Freeze & Save
this.currentPathMesh.material.color.setHex(0x10B981);
@@ -222,6 +234,8 @@ export class RouteManager {
});
}
this.latestPathPoints = fullPathPoints;
// Rebuild Mesh
if (this.currentPathMesh) {
this.scene.remove(this.currentPathMesh);