重构继承关系

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-11-01 02:01:35 +08:00
parent e59c5640d7
commit 6ebed0b45e
43 changed files with 496 additions and 524 deletions

View File

@@ -1,13 +1,15 @@
import { TableGRole } from "../../../resources/config/ts/TableGRole";
import { GFSMAnimBase } from "../base/fsm/GFSMAnimBase";
import GFSMBase from "../base/fsm/GFSMBase";
import GRoleBase from "../base/role/GRoleBase";
//角色工具类
export class GRoleUtil{
//获取存活的玩家 如果不存活则返回 null
static get<T>(player:GRoleBase<T>):() => GRoleBase<T>{
static get<T extends GRoleBase<{}>>(player:T):() => T{
if(!player) return null;
return ():GRoleBase<T> => {
return ():T => {
if(player)
return player.get();
return null;

View File

@@ -9,6 +9,9 @@ export class GTactical{
//阵容朝向
towards:GTowards;
//位置偏差
offset:Vec2;
//阵法位置
static pos:Vec2[][] = [
@@ -17,9 +20,15 @@ export class GTactical{
[v2(-100,-150),v2(0,-150),v2(100,-150)],
];
constructor(tactical:number[][],towards:GTowards = GTowards.RIGHT){
constructor(tactical:number[][],towards:GTowards = GTowards.RIGHT,offset:Vec2 = Vec2.ZERO){
this.tactical = tactical;
this.towards = towards;
this.offset = offset;
}
setOffset(offset:Vec2):this{
this.offset = offset;
return this;
}
//获取阵法
@@ -69,7 +78,7 @@ export class GTactical{
}
//返回阵法位置
getPosition(index:number,father:Vec2 = v2(0,0)){
getPosition(index:number,father:Vec2 = this.offset){
let pos;
if(pos = this.getXY(index)){