mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "b2af28db-e925-419f-81b8-3bf755a3224f",
|
||||
"uuid": "34152d1b-ca03-4bb1-a970-692cd8995991",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
@@ -0,0 +1,33 @@
|
||||
import { _decorator } from "cc";
|
||||
import GRoleBase from "../GRoleBase";
|
||||
import GFSMBase from "../../fsm/GFSMBase";
|
||||
import GFSMPVP from "../../fsm/PVP/GFSMPVP";
|
||||
import GPVPMode, { GPVPModePlayerEnum } from "../../../PVP/GPVPMode";
|
||||
import { GTactical } from "../../../entity/GTactical";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//PVP 角色
|
||||
@ccclass('GRolePVPEntity')
|
||||
export default class GRolePVPEntity extends GRoleBase<{}>{
|
||||
|
||||
//所属阵容
|
||||
ones:GPVPModePlayerEnum;
|
||||
|
||||
//在阵容中的下标
|
||||
tacticalIndex:number;
|
||||
tactical:GTactical;
|
||||
|
||||
|
||||
get mode():GPVPMode{
|
||||
return super.mode as GPVPMode;
|
||||
}
|
||||
set mode(value:GPVPMode){
|
||||
this._mode = value;
|
||||
}
|
||||
|
||||
protected fsmCreate(): GFSMBase {
|
||||
return new GFSMPVP(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "c6d20914-49fe-45ea-9bf2-750de7cc7ed2",
|
||||
"uuid": "9fc034a7-5c68-4f22-9065-447435329c8a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
@@ -1,16 +0,0 @@
|
||||
import { _decorator } from "cc";
|
||||
import GRoleBase from "../GRoleBase";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
* 基础实现
|
||||
*/
|
||||
@ccclass('GRoleEntity')
|
||||
export default class GRoleEntity extends GRoleBase<{}> {
|
||||
|
||||
onLoad(){
|
||||
super.onLoad();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user