Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wildfirecode13
xiaoxiaole
Commits
7062d043
Commit
7062d043
authored
Mar 26, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整炮台充能
parent
80ec99ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
23 deletions
+53
-23
MainScene.ts
egret/src/mainScene/MainScene.ts
+52
-22
doSandAI.ts
egret/src/mainScene/doSandAI.ts
+1
-1
No files found.
egret/src/mainScene/MainScene.ts
View file @
7062d043
...
...
@@ -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
}
...
...
egret/src/mainScene/doSandAI.ts
View file @
7062d043
...
...
@@ -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
>
[]
=
[];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment