pinball/assets/_Game/Scripts/Factory/Base.ts

27 lines
567 B
TypeScript
Raw Normal View History

2024-06-09 05:12:08 -07:00
import { _decorator, Component, Node, Prefab } from 'cc';
const { ccclass, property, executionOrder } = _decorator;
@ccclass('Factory')
export abstract class Factory<T> {
@property(Prefab)
protected prefab: Prefab;
public init() {}
public abstract create(parent: Node): T;
}
@ccclass('FactoryComponent')
export abstract class FactoryComponent<T> extends Component {
@property(Prefab)
protected prefab: Prefab;
protected onLoad(): void {
this.init();
}
public init() {}
public abstract create(parent: Node): T;
}