mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-11-07 23:06:03 +00:00
update
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { _decorator, sp } from "cc";
|
||||
import { JNGSyncProtoBase } from "../../../App";
|
||||
import GObject from "../GObject";
|
||||
import { BehaviorStatus } from "../../../../../extensions/Behavior Creator/runtime/main";
|
||||
import { JNFrameInfo } from "../../../../../extensions/ngame/assets/ngame/sync/frame/JNSyncFrame";
|
||||
import GFSMBase from "../fsm/GFSMBase";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//角色基类
|
||||
@@ -10,17 +10,28 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
@property(sp.Skeleton)
|
||||
spine:sp.Skeleton;
|
||||
|
||||
onLoad(){
|
||||
super.onLoad();
|
||||
if(!this.spine) this.spine = this.node.getComponent(sp.Skeleton);
|
||||
//状态机
|
||||
fsm:GFSMBase;
|
||||
|
||||
onLoad(){
|
||||
if(!this.spine) this.spine = this.node.getComponent(sp.Skeleton);
|
||||
//如果没有生成则直接销毁
|
||||
this.node.removeFromParent();
|
||||
if(!this.spine) {
|
||||
this.node.removeFromParent();
|
||||
return;
|
||||
}
|
||||
|
||||
//创建角色状态机
|
||||
this.fsm = this.fsmCreate();
|
||||
|
||||
}
|
||||
|
||||
//攻击
|
||||
public onAttack(data){
|
||||
return BehaviorStatus.Success;
|
||||
//创建一个状态机
|
||||
protected abstract fsmCreate():GFSMBase;
|
||||
|
||||
onSyncUpdate(dt: number,frame:JNFrameInfo, input?: T){
|
||||
//更新状态机
|
||||
this.fsm.onUpdate(dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user