Commit 7062d043 authored by zjz1994's avatar zjz1994

调整炮台充能

parent 80ec99ba
...@@ -268,8 +268,10 @@ export default class MainScene extends Scene { ...@@ -268,8 +268,10 @@ export default class MainScene extends Scene {
private _steps: number; private _steps: number;
private stepNumber: StepNumber; private stepNumber: StepNumber;
//新增炮台 //新增炮台,地图上所有的炮台
cannoArr:Array<{idx:number,ele:Element}> = []; cannoArr:Array<{idx:number,ele:Element}> = [];
//准备发射的炮台
readyCannoArr:number[] = [];
get steps(): number { get steps(): number {
return this._steps return this._steps
} }
...@@ -2048,20 +2050,26 @@ export default class MainScene extends Scene { ...@@ -2048,20 +2050,26 @@ export default class MainScene extends Scene {
} }
} }
if(this.eliminatedElements.length>0){ // if(this.eliminatedElements.length>0){
for(var i=0;i<this.eliminatedElements.length;i++){ // for(var i=0;i<this.eliminatedElements.length;i++){
var ielimidx = this.eliminatedElements[i]; // var ielimidx = this.eliminatedElements[i];
for(var p=0;p<this.cannoArr.length;p++){ // for(var p=0;p<this.cannoArr.length;p++){
var pcannoidx = this.cannoArr[p].idx; // var pcannoidx = this.cannoArr[p].idx;
var isnext = Tool.checkNebByidx(pcannoidx,ielimidx); // var isnext = Tool.checkNebByidx(pcannoidx,ielimidx);
if(isnext){ // if(isnext){
var pcannoele = this.cannoArr[p].ele; // var pcannoele = this.cannoArr[p].ele;
pcannoele.addOneCannoStat(); // pcannoele.addOneCannoStat();
} // var pcannostat = pcannoele.checkCannoStat();
} // if(pcannostat){
} // if(this.readyCannoArr.indexOf(p)==-1){
// this.readyCannoArr.push(p);
// }
// }
// }
// }
// }
} // }
return this.eliminatedElements.length > 0; return this.eliminatedElements.length > 0;
...@@ -2127,14 +2135,18 @@ export default class MainScene extends Scene { ...@@ -2127,14 +2135,18 @@ export default class MainScene extends Scene {
//炮台充能发射 //炮台充能发射
var emitcanno:Element; var emitcanno:Element;
for(var p=0;p<this.cannoArr.length;p++){ if(this.readyCannoArr.length>0){
var pcanno = this.cannoArr[p].ele; var readyCannoIdx = this.readyCannoArr[0];
var pcannostat = pcanno.checkCannoStat(); emitcanno = this.cannoArr[readyCannoIdx].ele;
if(pcannostat){ }
emitcanno = pcanno; // for(var p=0;p<this.cannoArr.length;p++){
break; // var pcanno = this.cannoArr[p].ele;
} // var pcannostat = pcanno.checkCannoStat();
} // if(pcannostat){
// emitcanno = pcanno;
// break;
// }
// }
if(emitcanno){ if(emitcanno){
console.log("大炮发射"); console.log("大炮发射");
this.fireCanno(emitcanno); this.fireCanno(emitcanno);
...@@ -2321,6 +2333,8 @@ export default class MainScene extends Scene { ...@@ -2321,6 +2333,8 @@ export default class MainScene extends Scene {
} }
setTimeout(()=>{ setTimeout(()=>{
this.eliminate(); this.eliminate();
this.readyCannoArr.shift();
canno.resetCannoStat(); canno.resetCannoStat();
},200); },200);
} }
...@@ -3494,6 +3508,22 @@ export default class MainScene extends Scene { ...@@ -3494,6 +3508,22 @@ export default class MainScene extends Scene {
//置空格子的element, //置空格子的element,
this.lattices[index].element = null; this.lattices[index].element = null;
//返回下,有地方要用 //返回下,有地方要用
//炮台充能
for(var p=0;p<this.cannoArr.length;p++){
var pcannoidx = this.cannoArr[p].idx;
var isnext = Tool.checkNebByidx(pcannoidx,index);
if(isnext){
var pcannoele = this.cannoArr[p].ele;
pcannoele.addOneCannoStat();
var pcannostat = pcannoele.checkCannoStat();
if(pcannostat){
if(this.readyCannoArr.indexOf(p)==-1){
this.readyCannoArr.push(p);
}
}
}
}
return ele return ele
} }
......
...@@ -16,7 +16,7 @@ export default async (thisObj: MainScene) => { ...@@ -16,7 +16,7 @@ export default async (thisObj: MainScene) => {
const sandLattices = thisObj.lattices.filter(lattice => { const sandLattices = thisObj.lattices.filter(lattice => {
return lattice.sand; return lattice.sand;
}); });
console.log(sandLattices); // console.log(sandLattices);
//map promise //map promise
//先判断是否能跳动,目前都能跳 //先判断是否能跳动,目前都能跳
const promiseList: Promise<any>[] = []; const promiseList: Promise<any>[] = [];
......
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