Commit 2b88f7a8 authored by Joker Huang's avatar Joker Huang

1

parent 1db3ea86
......@@ -8,18 +8,20 @@ export default class Game {
beyondFriends = [] // 超越好友配置
targetScene
meshMatUrl
gameLevels
addScoreConfig = {
score:1,
continuouslyScore:1
}
constructor(config,targetScene){
let {spFall,beyondFriends,meshMatUrl,addScoreConfig} = config
let {spFall,beyondFriends,meshMatUrl,addScoreConfig,gameLevels} = config
this.spFall = spFall
this.beyondFriends = beyondFriends
this.addScoreConfig = addScoreConfig
this.targetScene = targetScene
this.meshMatUrl = meshMatUrl
this.gameLevels = gameLevels
this.initScene()
}
......@@ -103,7 +105,7 @@ export default class Game {
// skyBox.material=skyMat
this.scene = new BABYLON.Scene(engine);
// this.scene.ambientColor = BABYLON.Color3.FromHexString("#ffffff");
this.scene.clearColor = BABYLON.Color3.FromHexString("#ffffff");
this.scene.clearColor = BABYLON.Color3.FromHexString("#e5efb0");
this.scene.collisionsEnabled = true;
this.light = new BABYLON.HemisphericLight("dir01", new BABYLON.Vector3(0, 1, 0.3), this.scene);
......@@ -332,6 +334,7 @@ export default class Game {
}
continuouslyScoreFlag = 0
scoreFlag = 0
private onBeforeRender(){
let now = Date.now()
......@@ -392,7 +395,7 @@ export default class Game {
let addScore = 1
if(this.continuouslyScoreFlag>0){
if(this.continuouslyScoreFlag>3 ){
addScore = 2*this._layerNum
addScore = 2 * this._layerNum
}else{
addScore = this.addScoreConfig.continuouslyScore
}
......@@ -401,6 +404,19 @@ export default class Game {
}
this.targetScene.addScore&&this.targetScene.addScore(addScore,this._layerNum);
this._score += addScore
if(this.degree<8){
for(let i=7;i>=1;i++){
if(this._score > this.gameLevels['level'+i].endScore){
// 改变难度
this.handleTips(tipsType.levelChange)
break
}
}
}
if(this._score - this.scoreFlag > 200){
this.handleTips(tipsType.during200)
this.scoreFlag = this._score
}
this.continuouslyScoreFlag++
if (this.beyondFriends.length > 0) {
for (let i = this.beyondFriends.length - 1; i >= 0; i--) {
......@@ -502,7 +518,7 @@ export default class Game {
case tipsType.beyondFriend:
idx=1
break
case tipsType.degreeChange:
case tipsType.levelChange:
idx = 2
break
case tipsType.during200:
......
export enum tipsType{
"beyondFriend",
"degreeChange",
"levelChange",
"during200",
"pickRocket",
"bigScore"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment