|
@@ -55,7 +55,10 @@ export default class GameController extends cc.Component {
|
|
|
//显示进度条
|
|
|
LoadingView.single.Show();
|
|
|
//关卡配置
|
|
|
- this.levelConfig=ConfigManager.single.GetConfigItem(ConfigKeys.Levels,GameModel.single.currentLevel);
|
|
|
+ let levelConfigs:any[]=ConfigManager.single.GetConfigList(ConfigKeys.Levels);
|
|
|
+ let level:number=GameModel.single.currentLevel%levelConfigs.length;
|
|
|
+ this.levelConfig=ConfigManager.single.GetConfigItem(ConfigKeys.Levels,level);
|
|
|
+ //汽车配置
|
|
|
this.carConfig=ConfigManager.single.GetConfigItem(ConfigKeys.Car,GameModel.single.currentCarId);
|
|
|
this.LoadPolygon();
|
|
|
}
|
|
@@ -165,27 +168,30 @@ export default class GameController extends cc.Component {
|
|
|
//多边形更新
|
|
|
this.inCirclePolygon.Update(dt);
|
|
|
|
|
|
-
|
|
|
//检测游戏是否结束
|
|
|
if(this.isGameOver==false){
|
|
|
if(this.isDrop){
|
|
|
let currentTime:number=cc.sys.now();
|
|
|
if(currentTime-this.startDropTime>2000){
|
|
|
cc.log("游戏结束!");
|
|
|
- this.GameOver();
|
|
|
+ this.GameOver(false);
|
|
|
}
|
|
|
}else{
|
|
|
if(this.player.logicPosition.z>this.levelConfig.endPos){
|
|
|
cc.log("到达终点");
|
|
|
- this.GameOver();
|
|
|
+ this.GameOver(true);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- GameOver():void{
|
|
|
+ GameOver(isWin:boolean):void{
|
|
|
this.isGameOver=true;
|
|
|
GUIManager.single.Show(UIKeys.WXS04,true);
|
|
|
+ if(isWin){
|
|
|
+ GameModel.single.currentLevel++;
|
|
|
+ GameModel.single.SaveToLoacl();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private rectsTemp:number[];
|