pinball/assets/_Game/Scripts/Manager/GameManager.ts

29 lines
786 B
TypeScript

import { _decorator, Component, Prefab, Node } from 'cc';
import ObjectPool from '../Pool/ObjectPool';
import { Ball } from '../Gameplay/Ball';
const { ccclass, property } = _decorator;
@ccclass('GameManager')
export class GameManager extends Component {
//singleton
private static _instance: GameManager = null;
public static get instance(): GameManager {
return GameManager._instance;
}
@property({ type: Prefab, visible: true })
private _ballPrefab: Prefab;
private _ballPool: ObjectPool;
public highestStreak: number;
public score = 0;
protected onLoad(): void {
this._ballPool = new ObjectPool(this._ballPrefab, 10, false, Ball);
}
public onRevive() {
throw new Error('Method not implemented.');
}
}