

export class AppLib {
    static instance:AppLib = new AppLib();

    private static score:number = 0;
    private static hiScore:number = 0;

    private constructor(){}

    static getInstance():AppLib{
        return this.instance;
    }

    saveScore(val:number){
        AppLib.score = val;
    }

    loadScore():number{
        return AppLib.score;
    }

    loadHiScore():number{
        return AppLib.hiScore;
    }

    incScore(){
        this.saveScore(this.loadScore()+1);
        let score:number = this.loadScore();
        if (score>AppLib.hiScore) {
            AppLib.hiScore = score;
        }
    }

    reset(){
        AppLib.score = 0;
    }

}