mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
update 添加松鼠角色
This commit is contained in:
34
JisolGameCocos/assets/script/battle/skill/GSkill.ts
Normal file
34
JisolGameCocos/assets/script/battle/skill/GSkill.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { TableGRoleSkill } from "../../../resources/config/ts/TableGRoleSkill";
|
||||
import GRoleBase from "../base/role/GRoleBase";
|
||||
import GSkillCrazySquirrel from "./RoleSkill/GSkillCrazySquirrel";
|
||||
|
||||
//技能状态
|
||||
export enum GSkillState{
|
||||
NoRelease,//不可释放
|
||||
Releasable,//可释放
|
||||
Releasing,//释放中
|
||||
}
|
||||
|
||||
//技能基类
|
||||
export interface GSkillBase {
|
||||
|
||||
//设置
|
||||
bind(role:GRoleBase<{}>,info:TableGRoleSkill):GSkillBase;
|
||||
|
||||
//是否允许释放
|
||||
isRelease():boolean;
|
||||
|
||||
//释放技能
|
||||
release():boolean;
|
||||
|
||||
//技能状态
|
||||
state():GSkillState;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//技能方式
|
||||
export const GSkill:{[key:string]:(new () => GSkillBase)} = {
|
||||
["GSkillCrazySquirrel"]:GSkillCrazySquirrel,
|
||||
}
|
||||
|
9
JisolGameCocos/assets/script/battle/skill/GSkill.ts.meta
Normal file
9
JisolGameCocos/assets/script/battle/skill/GSkill.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "a6992aa4-aa31-41b3-aa5f-42487e417816",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
39
JisolGameCocos/assets/script/battle/skill/GSkillCDBase.ts
Normal file
39
JisolGameCocos/assets/script/battle/skill/GSkillCDBase.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { TableGRoleSkill } from "../../../resources/config/ts/TableGRoleSkill";
|
||||
import GRoleBase from "../base/role/GRoleBase";
|
||||
import { GSkillBase, GSkillState } from "./GSkill";
|
||||
|
||||
|
||||
//冷却技能基类 用于多长时间释放技能
|
||||
export default abstract class GSkillCDBase implements GSkillBase {
|
||||
|
||||
//冷却总时间
|
||||
cdTatal:number;
|
||||
//冷却时间
|
||||
cdTime:number;
|
||||
|
||||
bind(role:GRoleBase<{}>,info: TableGRoleSkill):GSkillCDBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
isRelease(): boolean {
|
||||
//冷却时间小于等于0可释放
|
||||
return this.cdTime <= 0;
|
||||
}
|
||||
|
||||
//释放技能
|
||||
release():boolean {
|
||||
// //是否可以释放技能
|
||||
// if(!this.isRelease()) return false;
|
||||
return this.onRelease();
|
||||
}
|
||||
|
||||
//子类实现释放
|
||||
abstract onRelease():boolean;
|
||||
|
||||
state(): GSkillState {
|
||||
if(this.isRelease())
|
||||
return GSkillState.Releasing
|
||||
else
|
||||
return GSkillState.NoRelease
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "0f31e7c8-c018-4c3d-ab0c-ad0c759e4eb1",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
9
JisolGameCocos/assets/script/battle/skill/RoleSkill.meta
Normal file
9
JisolGameCocos/assets/script/battle/skill/RoleSkill.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "74dac201-dfda-47ca-b0b1-414c217fa163",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -0,0 +1,76 @@
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "7d3fd1cc-d849-4139-8926-689129416a29",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
Reference in New Issue
Block a user