import { Vec3 } from "cc"; import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ECSEntity } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECSEntity"; import { VM } from "../../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel"; import { Grid } from "../../grid/Grid"; import { Obstacle } from "../../obstacle/Obstacle"; import { Puppet } from "../../puppet/puppet"; import { Station } from "../../station/Station"; import { Vehicle } from "../../vehicle/Vehicle"; type Cell = Puppet | Obstacle export interface MapInfo { x: number, y: number, fill?: string | number pos: Vec3 } @ecs.register('CheckpointModel') export class CheckpointModelComp extends ecs.Comp { private vm: any = {}; private _grid: Grid[][] = [] private _path_grid: MapInfo[][] = [] private _cells: Cell[][] = [] private _station: Station[] = [] private _vehicles: Vehicle[] = [] /** 格子 */ get grids(): Grid[][] { return this._grid; } set grids(value: Grid[][]) { this._grid = value; } /** 寻路数据 */ get path_grid(): MapInfo[][] { return this._path_grid; } set path_grid(value: MapInfo[][]) { this._path_grid = value; } /** 站台 */ get stations(): Station[] { return this._station; } set stations(value: Station[]) { this._station = value; } /** 车辆 */ get vehicles(): Vehicle[] { return this._vehicles; } set vehicles(value: Vehicle[]) { this._vehicles = value; } /** 棋盘格中物体 */ get cells(): Cell[][] { return this._cells; } set cells(value: Cell[][]) { this._cells = value; } vmAdd() { VM.add(this.vm, "Checkpoint"); } vmRemove() { VM.remove("Checkpoint"); } reset() { this.grids = [] this.path_grid = [] this.cells = [] this.stations = [] this.vehicles = [] this.vmRemove(); } }