数据层
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 玩家数据
|
||||
*/
|
||||
import { BaseData } from "./BaseData";
|
||||
|
||||
export class PlayerData extends BaseData {
|
||||
private _name: string = '';
|
||||
private _score: number = 0;
|
||||
|
||||
public reset(): void {
|
||||
this._name = '';
|
||||
this._score = 0;
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
this._name = '';
|
||||
this._score = 0;
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
super.destroy();
|
||||
// 这里可以做额外释放资源的操作
|
||||
}
|
||||
|
||||
public setName(name: string): void {
|
||||
this._name = name;
|
||||
}
|
||||
|
||||
public getName(): string {
|
||||
return this._name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user