技能碰撞改回物理碰撞

This commit is contained in:
2025-03-30 16:59:40 +08:00
parent 67704725b2
commit 798a831227
85 changed files with 13428 additions and 7394 deletions

View File

@@ -2,12 +2,14 @@ import { _decorator, v3, Vec3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { BoxSet } from "../common/config/BoxSet";
import { HeroInfo, HeroList, HeroSet } from "../common/config/heroSet";
import { HeroInfo, HeroList, HeroPos, HeroSet } from "../common/config/heroSet";
import { Hero } from "../hero/Hero";
import { smc } from "../common/SingletonModuleComp";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
import { GameEvent } from "../common/config/GameEvent";
import { HeroModelComp } from "../hero/HeroModelComp";
import { HeroViewComp } from "../hero/HeroViewComp";
const { ccclass, property } = _decorator;
@@ -16,6 +18,11 @@ const { ccclass, property } = _decorator;
@ecs.register('MissionHeroComp', false)
export class MissionHeroCompComp extends CCComp {
timer:Timer=new Timer(2)
start_pos:any={
0:{pos:v3(-140,130,0),has:false},
1:{pos:v3(-220,130,0),has:false},
2:{pos:v3(-300,130,0),has:false},
}
onLoad(){
this.on(GameEvent.UserHeroCard,this.call_hero,this)
}
@@ -27,7 +34,9 @@ export class MissionHeroCompComp extends CCComp {
}
init(){
this.start_pos[0].has=false
this.start_pos[1].has=false
this.start_pos[2].has=false
}
test_call(){
this.addHero(5010)
@@ -41,12 +50,30 @@ export class MissionHeroCompComp extends CCComp {
this.addHero(uuid)
}
/** 添加玩家 */
private addHero(uuid:number=1001,i:number=0) {
private addHero(uuid:number=1001) {
console.log("call_hero addHero",uuid)
let info:any={ap:0,hp:0}
if(this.start_pos[HeroInfo[uuid].type].has){
info=this.remove_hero(HeroInfo[uuid].type)
}
let hero = ecs.getEntity<Hero>(Hero);
let scale = 1
let y=RandomManager.instance.getRandomInt(0,HeroSet.Start_y.length,1)
let pos:Vec3 = v3(HeroSet.Start_x[HeroInfo[uuid].type],HeroSet.Start_y[y]);
hero.load(pos,scale,uuid);
let pos:Vec3 = v3(HeroPos[HeroInfo[uuid].type].pos);
hero.load(pos,scale,uuid,info);
this.start_pos[HeroInfo[uuid].type].has=true
}
remove_hero(i:number){
let info:any={ap:0,hp:0}
let heros=ecs.query(ecs.allOf(HeroModelComp))
for(let hero of heros){
if(hero.get(HeroViewComp).node.position.x==HeroPos[i].pos.x){
info.ap=hero.get(HeroViewComp).ap*(100+hero.get(HeroViewComp).r_up)/100
info.hp=hero.get(HeroViewComp).hp*(100+hero.get(HeroViewComp).r_up)/100
hero.destroy()
return info
}
}
return info
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {