Commit 55f9b5dd authored by wildfirecode's avatar wildfirecode

1

parent 975c9ba7
......@@ -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
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