mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
update
This commit is contained in:
@@ -24,6 +24,12 @@ export interface GSkillBase {
|
||||
//技能状态
|
||||
state():GSkillState;
|
||||
|
||||
//技能更新
|
||||
onUpdate(dt:number);
|
||||
|
||||
//返回进度条
|
||||
getProgress():number;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
29
JisolGameCocos/assets/script/battle/skill/GSkillAngerBase.ts
Normal file
29
JisolGameCocos/assets/script/battle/skill/GSkillAngerBase.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { TableGRoleSkill } from "../../../resources/config/ts/TableGRoleSkill";
|
||||
import GRoleBase from "../base/role/GRoleBase";
|
||||
import { GSkillBase, GSkillState } from "./GSkill";
|
||||
|
||||
|
||||
//怒气冷却
|
||||
export default abstract class GSkillAngerBase implements GSkillBase {
|
||||
|
||||
bind(role: GRoleBase<{}>, info: TableGRoleSkill): GSkillBase {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
isRelease(): boolean {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
release(): boolean {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
state(): GSkillState {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
onUpdate(dt: number) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getProgress(): number {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "e648aeed-c49c-4f10-b24f-6aef45fc14f5",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -7,33 +7,61 @@ import { GSkillBase, GSkillState } from "./GSkill";
|
||||
export default abstract class GSkillCDBase implements GSkillBase {
|
||||
|
||||
//冷却总时间
|
||||
cdTatal:number;
|
||||
cdTatal:number = 0;
|
||||
//冷却时间
|
||||
cdTime:number;
|
||||
cdTime:number = 0;
|
||||
|
||||
bind(role:GRoleBase<{}>,info: TableGRoleSkill):GSkillCDBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
//是否可以释放技能
|
||||
isRelease(): boolean {
|
||||
//冷却时间小于等于0可释放
|
||||
return this.cdTime <= 0;
|
||||
return this.cdTime >= this.cdTatal;
|
||||
}
|
||||
|
||||
//释放技能
|
||||
release():boolean {
|
||||
// //是否可以释放技能
|
||||
// if(!this.isRelease()) return false;
|
||||
//是否可以释放技能
|
||||
if(!this.isRelease()) return false;
|
||||
this.cdTime = 0;
|
||||
return this.onRelease();
|
||||
}
|
||||
|
||||
//子类实现释放
|
||||
abstract onRelease():boolean;
|
||||
|
||||
//查询状态
|
||||
state(): GSkillState {
|
||||
if(this.isRelease())
|
||||
|
||||
if(this.isReleasing()){
|
||||
return GSkillState.Releasing
|
||||
}
|
||||
|
||||
if(this.isRelease())
|
||||
return GSkillState.Releasable
|
||||
else
|
||||
return GSkillState.NoRelease
|
||||
|
||||
}
|
||||
|
||||
//是否正在释放技能
|
||||
isReleasing(): boolean{
|
||||
return false;
|
||||
}
|
||||
|
||||
//更新
|
||||
onUpdate(dt:number){
|
||||
|
||||
if(this.state() == GSkillState.NoRelease){
|
||||
this.cdTime += (dt / 1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//返回进度
|
||||
getProgress():number{
|
||||
return this.cdTime / this.cdTatal;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@ export default class GSkillCrazySquirrel extends GSkillCDBase{
|
||||
info: TableGRoleSkill;
|
||||
|
||||
bind(role:GRoleBase<{}>,info: TableGRoleSkill):GSkillCrazySquirrel {
|
||||
|
||||
//技能冷却
|
||||
this.cdTatal = parseInt(info.skillArgs[0]);
|
||||
this.role = role;
|
||||
|
Reference in New Issue
Block a user