提交新模式

This commit is contained in:
PC-20230316NUNE\Administrator 2023-12-14 19:16:28 +08:00
parent 8fcc85a054
commit 9a3f666df1
12 changed files with 221 additions and 233 deletions

View File

@ -156,7 +156,7 @@
"_shutter": 7, "_shutter": 7,
"_iso": 0, "_iso": 0,
"_screenScale": 1, "_screenScale": 1,
"_visibility": 1073741825, "_visibility": 1,
"_targetTexture": { "_targetTexture": {
"__uuid__": "a0d1e275-5512-493e-8e15-7d2db8beb48e", "__uuid__": "a0d1e275-5512-493e-8e15-7d2db8beb48e",
"__expectedType__": "cc.RenderTexture" "__expectedType__": "cc.RenderTexture"

View File

@ -22,23 +22,26 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 18 "__id__": 8
}, },
{
"__id__": 14
},
{
"__id__": 18
}
],
"_active": true,
"_components": [
{ {
"__id__": 22 "__id__": 22
}
],
"_active": true,
"_components": [
{
"__id__": 26
}, },
{ {
"__id__": 28 "__id__": 24
} }
], ],
"_prefab": { "_prefab": {
"__id__": 30 "__id__": 26
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -69,85 +72,31 @@
}, },
"_id": "" "_id": ""
}, },
{
"__type__": "cc.Node",
"_name": "Map",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 9
}
],
"_active": true,
"_components": [
{
"__id__": 15
}
],
"_prefab": {
"__id__": 17
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 75.97,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "MAP2_2", "_name": "MAP2_2",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 2 "__id__": 1
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 4 "__id__": 3
}, },
{ {
"__id__": 6 "__id__": 5
} }
], ],
"_prefab": { "_prefab": {
"__id__": 8 "__id__": 7
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 523.294, "y": 610.769,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@ -159,9 +108,9 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.46, "x": 1,
"y": 1.46, "y": 1,
"z": 1.46 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
"_layer": 1, "_layer": 1,
@ -179,16 +128,16 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 3 "__id__": 2
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 5 "__id__": 4
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1200, "width": 1800,
"height": 530 "height": 800
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -199,7 +148,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "02JaCy2RtBv6IQedYySi9J" "fileId": "cfYou1Zg5LCqtPnS+wfZS1"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
@ -207,11 +156,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 3 "__id__": 2
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 7 "__id__": 6
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@ -229,7 +178,7 @@
}, },
"_type": 0, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 1, "_sizeMode": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0,
@ -244,7 +193,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "4fkgqaKsNJ2bWL29nICOgi" "fileId": "69Tj3S2xNHMZ3EglIU5w1Y"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@ -254,7 +203,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "51KkM8+RpPXbBFXOTtb9rJ", "fileId": "918Xg0Q+RGA54YezNI+cvl",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@ -265,25 +214,25 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 2 "__id__": 1
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 10 "__id__": 9
}, },
{ {
"__id__": 12 "__id__": 11
} }
], ],
"_prefab": { "_prefab": {
"__id__": 14 "__id__": 13
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 124.735, "y": 203.74199999999996,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@ -295,9 +244,9 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.46, "x": 1,
"y": 1.46, "y": 1,
"z": 1.46 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
"_layer": 1, "_layer": 1,
@ -315,16 +264,16 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 9 "__id__": 8
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 11 "__id__": 10
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1200, "width": 1800,
"height": 643 "height": 964
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -335,7 +284,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "08W8yrO6ZAMYoLsN5M67nH" "fileId": "6fNO9YoFBMVoknPFNDhdIt"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
@ -343,11 +292,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 9 "__id__": 8
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 13 "__id__": 12
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@ -365,7 +314,7 @@
}, },
"_type": 0, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 1, "_sizeMode": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0,
@ -380,7 +329,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "8fnMp4WlZP54syw5QNPIMP" "fileId": "4fqbVXXF9COpEp3qOMviz0"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@ -390,18 +339,65 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "35BC8iioRG9YIjz054LzvN", "fileId": "db7KlVnmBMUKpoqKybUC9n",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_name": "GObject",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 15
}
],
"_prefab": {
"__id__": 17
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 2 "__id__": 14
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
@ -421,7 +417,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "10qY81RfZAO71vWAsMbNxA" "fileId": "51F2pLtaRAvIrZ6+pAQ7gN"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@ -431,7 +427,7 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "7dQpog1zRHRanaq1MbAxcj", "fileId": "afU00zeEBCvYG08IYSwZ58",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
@ -523,7 +519,7 @@
"_shutter": 7, "_shutter": 7,
"_iso": 0, "_iso": 0,
"_screenScale": 1, "_screenScale": 1,
"_visibility": 1073741825, "_visibility": 1,
"_targetTexture": { "_targetTexture": {
"__uuid__": "0aace819-1a93-43fc-90a6-43189c1dbf89", "__uuid__": "0aace819-1a93-43fc-90a6-43189c1dbf89",
"__expectedType__": "cc.RenderTexture" "__expectedType__": "cc.RenderTexture"
@ -551,94 +547,6 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_name": "GObject",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
}
],
"_prefab": {
"__id__": 25
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 22
},
"_enabled": true,
"__prefab": {
"__id__": 24
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "51F2pLtaRAvIrZ6+pAQ7gN"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "afU00zeEBCvYG08IYSwZ58",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@ -649,7 +557,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 27 "__id__": 23
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@ -677,7 +585,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 29 "__id__": 25
}, },
"crystalPrefab": { "crystalPrefab": {
"__uuid__": "96ad3740-fce8-4333-9f8e-eb85f43bf6f8", "__uuid__": "96ad3740-fce8-4333-9f8e-eb85f43bf6f8",

View File

@ -333,7 +333,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 360, "x": 277.5,
"y": 640, "y": 640,
"z": 0 "z": 0
}, },
@ -346,8 +346,8 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1, "x": 0.75,
"y": 1, "y": 0.75,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@ -374,7 +374,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1440, "width": 1700,
"height": 1280 "height": 1280
}, },
"_anchorPoint": { "_anchorPoint": {
@ -441,11 +441,11 @@
"node": { "node": {
"__id__": 11 "__id__": 11
}, },
"_enabled": false, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 17 "__id__": 17
}, },
"_alignFlags": 8, "_alignFlags": 12,
"_target": null, "_target": null,
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
@ -462,7 +462,7 @@
"_originalWidth": 0, "_originalWidth": 0,
"_originalHeight": 0, "_originalHeight": 0,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 36,
"_id": "" "_id": ""
}, },
{ {
@ -713,7 +713,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -360, "x": -277.5,
"y": 640, "y": 640,
"z": 0 "z": 0
}, },
@ -726,8 +726,8 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1, "x": 0.75,
"y": 1, "y": 0.75,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@ -754,7 +754,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1440, "width": 1700,
"height": 1280 "height": 1280
}, },
"_anchorPoint": { "_anchorPoint": {
@ -821,11 +821,11 @@
"node": { "node": {
"__id__": 29 "__id__": 29
}, },
"_enabled": false, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 35 "__id__": 35
}, },
"_alignFlags": 32, "_alignFlags": 36,
"_target": null, "_target": null,
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
@ -842,7 +842,7 @@
"_originalWidth": 0, "_originalWidth": 0,
"_originalHeight": 0, "_originalHeight": 0,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 36,
"_id": "" "_id": ""
}, },
{ {

View File

@ -2,7 +2,7 @@
"__type__": "cc.RenderTexture", "__type__": "cc.RenderTexture",
"content": { "content": {
"base": "2,2,0,0,0,0", "base": "2,2,0,0,0,0",
"w": 1440, "w": 1700,
"h": 1280, "h": 1280,
"n": "CampGuardian" "n": "CampGuardian"
} }

View File

@ -15,7 +15,7 @@
"name": "spriteFrame", "name": "spriteFrame",
"userData": { "userData": {
"imageUuidOrDatabaseUri": "0aace819-1a93-43fc-90a6-43189c1dbf89", "imageUuidOrDatabaseUri": "0aace819-1a93-43fc-90a6-43189c1dbf89",
"width": 1440, "width": 1700,
"height": 1280 "height": 1280
}, },
"ver": "1.0.0", "ver": "1.0.0",
@ -27,7 +27,7 @@
} }
}, },
"userData": { "userData": {
"width": 1440, "width": 1700,
"height": 1280, "height": 1280,
"anisotropy": 0, "anisotropy": 0,
"minfilter": "linear", "minfilter": "linear",

View File

@ -32,8 +32,8 @@ import { Component } from "cc";
// let WsPath = `ws://localhost:8080/websocket` // let WsPath = `ws://localhost:8080/websocket`
// let APIPath = `http://192.168.1.23:8080` // let APIPath = `http://192.168.1.23:8080`
// let WsPath = `ws://192.168.1.23:8080/websocket` // let WsPath = `ws://192.168.1.23:8080/websocket`
let APIPath = `http://192.168.0.125:8080` let APIPath = `http://192.168.0.122:8080`
let WsPath = `ws://192.168.0.125:8080/websocket` let WsPath = `ws://192.168.0.122:8080/websocket`
// let APIPath = `https://api.pet.jisol.cn` // let APIPath = `https://api.pet.jisol.cn`
// let WsPath = `wss://api.pet.jisol.cn/websocket` // let WsPath = `wss://api.pet.jisol.cn/websocket`

View File

@ -28,8 +28,8 @@ export default class GFSMDefault extends GFSMBase{
} }
//锁定的敌人 //锁定的敌人
_enemy:() => GRoleDefault; _enemy:() => GRoleBase<{}>;
get enemy():GRoleDefault{ get enemy():GRoleBase<{}>{
if(this._enemy) if(this._enemy)
return this._enemy(); return this._enemy();
return null; return null;
@ -76,7 +76,7 @@ export default class GFSMDefault extends GFSMBase{
//寻敌 //寻敌
onSeekEnemy(): GRoleDefault { onSeekEnemy(): GRoleBase<{}> {
return this.player.onQueryEunmy(); return this.player.onQueryEunmy();
} }

View File

@ -142,13 +142,19 @@ export default class GRoleDefault extends GRoleBase<{}>{
let vWorld = this.node.worldPosition; let vWorld = this.node.worldPosition;
let vEndWorld = this.getWorldBackLen(v2(1500,500)); let vEndWorld = this.getWorldBackLen(v2(1500,500));
this.JTween(vWorld) this.JTween(vWorld)
.to({x:vEndWorld.x},1000) .to({x:vEndWorld.x},1200)
.onUpdate(pos => this.node.worldPosition = pos) .onUpdate(pos => {
if(this.node.isValid)
this.node.worldPosition = pos;
})
.start(); .start();
this.JTween(vWorld) this.JTween(vWorld)
.to({y:vEndWorld.y},1000) .to({y:vEndWorld.y},1200)
.easing(JEasing.Circular.Out) .easing(JEasing.Circular.Out)
.onUpdate(pos => this.node.worldPosition = vWorld) .onUpdate(pos => {
if(this.node.isValid)
this.node.worldPosition = vWorld
})
.start(); .start();
} }
@ -208,7 +214,7 @@ export default class GRoleDefault extends GRoleBase<{}>{
return false; return false;
} }
onQueryEunmy():GRoleDefault{ onQueryEunmy():GRoleBase<{}>{
return null; return null;
} }

View File

@ -13,6 +13,9 @@ import GRoleBase from "../base/role/GRoleBase";
import { GTactical } from "../entity/GTactical"; import { GTactical } from "../entity/GTactical";
import JNFrameTime from "../../../../extensions/ngame/assets/ngame/sync/frame/game/time/JNFrameTime"; import JNFrameTime from "../../../../extensions/ngame/assets/ngame/sync/frame/game/time/JNFrameTime";
import { TbGPetId } from "../../config/TbGPet"; import { TbGPetId } from "../../config/TbGPet";
import GModeTools from "./GModeTools";
import GPetAttribute from "../base/values/attribute/role/GPetAttribute";
import RandomUtil from "../../../../extensions/ngame/assets/ngame/util/RandomUtil";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
//阵营守护 角色 //阵营守护 角色
@ -27,9 +30,9 @@ export enum GCampGuardianEnum{
export default class GCampGuardianMode extends GBaseMode<{},{}>{ export default class GCampGuardianMode extends GBaseMode<{},{}>{
//玩家水晶位置 //玩家水晶位置
playerPos: Vec2 = new Vec2(-600,0); playerPos: Vec2 = new Vec2(-800,-100);
//敌方水晶位置 //敌方水晶位置
enemyPos: Vec2 = new Vec2(600,0); enemyPos: Vec2 = new Vec2(800,-100);
//我方水晶 //我方水晶
@ -56,10 +59,9 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
//定时器生成 //定时器生成
JNFrameTime.getInstance().setInterval(() => { JNFrameTime.getInstance().setInterval(() => {
this.onGenRole(GCampGuardianEnum.PLAYER,TD.TbGRole.get(TbGPetId.)); let max = TD.TbGRole.getDataList().length;
this.onGenRole(GCampGuardianEnum.PLAYER,TD.TbGRole.get(TbGPetId.)); this.onGenRole(GCampGuardianEnum.PLAYER,TD.TbGRole.getDataList()[Math.floor(this.getSync().SyncRandomInt(0,max - 1))]);
this.onGenRole(GCampGuardianEnum.PLAYER,TD.TbGRole.get(TbGPetId.)); this.onGenRole(GCampGuardianEnum.ENEMY,TD.TbGRole.getDataList()[Math.floor(this.getSync().SyncRandomInt(0,max - 1))]);
this.onGenRole(GCampGuardianEnum.ENEMY,TD.TbGRole.get(TbGPetId.));
},1000) },1000)
} }
@ -106,20 +108,54 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
//初始化 //初始化
entity.onInit(type,info,tactical,tactical.getPosXY(1,1)); entity.onInit(type,info,tactical,tactical.getPosXY(1,1));
// //绑定寻敌 //绑定寻敌
// entity.onQueryEunmy = () => { entity.onQueryEunmy = () => {
// return this.getEnumy(entity,type); return GModeTools.getNearbyEnumy(entity,this.getOnesRoleAlive(type == GCampGuardianEnum.PLAYER ? GCampGuardianEnum.ENEMY : GCampGuardianEnum.PLAYER));
// } }
// //绑定死亡回调 //绑定死亡回调
// entity.addKillBackEvent(this.onRoleKillBack.bind(this)) // entity.addKillBackEvent(this.onRoleKillBack.bind(this))
//添加宠物属性
entity.onEffectiveValue(new GPetAttribute({
petId:info.id,
petPlayerId:0,
petTbId:info.id,
petLevel:0,
petStar:0,
petStarExp:0,
}));
// //绑定受击回调 // //绑定受击回调
// entity.addHitCallback(this.onHitBack.bind(this)); // entity.addHitCallback(this.onHitBack.bind(this));
this.addGObject(entity,pos); this.addGObject(entity,pos);
this.getOnesRole(type).push(entity);
return entity; return entity;
} }
//获取阵营宠物
getOnesRole(type: GCampGuardianEnum):GRoleBase<{}>[]{
if(type == GCampGuardianEnum.PLAYER) return this.playerRoles;
if(type == GCampGuardianEnum.ENEMY) return this.enemyRoles;
}
//获取存活的宠物
getOnesRoleAlive(type: GCampGuardianEnum):GRoleBase<{}>[]{
if(type == GCampGuardianEnum.PLAYER) return this.playerRoles.filter(role => !!role.get());
if(type == GCampGuardianEnum.ENEMY) return this.enemyRoles.filter(role => !!role.get());
}
//角色死亡回调
onRoleKillBack(role:GRoleDefault){
//死亡销毁
JNFrameTime.getInstance().setTimeout(() => {
if(role.isValid)
role.node.destroy()
},3000)
}
} }

View File

@ -0,0 +1,29 @@
import { Vec2 } from "cc";
import GRoleBase from "../base/role/GRoleBase";
//模式工具类
export default class GModeTools{
//通过距离获取最近的敌人
static getNearbyEnumy(player:GRoleBase<{}>,roles:GRoleBase<{}>[]){
//通过距离获取最近的敌人
if(roles[0]){
let len = Math.abs(Vec2.distance(player.v2World,roles[0].v2World));
let enumy = roles[0];
for (let index = 0; index < roles.length; index++) {
const role = roles[index];
let tLen;
if(tLen = Math.abs(Vec2.distance(player.v2World,role.v2World)) < len){
enumy = role;
len = tLen;
}
}
return enumy;
}else{
return null;
}
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "2e0c3126-ff69-4923-9ad6-21821ade5e93",
"files": [],
"subMetas": {},
"userData": {}
}

@ -1 +1 @@
Subproject commit e7ef32f1ed47ef7ffe0173e5e5a7cc66b41bf25b Subproject commit f04667b4988cb251db49a4289f22ec54e8ce889b