12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import itemDtManager from "../dataManager/itemDtManager";
- import npcHelper from "../dataManager/npcHelper";
- import { AssetsHelper } from "../framework/asset/AssetsHelper";
- import { BenzAssetManager } from "../framework/asset/BenzAssetManager";
- import Utils from "../framework/utils/utils";
- interface offSet {
- x: number;
- y: number
- }
- class effectManager {
- //播放节点上的特效
- public playEff(Node: cc.Node, childName: string, offSet?: offSet, isParticle?: boolean) {
- let effNode = Node.getChildByName(childName);
- if (isParticle) {
- effNode.getComponent(cc.ParticleSystem).resetSystem();
- } else {
- effNode.getComponent(cc.Animation).play();
- }
- if (offSet) {
- effNode.x += offSet.x;
- effNode.y += offSet.y;
- }
- }
- //开火特效
- public fireEff(Node: cc.Node, childName: string, offSet?: offSet) {
- let fireEffNode = Node.getChildByName('fire1')
- fireEffNode.getComponent(cc.Animation).play();
- }
- //近战攻击
- public closeAttack(Node: cc.Node, offSet?: offSet, isParticle?: boolean) {
- let anim = Node.getChildByName('closeAttack')
- if (isParticle) {
- anim.getComponent(cc.Animation).play();
- }
- anim.getComponent(cc.Animation).play();
- if (offSet) {
- anim.x += offSet.x;
- anim.y += offSet.y;
- }
- }
- public zombieDieEff(parent, Pos) {
- // if (cc.sys.platform == cc.sys.WECHAT_GAME) {
- // let Eff = BenzAssetManager.getInstance().getAsset(AssetsHelper.EFF_ZOMBIEDIE);
- // let Prefb = cc.instantiate(Eff);
- // Prefb.parent = parent;
- // Prefb.setPosition(Pos);
- // setTimeout(() => {
- // if (Prefb && Prefb.isValid) {
- // Prefb.destroy();
- // }
- // }, 10000);
- // }
- }
- }
- export default new effectManager();
|