Commit 7062d043 authored by zjz1994's avatar zjz1994

调整炮台充能

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