mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
77 lines
2.5 KiB
TypeScript
77 lines
2.5 KiB
TypeScript
|
import { v2 } from "cc";
|
||
|
import { JTween } from "../../../../../extensions/ngame/assets/ngame/sync/frame/game/tween/JNFrameTween";
|
||
|
import { TableGRoleSkill } from "../../../../resources/config/ts/TableGRoleSkill";
|
||
|
import { app } from "../../../App";
|
||
|
import GSpine from "../../base/common/GSpine";
|
||
|
import GRoleBase from "../../base/role/GRoleBase";
|
||
|
import GSkillCDBase from "../GSkillCDBase";
|
||
|
import { v3 } from "cc";
|
||
|
import GBaseMode from "../../GBaseMode";
|
||
|
import GDetection from "../../base/common/GDetection";
|
||
|
import { rect } from "cc";
|
||
|
|
||
|
/**
|
||
|
* 疯狂松鼠技能
|
||
|
* 参数:[技能冷却]
|
||
|
*/
|
||
|
export default class GSkillCrazySquirrel extends GSkillCDBase{
|
||
|
|
||
|
role:GRoleBase<{}>;
|
||
|
info: TableGRoleSkill;
|
||
|
|
||
|
bind(role:GRoleBase<{}>,info: TableGRoleSkill):GSkillCrazySquirrel {
|
||
|
|
||
|
//技能冷却
|
||
|
this.cdTatal = parseInt(info.skillArgs[0]);
|
||
|
this.role = role;
|
||
|
this.info = info;
|
||
|
return this;
|
||
|
|
||
|
}
|
||
|
|
||
|
onRelease(): boolean {
|
||
|
|
||
|
//获取敌人位置
|
||
|
let enemy = this.role.fsm.enemy;
|
||
|
let scene:GBaseMode<{}> = this.role.mode;
|
||
|
if(!enemy) return false;
|
||
|
|
||
|
let aw = parseInt(this.info.skillArgs[1]);
|
||
|
let ah = parseInt(this.info.skillArgs[2]);
|
||
|
|
||
|
//出现松鼠丢炸弹
|
||
|
GSpine.onPlayAnotherSpine(this.role,app.role.effects[50001],"skill",{
|
||
|
end:() => {
|
||
|
//从天而降
|
||
|
let pos = enemy.v2World.add(v2(0,1000));
|
||
|
let end = enemy.v2World;
|
||
|
|
||
|
//生成火球
|
||
|
let spine = GSpine.onCreateSpine(app.role.effects[50002]);
|
||
|
this.role.mode.addGNode(spine.node,pos);
|
||
|
spine.setAnimation(0,"animation",true);
|
||
|
spine.node.angle = 90;
|
||
|
JTween(pos)
|
||
|
.to(end,600)
|
||
|
.onUpdate(pos => {
|
||
|
spine.node.worldPosition = v3(pos.x,pos.y,0);
|
||
|
})
|
||
|
.onComplete(() => {
|
||
|
let world = spine.node.worldPosition;
|
||
|
spine.node.destroy();
|
||
|
GSpine.onPlaySceneSpine(scene,v2(world.x,world.y),app.role.effects[50003],"animation");
|
||
|
console.log(GDetection.testAABBRole(rect(world.x,world.y,aw,ah)).length)
|
||
|
GDetection.testAABBRole(rect(world.x,world.y,aw,ah)).forEach(role =>{
|
||
|
role.onHit();
|
||
|
});
|
||
|
})
|
||
|
.start();
|
||
|
}
|
||
|
});
|
||
|
return true;
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|