mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 18:26:23 +00:00
update
This commit is contained in:
@@ -1 +0,0 @@
|
||||
{"root":{"type":"sequence","config":{"type":"sequence","label":{"tag":"2RY6J1","events":{},"title":"Sequence","group":"composite","name":"Sequence","uuid":"7c895CfOwBCgKYk2gJEdRCX","properties":{},"order":0}},"elements":[],"children":[{"type":"task","config":{"type":"task","label":{"tag":"2RYGFD","events":{"onUpdate":{"node":{"name":"","path":"/"},"component":{"uuid":"c6d20kUSf5F6pvydQ3nzH7S","name":"GRoleEntity"},"method":"onAttack"}},"title":"Task","group":"task","name":"Task","uuid":"917dc/B4bBArq1QrBFaQ6gk","properties":{},"order":1}},"elements":[],"children":[]}]},"refs":[],"blackboard":{"variables":[],"globals":[]},"runtime":"oreo-behavior-creator","version":"1.1.2","uuid":"f9vbt2pPFGiKlXSDAA8M7p"}
|
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"ver": "2.0.1",
|
||||
"importer": "json",
|
||||
"imported": true,
|
||||
"uuid": "4671c524-65e7-4bc8-9ab7-c8bd12241ac5",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -28,19 +28,10 @@
|
||||
},
|
||||
{
|
||||
"__id__": 6
|
||||
},
|
||||
{
|
||||
"__id__": 8
|
||||
},
|
||||
{
|
||||
"__id__": 10
|
||||
},
|
||||
{
|
||||
"__id__": 12
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 14
|
||||
"__id__": 8
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
@@ -99,98 +90,6 @@
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "39OM3yMTpFCaO9LSQd5hDg"
|
||||
},
|
||||
{
|
||||
"__type__": "57329UxP9VOAa8MciTPhIOm",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "9eXqyjhtpIi6L9GHkov+SV"
|
||||
},
|
||||
{
|
||||
"__type__": "0047b40TAlFJaaH5Cj5qbAP",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 7
|
||||
},
|
||||
"logAbort": true,
|
||||
"logInterrupt": true,
|
||||
"logExecute": true,
|
||||
"logUpdate": false,
|
||||
"logLoad": false,
|
||||
"logDestroy": false,
|
||||
"logEnter": false,
|
||||
"logExit": false,
|
||||
"logEnable": false,
|
||||
"logDisable": false,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "3cStgN8ClNbqN5vzrKZiig"
|
||||
},
|
||||
{
|
||||
"__type__": "e021fzRX91CZbfisWd9maoE",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 9
|
||||
},
|
||||
"jsonAsset": {
|
||||
"__uuid__": "4671c524-65e7-4bc8-9ab7-c8bd12241ac5",
|
||||
"__expectedType__": "cc.JsonAsset"
|
||||
},
|
||||
"frameRate": 0,
|
||||
"startWhenEnabled": true,
|
||||
"pauseWhenDisabled": false,
|
||||
"restartWhenComplete": true,
|
||||
"resetValuesOnRestart": false,
|
||||
"logTaskChanges": false,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "23a+R8DsZOhL6GPkduwyym"
|
||||
},
|
||||
{
|
||||
"__type__": "c6d20kUSf5F6pvydQ3nzH7S",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 11
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "524mvbh2pCoKfgznMFaCs4"
|
||||
},
|
||||
{
|
||||
"__type__": "7bbd2ZLN+pAR5d5W2wmy3A0",
|
||||
"_name": "",
|
||||
@@ -201,7 +100,7 @@
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 13
|
||||
"__id__": 5
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
@@ -237,6 +136,24 @@
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "27Fx6O7FRLnbRD+LXrrqfA"
|
||||
},
|
||||
{
|
||||
"__type__": "9fc03SnXGhPIpBlRHQ1MpyK",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 7
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "89OuR1/75BxLrKGMeVKN5C"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
|
@@ -23,25 +23,13 @@ class JNGLayer extends JNLayer{
|
||||
//重写Socket
|
||||
class JNGSocket extends JNSocket{
|
||||
public url() {
|
||||
return "ws://192.168.0.127:8080/websocket";
|
||||
return "ws://localhost:8080/websocket";
|
||||
}
|
||||
}
|
||||
|
||||
// 重写帧同步
|
||||
class JNGSyncFrame extends JNSyncFrame{
|
||||
|
||||
//更新
|
||||
protected onUpdate(): JNFrameInfo {
|
||||
let info = super.onUpdate();
|
||||
|
||||
if(info){
|
||||
//更新状态机
|
||||
BehaviorManager.getInstance().tick(this.dt);
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
protected onResetValue(){
|
||||
//重置状态机
|
||||
BehaviorManager.deleteInstance();
|
||||
@@ -106,7 +94,7 @@ export const app = {
|
||||
event : EventDispatcher.getIns(), //通知
|
||||
proto : NGameMessage.getIns(), //消息
|
||||
api : axios.create({
|
||||
baseURL: "http://192.168.0.127:8080",
|
||||
baseURL: "http://localhost:8080",
|
||||
}), //请求
|
||||
battle : GBattleModeManager.getIns(), //战斗
|
||||
}
|
@@ -7,6 +7,7 @@ export default class GBaseMode extends GObject<{}> {
|
||||
|
||||
//添加对象到场景中
|
||||
addGObject(obj: GObject<{}>,pos?:Vec2){
|
||||
obj.mode = this;
|
||||
this.node.addChild(obj.node);
|
||||
if(pos){
|
||||
obj.node.setWorldPosition(v3(pos.x,pos.y,0));
|
||||
|
@@ -2,9 +2,9 @@ import { _decorator } from "cc";
|
||||
import GBaseMode from "../GBaseMode";
|
||||
import { GTactical } from "../entity/GTactical";
|
||||
import { Prefab } from "cc";
|
||||
import GRoleEntity from "../base/role/impl/GRoleEntity";
|
||||
import { instantiate } from "cc";
|
||||
import { Vec2 } from "cc";
|
||||
import GRolePVPEntity from "../base/role/PVP/GRolePVPEntity";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ export default class GPVPMode extends GBaseMode{
|
||||
enemyInfo: GPVPModePlayerInfo = { tactical: GTactical.getTactical2(true),roles: [{},{},{}] };
|
||||
|
||||
//玩家宠物
|
||||
playerRoles: GRoleEntity[] = [];
|
||||
playerRoles: GRolePVPEntity[] = [];
|
||||
//敌方宠物
|
||||
enemyRoles: GRoleEntity[] = [];
|
||||
enemyRoles: GRolePVPEntity[] = [];
|
||||
|
||||
//玩家位置
|
||||
playerPos: Vec2 = new Vec2(-400,0);
|
||||
@@ -65,8 +65,13 @@ export default class GPVPMode extends GBaseMode{
|
||||
let pos:Vec2 = this.getInfo(type).tactical.getPosition(index);
|
||||
if(!pos) return;
|
||||
let role = instantiate(this.rolePrefab);
|
||||
let entity = role.getComponent(GRoleEntity)
|
||||
let entity = role.getComponent(GRolePVPEntity)
|
||||
//赋值阵容
|
||||
entity.ones = type;
|
||||
entity.tactical = this.getInfo(type).tactical;
|
||||
entity.tacticalIndex = index;
|
||||
this.addGObject(entity,this.getInfo(type).tactical.getPosition(index,this.getTacticalPos(type)));
|
||||
this.getOnesRole(type).push(entity);
|
||||
|
||||
}
|
||||
|
||||
@@ -81,6 +86,39 @@ export default class GPVPMode extends GBaseMode{
|
||||
if(type == GPVPModePlayerEnum.PLAYER) return this.playerPos;
|
||||
if(type == GPVPModePlayerEnum.ENEMY) return this.enemyPos;
|
||||
}
|
||||
|
||||
//获取阵营角色
|
||||
getOnesRole(type: GPVPModePlayerEnum):GRolePVPEntity[]{
|
||||
if(type == GPVPModePlayerEnum.PLAYER) return this.playerRoles;
|
||||
if(type == GPVPModePlayerEnum.ENEMY) return this.enemyRoles;
|
||||
}
|
||||
|
||||
//获取敌人
|
||||
getEnumy(player:GRolePVPEntity):GRolePVPEntity{
|
||||
|
||||
let enumyOnes = GPVPModePlayerEnum.ENEMY
|
||||
//如果是ENEMY 则 它的敌人是 PLAYER
|
||||
if(player.ones == GPVPModePlayerEnum.ENEMY) enumyOnes = GPVPModePlayerEnum.PLAYER
|
||||
|
||||
//获取敌人
|
||||
let roles = this.getOnesRole(enumyOnes);
|
||||
|
||||
//返回敌人
|
||||
//获取我在第几排
|
||||
let playerXY = player.tactical.getXY(player.tacticalIndex);
|
||||
//通过排数获取最近的敌人
|
||||
let sort = roles.sort((enumy1,enumy2) => {
|
||||
let enumy1XY = enumy1.tactical.getXY(enumy1.tacticalIndex);
|
||||
let enumy2XY = enumy2.tactical.getXY(enumy2.tacticalIndex);
|
||||
return Math.abs((playerXY.y * 1000) - (enumy1XY.y * 1000)) + Math.abs((playerXY.x - enumy1XY.x)) -
|
||||
Math.abs((playerXY.y * 1000) - (enumy2XY.y * 1000)) + Math.abs((playerXY.x - enumy2XY.x))
|
||||
});
|
||||
console.log(playerXY,sort[0].tactical.getXY(sort[0].tacticalIndex),);
|
||||
return sort[0]
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,18 @@
|
||||
import { JNGSyncProtoBase } from "../../App";
|
||||
import GBaseMode from "../GBaseMode";
|
||||
|
||||
|
||||
export default class GObject<T> extends JNGSyncProtoBase<T>{
|
||||
|
||||
|
||||
//当前模式
|
||||
_mode:GBaseMode;
|
||||
|
||||
get mode():GBaseMode{
|
||||
return this._mode;
|
||||
}
|
||||
set mode(value:GBaseMode){
|
||||
this._mode = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,86 @@
|
||||
|
||||
//流程模式
|
||||
export enum GFSMProcessMode{
|
||||
Execute,//正常运行
|
||||
WaitExecute,//等待执行
|
||||
}
|
||||
|
||||
//流程信息
|
||||
export interface GFSMProcessInfo{
|
||||
//备注
|
||||
title:string;
|
||||
//模式
|
||||
mode?:GFSMProcessMode;
|
||||
//执行方法
|
||||
execute?:() => number;
|
||||
//前往
|
||||
to?:number[];
|
||||
}
|
||||
|
||||
//状态机基类
|
||||
export default abstract class GFSMBase{
|
||||
export default class GFSMBase{
|
||||
|
||||
//状态流程图
|
||||
process:{[key:number]:GFSMProcessInfo} = {};
|
||||
|
||||
//开始流程Id
|
||||
start:number = 0;
|
||||
|
||||
//当前流程
|
||||
current:number = 0;
|
||||
|
||||
//状态机刷新
|
||||
onUpdate(dt:number){
|
||||
|
||||
if(!this.start) this.start = 0;
|
||||
if(!this.current) this.current = 0;
|
||||
|
||||
//运行流程
|
||||
this.execute(this.process[this.current]);
|
||||
|
||||
}
|
||||
|
||||
//执行流程
|
||||
execute(process:GFSMProcessInfo){
|
||||
if(!process) return;
|
||||
|
||||
process.mode = process.mode || GFSMProcessMode.Execute;
|
||||
process.to = process.to || [];
|
||||
|
||||
let next:number;
|
||||
let isReset:boolean = true;
|
||||
|
||||
//执行流程
|
||||
switch(process.mode){
|
||||
case GFSMProcessMode.Execute:
|
||||
//执行方法
|
||||
next = process.to[process.execute()-1];
|
||||
break;
|
||||
case GFSMProcessMode.WaitExecute:
|
||||
//执行等待方法
|
||||
let state = process.execute();
|
||||
//如果 状态 -1 则 不重置 下一次状态从当前开始流程执行
|
||||
if(state == -1){
|
||||
isReset = false;
|
||||
}else{
|
||||
next = state;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(!this.process[next]) next = null;
|
||||
|
||||
if(next){
|
||||
this.current = next;
|
||||
//运行下一个流程
|
||||
this.execute(this.process[next]);
|
||||
}else{
|
||||
if(isReset){
|
||||
//重置
|
||||
this.current = this.start;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
54
JisolGameCocos/assets/script/battle/base/fsm/GFSMBattle.ts
Normal file
54
JisolGameCocos/assets/script/battle/base/fsm/GFSMBattle.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import GRoleBase from "../role/GRoleBase";
|
||||
import GFSMBase, { GFSMProcessInfo } from "./GFSMBase";
|
||||
|
||||
|
||||
export default abstract class GFSMBattle extends GFSMBase{
|
||||
|
||||
//流程图
|
||||
process: { [key: number]: GFSMProcessInfo; } = {
|
||||
0:{
|
||||
title:"寻找敌人",
|
||||
execute: this.onSeekEnemyProcess.bind(this),
|
||||
to:[1]
|
||||
},
|
||||
1:{
|
||||
title:"攻击敌人",
|
||||
execute: this.onAttackProcess.bind(this),
|
||||
}
|
||||
}
|
||||
|
||||
//锁定的敌人
|
||||
enemy:GRoleBase<any>;
|
||||
|
||||
|
||||
abstract onSeekEnemy():GRoleBase<any>;
|
||||
|
||||
//寻敌流程
|
||||
onSeekEnemyProcess():number{
|
||||
|
||||
if(this.enemy){
|
||||
//如果有敌人 直接 攻击
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(this.enemy = this.onSeekEnemy()){
|
||||
//如果有敌人 直接 攻击
|
||||
return 1;
|
||||
}
|
||||
|
||||
//负责继续寻敌
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
abstract onAttack();
|
||||
|
||||
//攻击敌人
|
||||
onAttackProcess(){
|
||||
this.onAttack();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "c6d20914-49fe-45ea-9bf2-750de7cc7ed2",
|
||||
"uuid": "ac1a0b3b-e57a-4718-a27f-39b8e072f74e",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
@@ -2,7 +2,7 @@
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "dd2bdaea-c6ea-4d98-8102-c807d059bd25",
|
||||
"uuid": "fe4e5e9b-d1dc-4aaf-9fa8-d089fd6ca00a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
25
JisolGameCocos/assets/script/battle/base/fsm/PVP/GFSMPVP.ts
Normal file
25
JisolGameCocos/assets/script/battle/base/fsm/PVP/GFSMPVP.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import GRoleBase from "../../role/GRoleBase";
|
||||
import GRolePVPEntity from "../../role/PVP/GRolePVPEntity";
|
||||
import GFSMBattle from "../GFSMBattle";
|
||||
|
||||
|
||||
//PVP 状态机
|
||||
export default class GFSMPVP extends GFSMBattle{
|
||||
|
||||
player:GRolePVPEntity;
|
||||
|
||||
constructor(player:GRolePVPEntity){
|
||||
super();
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
//寻敌
|
||||
onSeekEnemy(): GRoleBase<any> {
|
||||
return this.player.mode.getEnumy(this.player);
|
||||
}
|
||||
|
||||
//攻击
|
||||
onAttack() {
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "bf6010d3-4d2e-4ecf-abc4-a4e770ebd5df",
|
||||
"uuid": "86cd6fa1-1340-4343-8929-7c5363727b1c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "03218a59-18c0-42bc-aa22-117d45bc314a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
import GFSMBase from "../GFSMBase";
|
||||
|
||||
//角色状态机实现
|
||||
export default class GFSMRoleController extends GFSMBase{
|
||||
|
||||
//状态机更新
|
||||
|
||||
}
|
||||
|
@@ -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": "ae55abd4-8e9d-4e2a-859f-d8c2d518c608",
|
||||
"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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "9fc034a7-5c68-4f22-9065-447435329c8a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "b2af28db-e925-419f-81b8-3bf755a3224f",
|
||||
"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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -62,15 +62,34 @@ export class GTactical{
|
||||
|
||||
//返回阵法位置
|
||||
getPosition(index:number,father:Vec2 = v2(0,0)){
|
||||
|
||||
let pos;
|
||||
if(pos = this.getXY(index)){
|
||||
return father.clone().add(GTactical.pos[pos.y][pos.x].clone());
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
//返回XY
|
||||
getXY(index:number):Vec2{
|
||||
for(let i = 0;i < 3;i++){
|
||||
for(let j = 0;j < 3;j++){
|
||||
let tag = this.tactical[i][j];
|
||||
if(tag == index){
|
||||
return father.clone().add(GTactical.pos[i][j].clone());
|
||||
return v2(j,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//返回我在第几排
|
||||
getRow(index:number):number{
|
||||
let pos;
|
||||
if(pos = this.getXY(index)){
|
||||
return pos.y;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user