This commit is contained in:
PC-20230316NUNE\Administrator
2023-10-30 18:53:21 +08:00
parent bb4334c0ff
commit 64ab2b0fe5
20 changed files with 544 additions and 48 deletions

View File

@@ -149,14 +149,17 @@ export default abstract class GFSMBattle extends GFSMBase{
this.player.fsmAnim.isAttack = true;
//如果有敌人则攻击 没有 则 重置
if(this.enemy){
// if(){
// //如果可以释放大招
// }else{
// //不可以则普攻
//朝向敌人
this.player.onTowardsTarget(this.enemy);
return GFSMProcessEnum.Wait;
// }
//是否可释放技能
if(this.player.isReleaseSkill()){
//则释放技能
return ProcessEnum.ReleaseSkills;
}else{
return GFSMProcessEnum.Wait;
}
}else{
return ProcessEnum.SeekEnemy;
}
@@ -165,6 +168,21 @@ export default abstract class GFSMBattle extends GFSMBase{
//释放技能
onReleaseSkillsProcess(){
//如果正在释放则等待
if(this.player.isReleasingSkill()){
return GFSMProcessEnum.Wait;
}
//释放技能
if(this.player.isReleaseSkill()){
//如果可以释放技能则释放
this.player.onReleaseSkill();
return GFSMProcessEnum.Wait;
}else{
//不可以则回到攻击
return ProcessEnum.AttackEnemy;
}
}

View File

@@ -1,5 +1,8 @@
import { sp } from "cc";
import GFSMBase, { GFSMProcessEnum, GFSMProcessInfo, GFSMProcessMode } from "../../GFSMBase";
import GRoleBase from "../../../role/GRoleBase";
import GRolePVPEntity from "../../../role/PVP/GRolePVPEntity";
import GObject from "../../../GObject";
//角色动画名称枚举
export enum GFSMBattleAminEnum {
@@ -63,7 +66,8 @@ export class GFSMBattleAmin extends GFSMBase{
this.trackIndex = trackIndex || 0;
//设置监听
this.spine.setEventListener(this.onEventListener.bind(this));
this.spine.setStartListener(this.onStartListener.bind(this));
//因为SpineBUG所以不使用Spine监听 采用自己调用
// this.spine.setStartListener(this.onStartListener.bind(this));
}
//添加事件监听
@@ -176,8 +180,9 @@ export class GFSMBattleAmin extends GFSMBase{
//播放动画
if(!info.track){
console.log("播放动画",info);
console.log(`播放动画-${this.spine.getComponent(GObject).nId}-`,info);
info.track = this.spine.setAnimation(this.trackIndex,info.animName,info.isLoop);
this.onStartListener(info.track);
}
return to;