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 {
...
@@ -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
}
}
...
...
egret/src/mainScene/doSandAI.ts
View file @
7062d043
...
@@ -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
>
[]
=
[];
...
...
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