排序问题解决,优化小兵线路

This commit is contained in:
2024-09-13 00:51:23 +08:00
parent f80115e251
commit 221d91a795
43 changed files with 11085 additions and 28930 deletions

View File

@@ -53,6 +53,11 @@ export class BoxRangComp extends CCComp {
}
}
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
// if(selfCollider.node.parent.position.y < otherCollider.node.parent.position.y){
// console.log("onPreSolve f:"+selfCollider.node.parent.getSiblingIndex()+"/"+otherCollider.node.parent.getSiblingIndex());
// selfCollider.node.parent.setSiblingIndex(otherCollider.node.parent.getSiblingIndex()+1)
// console.log("onPreSolve b:"+selfCollider.node.parent.getSiblingIndex()+"/"+otherCollider.node.parent.getSiblingIndex());
// }
if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
let scene =smc.map.MapView.scene.mapLayer!.node!
let other_pos = otherCollider.node.getWorldPosition() ;

View File

@@ -84,6 +84,8 @@ export class MonViewComp extends CCComp {
buff_shields:any=[];
buff_atks:any = [];
dir_y:number = 0;
speek_time:number = 0;
onLoad() {
this.as = this.getComponent(MonSpine);
// this.BoxRang = this.node.getChildByName("range_box");
@@ -168,6 +170,7 @@ export class MonViewComp extends CCComp {
this.power_change(this.power_speed)
}
this.in_destroy();
this.in_speek(dt);
this.in_shield(dt);
this.in_stop(dt);
this.in_atk(dt);
@@ -237,6 +240,7 @@ export class MonViewComp extends CCComp {
this.power += power;
if(this.power >= this.power_max&&this.check_enemy_alive()){
this.as.atk()
this.to_speek(smc.skills[this.max_skill_uuid].name)
this.scheduleOnce(()=>{
this.do_max_skill();
},0.5)
@@ -258,6 +262,7 @@ export class MonViewComp extends CCComp {
}
//使用max_skill
do_max_skill(){
let skill = ecs.getEntity<Skill>(Skill);
let scale = this.scale
let speed =smc.skills[this.max_skill_uuid].speed;
@@ -265,7 +270,22 @@ export class MonViewComp extends CCComp {
let atk = smc.skills[this.max_skill_uuid].atk+this.atk;
let {pos,angle,t_pos}=this.get_enemy_pos()
skill.load(pos,speed,dis,scale,this.node,this.max_skill_uuid,atk,angle,t_pos);
this.tooltip(3,smc.skills[this.max_skill_uuid].name,this.max_skill_uuid);
}
to_speek(words:string,time:number=0.5){
this.speek_time=0.5
this.node.getChildByName("tooltip").active=true
this.node.getChildByName("tooltip").getChildByName("words").getComponent(Label)!.string = words
}
in_speek(dt: number){
if(this.speek_time <= 0){
return;
}
this.speek_time -= dt;
if(this.speek_time <= 0){
this.speek_time = 0;
this.node.getChildByName("tooltip").getChildByName("words").getComponent(Label)!.string = "";
this.node.getChildByName("tooltip").active=false;
}
}
get_enemy_pos(){
let pos = v3(35*this.scale,50)
@@ -328,21 +348,13 @@ export class MonViewComp extends CCComp {
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
if(this.hp <= 0){
this.dead();
this.remove_smc_data()
this.is_dead = true;
setTimeout(() => {
this.ent.destroy();
}, 15);
}
}
remove_smc_data(){
if(smc.t_monster.eid == this.ent.eid){
smc.t_monster = {eid:0,pos:v3(0,0,0)}
}
if(smc.t_hero.eid == this.ent.eid){
smc.t_hero = {eid:0,pos:v3(0,0,0)}
}
}
add_hp(hp: number=0){
console.log("hero 加血动画");
this.hp+=hp;
@@ -414,7 +426,8 @@ export class MonViewComp extends CCComp {
pos.y=pos.y+60;
tip.load(pos,type,value,s_uuid,node);
}
/** 静止时间 */
in_stop (dt: number) {
if(this.stop_cd > 0){