draw busses
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user