12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import BObject from "../../../bullet/BObject";
- import FSprite, { SpriteActionType } from "../../FSprite";
- import SkillShotgun from "../SkillShotgun";
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class MShotgun extends SkillShotgun {
- onLoad () {
- this.sprite = this.node.getComponent(FSprite);
- }
-
- public exe(target:FSprite,callback:()=>void){
- this.time = new Date().getTime();
-
-
-
- let bNode = cc.instantiate(this.mBullet)
- let bobject = bNode.getComponent(BObject)
- let sf = bobject.mStartEffect
- let x = this.sprite.mAtkSite.worldX * this.sprite.spine.node.scaleX
- let y = this.sprite.mAtkSite.worldY
- let pos = cc.v2(x, y);
- let sfNode = cc.instantiate(sf)
- sfNode.angle = this.sprite.wAngle
- sfNode.setPosition(pos);
- sfNode.parent = this.sprite.node
- let startSpine: sp.Skeleton = sfNode.getComponent(sp.Skeleton)
- startSpine.setCompleteListener(() => {
- startSpine.setCompleteListener(null);
- sfNode.destroy()
- if(callback){
- callback()
- }
- });
- startSpine.setAnimation(0, 'atk', false);
-
-
-
-
-
-
-
-
- let tp = undefined
- if(target){
- tp = target.node.getPosition();
- tp.y += target.node.height/2
- }else{
-
-
- let y = this.sprite.moveV2.y * 300 + this.node.y
- let x = this.sprite.moveV2.x * 300 + this.node.x;
- tp = cc.v2(x,y + 40)
- }
- for (let i = 0; i < this.count; i++) {
- this.fire(i,tp);
- }
- }
- }
|