| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- import { Vec3, v3 } from "cc";
- import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
- import { VM } from "../../../../../extensions/oops-plugin-framework/assets/libs/model-view/ViewModel";
- export enum VehicleState {
- Normal,
- Wait,
- Station,
- Leave
- }
- @ecs.register('VehicleModel')
- export class VehicleModelComp extends ecs.Comp {
- private vm: any = {};
- private _color: string = "";
- private _type: string = 'car'
- private _path: string = ""
- private _capcity: number = 3
- private _useSit: number = 0
- private _status: number = VehicleState.Normal // 0 正常 1 等待进站 2 站台 3出站
- private _ready: boolean = false
- get isFull(): boolean {
- return this._useSit >= this._capcity
- }
- get sitPos():Vec3[]{
- return [v3(-0.5,0,0),v3(0,0,0),v3(0.5,0,0)]
- }
- // 车辆状态
- get status(): VehicleState {
- return this._status
- }
- set status(s: VehicleState) {
- this._status = s
- }
- // 车辆状态
- get ready(): boolean {
- return this._ready
- }
- set ready(r: boolean) {
- this._ready = r
- }
- /** 颜色 */
- get color(): string {
- return this._color;
- }
- set color(value: string) {
- this._color = value;
- }
- /** 模型类型 车-飞机 */
- get type(): string {
- return this._type;
- }
- set type(value: string) {
- this._type = value;
- // this.vm.type = value;
- }
- /** 模型路径 */
- get path(): string {
- return this._path;
- }
- set path(value: string) {
- this._path = value;
- // this.vm.path = value;
- }
- /** 容量 */
- get capcity(): number {
- return this._capcity;
- }
- set capcity(value: number) {
- this._capcity = value;
- // this.vm.capcity = value;
- }
- /** 上车席位 */
- get useSit(): number {
- return this._useSit;
- }
- set useSit(value: number) {
- this._useSit = value;
- // this.vm.useSit = value;
- }
- // vmAdd() {
- // VM.add(this.vm, "Vehicle");
- // }
- // vmRemove() {
- // this.vm.reset();
- // VM.remove("Vehicle");
- // }
- reset() {
- // this.vmRemove();
- }
- }
|