BlcokSkillFireworkView.ts
2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { BlockSkill } from "../kernel/battle/BattleConst";
import { BlcokSkillViewBase } from "./BlockSkillViewBase";
export class BlockSkillFireworkView extends BlcokSkillViewBase {
onDead(): void {
super.onDead();
//播放特效
if (this._owner.owner.skill.skillId == BlockSkill.FIREWORK_VERTICAL || this._owner.owner.skill.skillId == BlockSkill.FIREWORK_DOUBLE) {
let startPixel = this._owner.owner.map.getPixelPosByGridPos(this._owner.owner.gridPos);
let upEffect = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework'));
upEffect.setPosition(startPixel.x, startPixel.y + 2);
upEffect.active = true;
let downEffect = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework'));
downEffect.setPosition(startPixel.x, startPixel.y - 2);
downEffect.angle = 180;
downEffect.active = true;
this._mapView.effectLayer.addChild(upEffect);
this._mapView.effectLayer.addChild(downEffect);
upEffect.getComponent(sp.Skeleton).setCompleteListener(() => {
upEffect.destroy();
});
upEffect.getComponent(sp.Skeleton).setAnimation(0, 'animation', false);
downEffect.getComponent(sp.Skeleton).setCompleteListener(() => {
downEffect.destroy();
});
downEffect.getComponent(sp.Skeleton).setAnimation(0, 'animation', false);
}
if (this._owner.owner.skill.skillId == BlockSkill.FIREWORK_HORIZON || this._owner.owner.skill.skillId == BlockSkill.FIREWORK_DOUBLE) {
let startPixel = this._owner.owner.map.getPixelPosByGridPos(this._owner.owner.gridPos);
let leftEffect = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework'));
leftEffect.setPosition(startPixel.x + 2, startPixel.y);
leftEffect.angle = 270;
leftEffect.active = true;
let rightEffect = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework'));
rightEffect.setPosition(startPixel.x - 2, startPixel.y);;
rightEffect.angle = 90;
rightEffect.active = true;
this._mapView.effectLayer.addChild(leftEffect);
this._mapView.effectLayer.addChild(rightEffect);
leftEffect.getComponent(sp.Skeleton).setCompleteListener(() => {
leftEffect.destroy();
});
leftEffect.getComponent(sp.Skeleton).setAnimation(0, 'animation', false);
rightEffect.getComponent(sp.Skeleton).setCompleteListener(() => {
rightEffect.destroy();
});
rightEffect.getComponent(sp.Skeleton).setAnimation(0, 'animation', false);
}
}
}