Commit 73a07ec1 authored by wildfirecode's avatar wildfirecode

1

parent 8ecb8e51
......@@ -93,10 +93,10 @@ import { createData } from '../startScene/StartScene';
import Utils from '../Utils';
import { DataManager } from './../../libs/tw/manager/DataManager';
import { NetManager } from './../../libs/tw/manager/NetManager';
import doFishAI from './doFishAI';
import doHoneyPotAI from './doHoneyPotAI';
import doMonsterAI from './doMonsterAI';
import jellyMonsterAI from './jellyMonsterAI';
import doFishAI from './doFishAI';
import HoneyPotElement from '../something/class/HoneyPotElement';
const aniClass = {
"BoomAni": BoomAni,
......@@ -762,7 +762,7 @@ export default class MainScene extends Scene {
monster.resetMonster();
break;
case ElementConfigType.HONEY_POT:
let honeyPot:Element = Tool.getElement(ElementType.HONEY_POT);
let honeyPot: Element = Tool.getElement(ElementType.HONEY_POT);
honeyPot.x = p[0];
honeyPot.y = p[1];
this.elementContainer.addChild(honeyPot);
......@@ -2000,6 +2000,14 @@ export default class MainScene extends Scene {
this.eliminate();
return
}
const doHoneyPotAIResult = await doHoneyPotAI(this);
if (doHoneyPotAIResult.length > 0) {//如果有激活的罐子被消除,那么表示可以自动消除,则不需要进行下一步
doHoneyPotAIResult.forEach((index) => {
this.eliminatedElements.push(index);
});
this.eliminate();
return;
};
const doFishResult = await doFishAI(this);
if (doFishResult.length > 0) {
//这里应该先播放动画,播放完了,再执行消除
......@@ -2512,6 +2520,14 @@ export default class MainScene extends Scene {
//鸡蛋动效
this.playAni(RecoverName.EGGBROKEN_ANI, p)
}
else if (ele.type == ElementType.HONEY_POT) {//蜂蜜罐子
if (ele.canElimite) {
this.recoverEle(index);
this.playAni(RecoverName.ELEDIS_ANI, p)
}
else
ele.onElimiate();
}
//大红包
else if (ele.type == ElementType.FESTIVALELE_BIG) {
//动画也在放这里
......@@ -3127,6 +3143,9 @@ export default class MainScene extends Scene {
this.checkNebEle(latttice, (lat) => {
return lat && lat.element && lat.element.type == ElementType.ROCK
});
this.checkNebEle(latttice, (lat) => {
return lat && lat.element && lat.element.type == ElementType.HONEY_POT
});
//如果附近有果冻
this.checkNebEle(latttice, (lat) => {
return lat && lat.element && lat.element.type == ElementType.JELLY
......
import { ElementType } from "../something/enum/ElementType";
import MainScene from "./MainScene";
/**
* 罐子爆炸
*/
export default async (thisObj: MainScene) => {
//先找出所有激活的罐子
const activeElementIndexs: number[] = [];
for (var i = 0; i < thisObj.lattices.length; i++) {
const lattice = thisObj.lattices[i]
if (lattice && lattice.element && lattice.element.type==ElementType.HONEY_POT && lattice.element.isActive) {
activeElementIndexs.push(i);
lattice.element.canElimite = true;
}
}
console.log('激活的罐子', activeElementIndexs)
return activeElementIndexs
}
\ No newline at end of file
......@@ -79,7 +79,7 @@ export default async (thisObj: MainScene) => {
activeMosterEles[index].monster.resetStatus();
}
console.log('激活的怪物数据', foundsResult);
// console.log('激活的怪物数据', foundsResult);
//禁用所有的怪物,再开始播放怪物释放技能的动画,完了再播放怪物睡眠、苏醒的动画,再重新启用怪物
return genarateEffect; //如果有苏醒的怪物
}
\ No newline at end of file
......@@ -668,4 +668,7 @@ export class Element extends eui.Component {
}
get candy() { return this._candy }
resetView(){}
onElimiate(){}
get isActive() { return false }
canElimite:boolean;
}
\ No newline at end of file
......@@ -11,32 +11,18 @@ const frames = [
export class HoneyPot extends eui.Component {
async nextStatus() {
this._statusNum++;
if (this._statusNum > 4) {
this._statusNum = 4;
if (this._statusNum >= 3) {
this.removeEvents();
}
//播放动画,动画时间要短200ms以内
if (this._statusNum <= 3) {
if (this._statusNum <= 2) {
createMonsterStatusAni(this.x, this.y, this.parent);
this.changeSource();
}
}
hide() {
this._mv.scaleX = this._mv.scaleY = 0;
}
resetStatus() {
this.addEvents();
this._statusNum = 0;
this._mv.gotoAndPlay(1);
egret.Tween.get(this._mv).to({ scaleY: 1, scaleX: 1 }, 500, egret.Ease.backOut).call(() => {
this.changeSource();
})
}
get active(): boolean {
return this._statusNum == 4;
get isActive(): boolean {
return this._statusNum >= 3;
}
/**
......
import { Element } from "./Element";
import { ElementType } from "../enum/ElementType";
import { Monster } from "./Monster";
import { Element } from "./Element";
import { HoneyPot } from "./HoneyPot";
export default class HoneyPotElement extends Element {
honeyPot:HoneyPot;
resetView(){
const type = ElementType.HONEY_POT;
honeyPot: HoneyPot;
resetView() {
this.honeyPot = new HoneyPot();
this.addChild(this.honeyPot);
this.showImage.alpha = 0;
}
onElimiate() {
this.honeyPot.nextStatus();
}
get isActive() {
return this.honeyPot.isActive
}
reset(type: ElementType) {
super.reset(type);
if (this.honeyPot) {
this.removeChild(this.honeyPot);
this.honeyPot.removeEvents();
this.honeyPot = null;
}
}
}
\ 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