32 lines
595 B
TypeScript
32 lines
595 B
TypeScript
/**
|
|
* 玩家数据
|
|
*/
|
|
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;
|
|
}
|
|
} |