MapUtil.ts
682 Bytes
import { MapData } from "./MapData";
export class MapUtil {
static getThreeStarScore(mapData:MapData):number {
return Math.floor(mapData.totalScore * 0.6);
}
static getStarRate(mapData: MapData): number {
let threeStarScore = this.getThreeStarScore(mapData);
if(mapData.curScore >= threeStarScore) {
return 3;
}
else if(mapData.curScore < threeStarScore && mapData.curScore >= Math.floor(threeStarScore * 0.6)) {
//达到三星分数的60%
return 2;
}
else if(mapData.curScore >= Math.floor(threeStarScore*0.15)) {
return 1;
}
return 0;
}
}