去掉物理碰撞组件,英雄的移动改由系统逻辑统一处理

This commit is contained in:
2025-02-02 16:28:19 +08:00
parent e571ae2caf
commit 00148863ad
82 changed files with 397 additions and 5831 deletions

View File

@@ -14,13 +14,6 @@ const { ccclass, property } = _decorator;
@ccclass('Main')
export class Main extends Root {
start() {
// if (DEBUG) profiler.showStats();
// PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.Aabb
// // | EPhysics2DDrawFlags.Pair
// |EPhysics2DDrawFlags.CenterOfMass
// |EPhysics2DDrawFlags.Joint
// |EPhysics2DDrawFlags.Shape;
// console.log("PhysicsSystem2D",PhysicsSystem2D.instance.gravity)
}
protected async run() {
smc.initialize = ecs.getEntity<Initialize>(Initialize);

View File

@@ -65,8 +65,8 @@ export const HeroSet = {
export const HeroInfo = {
5001:{uuid:5001,name:"神圣守护",path:"k2",quality:3,kind:1,type:0,
hp:5120,hp_up:130,shp_up:100,def:100,def_up:16,sdef_up:50,ap:100,ap_up:6,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6018,6018,6018,6018,6018,6018],sk3:[6018,6018,6018,6018,6018,6018],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -74,8 +74,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5002:{uuid:5002,name:"幻影剑豪",path:"k1",quality:3,kind:2,type:0,
hp:4650,hp_up:130,shp_up:100,def:100,def_up:16,sdef_up:50,ap:100,ap_up:6,
sap_up:100,atp:1,vun:0,crit:40,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:40,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6024,6024,6024,6024,6024,6024],sk3:[6024,6024,6024,6024,6024,6024],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -83,8 +83,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5003:{uuid:5003,name:"战争领主",path:"k5",quality:3,kind:2,type:0,
hp:5230,hp_up:130,shp_up:100,def:100,def_up:16,sdef_up:50,ap:100,ap_up:6,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6027,6027,6027,6027,6027,6027],sk3:[6027,6027,6027,6027,6027,6027],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -164,8 +164,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5201:{uuid:5201,name:"兽人战士",path:"mor1",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -173,8 +173,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5202:{uuid:5202,name:"兽人刺客",path:"mor2",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -191,8 +191,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5204:{uuid:5204,name:"石卫",path:"mgem1",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -200,8 +200,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5205:{uuid:5205,name:"土卫",path:"mgem2",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -209,8 +209,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5206:{uuid:5206,name:"树人",path:"mgem3",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -218,8 +218,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5207:{uuid:5207,name:"小骷髅",path:"mkl1",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -227,8 +227,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5208:{uuid:5208,name:"小骷髅",path:"mkl2",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -236,8 +236,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5209:{uuid:5209,name:"小骷髅",path:"mkl3",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -245,8 +245,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5210:{uuid:5210,name:"骷髅战士",path:"mkl4",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -254,8 +254,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5211:{uuid:5211,name:"骷髅战士",path:"mkl5",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -263,8 +263,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5212:{uuid:5212,name:"骷髅战士",path:"mkl6",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -326,8 +326,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5219:{uuid:5219,name:"牛头战士",path:"mn1",quality:2,kind:1,type:0,
hp:5000,hp_up:120,shp_up:100,def:100,def_up:15,sdef_up:50,ap:100,ap_up:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -344,8 +344,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5221:{uuid:5221,name:"牛头战士",path:"mn3",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -353,8 +353,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5222:{uuid:5222,name:"独眼巨人",path:"md1",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6005,6005,6005,6005,6005,6005],sk2:[6005,6005,6005,6005,6005,6005],sk3:[6005,6005,6005,6005,6005,6005],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],
@@ -362,8 +362,8 @@ export const HeroInfo = {
crc:[1,1,1,1,1,1],tals:["无","无","无","无","无"]},
5223:{uuid:5223,name:"独眼巨人",path:"md2",quality:1,kind:1,type:0,
hp:5000,hp_up:110,shp_up:100,def:100,def_up:14,sdef_up:50,ap:100,ap_up:4,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:180,
a_cd:1,speed:120,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
sap_up:100,atp:1,vun:0,crit:20,crit_add:0,ucr:0,dodge:0,dis:580,
a_cd:1,speed:80,lvexp:0,slvexp:0,slv:0,aexp:5,uaexp:2,cexp:5,
doexp:5,dexp:20,pw:0,pwm:150,pws:10,apw:2,uapw:1,cpw:5,dpw:5,
dopw:5,wp:1001,arm:2001,ring:3001,shoes:4001,
sk1:[6008,6008,6008,6008,6008,6008],sk2:[6008,6008,6008,6008,6008,6008],sk3:[6008,6008,6008,6008,6008,6008],akr:[0,0,0,0,0,0],akc:[1,1,1,1,1,1],

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "196aaacb-556c-4bb2-925c-9a70dc3e56fc",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,6 +1,7 @@
import { HeroViewComp } from "../../../hero/HeroViewComp";
import { BattleMoveComp } from "./BattleMoveComp";
import { ecs } from "../../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { smc } from "../../SingletonModuleComp";
@ecs.register('BattleMoveSystem')
export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
@@ -9,24 +10,29 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU
}
update(e: ecs.Entity) {
if(!smc.mission.play||smc.mission.pause) return
const move = e.get(BattleMoveComp);
const view = e.get(HeroViewComp);
if (!move.moving) return;
// 检测攻击范围内是否有敌人
const hasEnemy = this.checkEnemiesInRange(e, view.dis);
if (!hasEnemy) {
const shouldStop = this.checkEnemiesInRange(e, view.dis);
view.is_atking = shouldStop;
// 同步攻击状态
if (!shouldStop) {
if(view.is_stop||view.is_dead) return //停止移动或者死亡不移动
// 计算移动量
const delta = view.speed * this.dt * move.direction;
const newX = view.node.position.x + delta;
// 限制移动范围
if (this.validatePosition(newX, move)) {
view.node.setPosition(newX, view.node.position.y, 0);
}
}
// console.log(`[${view.hero_name}] 类型:${view.type} 是否停止:${shouldStop} 方向:${move.direction} 位置:${view.node.position.x.toFixed(1)}`);
}
/** 验证目标位置有效性 */
@@ -41,11 +47,23 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU
private checkEnemiesInRange(entity: ecs.Entity, range: number): boolean {
const currentPos = entity.get(HeroViewComp).node.position;
const team = entity.get(HeroViewComp).fac;
const view = entity.get(HeroViewComp);
const isMelee = view.type === 0;
return ecs.query(ecs.allOf(HeroViewComp)).some(e => {
const view = e.get(HeroViewComp);
return view.fac !== team &&
Math.abs(currentPos.x - view.node.position.x) <= range;
const distance = Math.abs(currentPos.x - view.node.position.x);
if (isMelee) {
// 近战需要满足:在攻击范围内且距离<=75才停止
const inAttackRange = distance <= range;
const closeEnough = distance <= 75; // 近战停止距离
return view.fac !== team && inAttackRange && closeEnough;
}
else {
// 远程/辅助:在攻击范围内即停止
return view.fac !== team && distance <= range;
}
});
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "9f62614b-42c3-4f21-a3d6-68c9190082e8",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -5,11 +5,13 @@
* @LastEditTime: 2022-07-25 17:05:02
*/
import { ecs } from "../../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { BattleMoveSystem } from "./BattleMoveSystem";
import { MoveToSystem } from "./MoveTo";
export class EcsPositionSystem extends ecs.System {
constructor() {
super();
this.add(new MoveToSystem());
this.add(new BattleMoveSystem());
}
}

View File

@@ -1,4 +1,3 @@
import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label,RigidBody2D ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp, Game, tween} from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
@@ -35,7 +34,7 @@ export class HeroViewComp extends CCComp {
lv:number =1;
slv:number =1;
scale: number = 1; /** 角色阵营 1hero -1 :mon */
type: number = 0; /**角色类型 0近战 1 远程 2 辅助 */
type: number = 0; /**角色类型 0近战-需要贴身 1远程-保持距离 2辅助 */
fac:number=0; //阵营 0hero 1monster
box_group:number = BoxSet.HERO;
atk_range:number = 150;
@@ -121,9 +120,7 @@ export class HeroViewComp extends CCComp {
this.as = this.getComponent(HeroSpine);
} /** 视图层逻辑代码分离演示 */
start () {
this.as.idle()
this.BUFFCOMP=this.node.getComponent(BuffComp);
/** 方向 */
@@ -133,72 +130,8 @@ export class HeroViewComp extends CCComp {
this.node.setScale(this.node.scale.x*1.5,this.node.scale.y*1.5);
this.node.getChildByName("top").getChildByName("sboss").active = true;
}
/** 显示角色血量 */
/* 显示角色血量 */
this.node.getChildByName("top").getChildByName("hp").active = true;
// this.node.getChildByName("shielded").active = false;
// this.node.getChildByName("top").setScale(this.scale,1);
// this.node.getChildByName("atk").setScale(this.scale,1);
// this.node.getChildByName("atk").getComponent(Label).string = this.ap.toString();
// this.node.getChildByName("hp_max").setScale(this.scale,1);
// this.node.getChildByName("hp_max").getComponent(Label).string=this.hp_max.toString();
// 注册单个碰撞体的回调函数
let collider = this.getComponent(Collider2D);
collider.group = this.box_group;
// console.log("hero collider ",this.scale,collider);
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
}
onBeginContact (seCol: Collider2D, oCol: Collider2D) {
if(oCol.tag==BoxSet.SKILL_TAG&&seCol.group != oCol.group){
let skill = oCol.node.getComponent(SkillCom)!;
// console.log(Date.now()+this.hero_name+":"+this.uuid+' onBeginContact: '+skill.s_name+skill.uuid);
if(this.hp <= 0 ) return
if(skill.tg< 3) return
this.check_uatk(skill);
}
}
onEndContact (seCol: Collider2D, oCol: Collider2D) {
}
onPreSolve (seCol: Collider2D, oCol: Collider2D) {
let se_x = seCol.node.position.x;
let ot_x = oCol.node.position.x;
let oCom= oCol.node.getComponent(HeroViewComp)
if(seCol.group == oCol.group&&seCol.tag==oCol.tag){
if(seCol.group==BoxSet.HERO){
if(oCom.type == this.type&&oCom.yun_cd<=0&&oCom.ice_cd<=0 && se_x < ot_x && Math.abs(ot_x-se_x) < 40 ){
// this.node.setSiblingIndex(oCol.node.getSiblingIndex()-10)
this.stop_cd = 0.1;
}
}
if(seCol.group==BoxSet.MONSTER){
if(oCom.type == this.type&&oCom.yun_cd<=0&&oCom.ice_cd<=0 && se_x > ot_x && Math.abs(ot_x-se_x) < 40 ){
// this.node.setSiblingIndex(oCol.node.getSiblingIndex()-10)
this.stop_cd = 0.1;
}
}
}
if(seCol.group != oCol.group&&oCol.tag == 0){
this.stop_cd = 0.1;
this.is_atking=true
}
}
onPostSolve (seCol: Collider2D, oCol: Collider2D) {
}
update(dt: number){
if(!smc.mission.play||smc.mission.pause) return
@@ -206,14 +139,11 @@ export class HeroViewComp extends CCComp {
if(!this.in_grave()) this.to_grave()
return
}
if (this.pwt.update(dt)) {
this.pw+=this.pws
}
this.check_power()
this.check_atk_counts()
this.check_enemy_alive()
this.check_mission_buff()
this.hp_show()
if(this.ice_cd > 0){
@@ -227,8 +157,8 @@ export class HeroViewComp extends CCComp {
this.at += dt;
this.in_stop(dt);
this.in_atk(dt);
this.move(dt);
}
}
hp_show(){
let hp_progress= this.hp/this.rhp_max;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
@@ -240,25 +170,6 @@ export class HeroViewComp extends CCComp {
}
}
//移动
move(dt: number){
if(this.stop_cd > 0||smc.mission.is_victory||smc.mission.is_defeat){
this.status_change("idle")
return
}
if (this.node.position.x >= 300 && this.scale==1) {
return;
}
if(this.scale===-1&&this.node.position.x <= -300){
return;
}
this.status_change("move")
// if(this.enemy){
// return
// }
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y+dt*this.dir_y, this.node.position.z);
}
check_mission_buff(){
this.ap_max=(100+smc.vmdata.mission.ap)/100*this.ap
this.crit_max=(100+smc.vmdata.mission.crit)/100*this.crit
@@ -273,35 +184,7 @@ export class HeroViewComp extends CCComp {
this.rhp_max=(100+smc.vmdata.mission.mhp)/100*this.hp_max
}
}
check_enemy_alive(){
// let dir = 720
// let enemys=smc.enemy_pos
// this.enemy = v3(720,this.node.position.y)
// if(this.box_group == BoxSet.MONSTER){
// enemys=smc.hero_pos
// // console.log("MONSTER enemys",enemys);
// this.enemy=v3(-720,this.node.position.y)
// }
// for (let i = 0; i < enemys.length; i++) {
// let ho:any = enemys[i];
// let x=Math.abs(ho.x-this.node.position.x)
// if(x < dir){
// dir = x
// this.enemy = ho
// }
// }
let dir = Math.abs(smc.mon_front_x-this.node.position.x)
if(this.box_group == BoxSet.MONSTER){
dir = Math.abs(smc.hero_front_x-this.node.position.x)
}
if(dir < this.dis){
this.is_atking=true
if(this.dis-dir > 80 &&this.type > 0 ) this.stop_cd = 0.1
if(dir < 65 &&this.type == 0 ) this.stop_cd = 0.1
}else{
this.is_atking=false
}
}
//状态切换
status_change(type:string){
this.status=type
@@ -872,19 +755,14 @@ export class HeroViewComp extends CCComp {
}
//进入墓地
to_grave(){
let pos =v3(-999,this.node.position.y)
if(this.box_group == BoxSet.MONSTER){
pos =v3(999,this.node.position.y)
smc.vmdata.mission.mdead +=1
}else{
smc.vmdata.mission.dead +=1
}
let pos =v3(0,-1000,this.node.position.z)
this.node.setPosition(pos)
}
//是否在墓地
in_grave(){
return this.node.position.x < -900 || this.node.position.x > 900;
return this.node.position.y <= -900;
}
to_alive(){
let pos =v3(HeroSet.StartPos[this.type],this.node.position.y,this.node.position.z)
this.node.setPosition(pos)

View File

@@ -48,22 +48,8 @@ export class SkillCom extends CCComp {
start() {
oops.message.on(GameEvent.MissionEnd, this.doDestroy, this);
this.node.active=true
let collider = this.getComponent(Collider2D);
collider.group = this.box_group;
collider.tag = this.box_tag;
collider.sensor = true;
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
}
onBeginContact (seCol: Collider2D, otCol: Collider2D, contact: IPhysics2DContact | null) {
if(otCol.group != seCol.group&&otCol.tag ==0){
this.atk_count+=1
}
}
to_console(value:any,value2:any=null,value3:any=null){
console.log("["+this.s_name+this.s_uuid+"]:",value,value2,value3)
}