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
55f9b5dd
Commit
55f9b5dd
authored
Mar 09, 2020
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
975c9ba7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
70 deletions
+3
-70
doConveyorAI.ts
egret/src/mainScene/doConveyorAI.ts
+3
-70
No files found.
egret/src/mainScene/doConveyorAI.ts
View file @
55f9b5dd
...
...
@@ -12,74 +12,7 @@ import { createMonsterStatusAni } from "../effect/createMonsterStatusAni";
* 独眼怪爆炸
*/
export
default
async
(
thisObj
:
MainScene
)
=>
{
//先找出所有激活的怪物
const
awakeMonsterIndexs
:
number
[]
=
[];
for
(
var
i
=
0
;
i
<
thisObj
.
lattices
.
length
;
i
++
)
{
const
lattice
=
thisObj
.
lattices
[
i
]
if
(
lattice
&&
lattice
.
element
&&
lattice
.
element
.
monster
&&
lattice
.
element
.
monster
.
active
)
{
if
(
!
lattice
.
element
.
hasState
(
StateType
.
BLOCK_LOCK
))
awakeMonsterIndexs
.
push
(
i
);
}
}
//遍历所有基础元素
const
baseElements
:
Element
[]
=
[];
for
(
var
i
=
Tool
.
colNum
*
Tool
.
rowNum
-
1
;
i
>=
0
;
i
--
)
{
var
lat
=
thisObj
.
lattices
[
i
];
if
(
Tool
.
judgeBaseEle
(
lat
)
&&
!
lat
.
element
.
monster
&&
!
lat
.
element
.
candy
&&
!
lat
.
element
.
effectType
)
{
baseElements
.
push
(
lat
.
element
);
}
}
baseElements
.
sort
(
function
()
{
//打乱数组
return
(
0.5
-
Math
.
random
());
});
let
genarateEffect
:
Element
[]
=
[];
//生成的特效的列表
const
activeMosterEles
:
Element
[]
=
awakeMonsterIndexs
.
map
(
i
=>
thisObj
.
lattices
[
i
].
element
);
const
foundsResult
:
Element
[][]
=
[];
//遍历激活的怪物
for
(
let
index
=
0
;
index
<
activeMosterEles
.
length
;
index
++
)
{
const
monsterEle
=
activeMosterEles
[
index
];
//找到相同颜色的元素
let
founds
=
baseElements
.
filter
(
ele
=>
ele
.
type
==
monsterEle
.
type
&&
genarateEffect
.
indexOf
(
ele
)
==
-
1
);
founds
=
founds
.
slice
(
0
,
3
);
genarateEffect
=
genarateEffect
.
concat
(
founds
);
foundsResult
[
index
]
=
founds
;
}
const
playEffect
=
async
(
index
)
=>
{
const
monsterEle
=
activeMosterEles
[
index
];
//找到相同颜色的元素
let
founds
=
foundsResult
[
index
];
await
createMonsterStatusAni
(
monsterEle
.
x
,
monsterEle
.
y
,
thisObj
);
monsterEle
.
monster
.
hide
();
founds
.
forEach
((
ele
)
=>
{
let
bonusShootAni
:
MonsterShootAni
=
Pool
.
takeOut
(
RecoverName
.
MONSTER_SHOOT_ANI
);
if
(
!
bonusShootAni
)
bonusShootAni
=
new
MonsterShootAni
();
var
r
=
Tool
.
getForwardRotation
([
monsterEle
.
x
,
monsterEle
.
y
],
[
ele
.
x
,
ele
.
y
])
bonusShootAni
.
play
(
r
*
180
/
Math
.
PI
,
[
monsterEle
.
x
,
monsterEle
.
y
],
[
ele
.
x
,
ele
.
y
],
()
=>
{
});
thisObj
.
addChild
(
bonusShootAni
);
});
};
for
(
let
index
=
0
;
index
<
activeMosterEles
.
length
;
index
++
)
{
playEffect
(
index
);
}
if
(
genarateEffect
.
length
>
0
)
await
wait
(
monstShootAniDur
+
300
);
for
(
let
index
=
0
;
index
<
foundsResult
.
length
;
index
++
)
{
const
founds
=
foundsResult
[
index
];
founds
.
forEach
(
ele
=>
{
ele
.
effectType
=
Math
.
random
()
>
0.5
?
EffectType
.
HORIZONTAL
:
EffectType
.
VERTICAL
;
});
activeMosterEles
[
index
].
monster
.
resetStatus
();
}
// console.log('激活的怪物数据', foundsResult);
//禁用所有的怪物,再开始播放怪物释放技能的动画,完了再播放怪物睡眠、苏醒的动画,再重新启用怪物
return
genarateEffect
;
//如果有苏醒的怪物
//移动了传送带之后,可能会有可消除的,需要检查消除
//移动的动画,如果是两头的需要一个带遮罩的动画
//检查与其他元素的兼容性
}
\ No newline at end of file
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