mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
重构继承关系
This commit is contained in:
@@ -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;
|
||||
|
@@ -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)){
|
||||
|
Reference in New Issue
Block a user