58 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-10-30 18:53:21 +08:00
import { TableGRoleSkill } from "../../../resources/config/ts/TableGRoleSkill";
import GRoleBase from "../base/role/GRoleBase";
2023-11-01 02:01:35 +08:00
import GRoleDefault from "../base/role/GRoleDefault";
2023-10-30 18:53:21 +08:00
import { GSkillBase, GSkillState } from "./GSkill";
//怒气冷却
export default abstract class GSkillAngerBase implements GSkillBase {
2023-10-31 01:52:46 +08:00
//怒气值
anger:number = 0;
//怒气最大值
angerMax:number = 0;
2023-11-01 02:01:35 +08:00
bind(role: GRoleDefault, info: TableGRoleSkill): GSkillBase {
2023-10-30 18:53:21 +08:00
throw new Error("Method not implemented.");
}
isRelease(): boolean {
2023-10-31 01:52:46 +08:00
return this.anger >= this.angerMax;
2023-10-30 18:53:21 +08:00
}
release(): boolean {
2023-10-31 01:52:46 +08:00
//是否可以释放技能
if(!this.isRelease()) return false;
this.anger = 0;
return this.onRelease();
}
//子类实现释放
abstract onRelease():boolean;
//是否正在释放技能
isReleasing(): boolean{
return false;
2023-10-30 18:53:21 +08:00
}
2023-10-31 01:52:46 +08:00
2023-10-30 18:53:21 +08:00
state(): GSkillState {
2023-10-31 01:52:46 +08:00
if(this.isReleasing()){
return GSkillState.Releasing
}
if(this.isRelease())
return GSkillState.Releasable
else
return GSkillState.NoRelease
2023-10-30 18:53:21 +08:00
}
onUpdate(dt: number) {
}
2023-10-31 01:52:46 +08:00
//返回进度条
2023-10-30 18:53:21 +08:00
getProgress(): number {
2023-10-31 01:52:46 +08:00
return this.anger / this.angerMax;
2023-10-30 18:53:21 +08:00
}
}