dd zindex 调整一完成,优化技能动画

This commit is contained in:
2024-09-13 09:02:06 +08:00
parent 221d91a795
commit 72839d9f9f
30 changed files with 145 additions and 247 deletions

View File

@@ -138,30 +138,18 @@ export class MonViewComp extends CCComp {
}
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D) { }
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
// if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
// this.is_atking = true;
// this.stop_cd = 0.1;
// }
if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){
if(selfCollider.node.position.y < otherCollider.node.position.y){
if(selfCollider.node.getSiblingIndex() < otherCollider.node.getSiblingIndex()){
selfCollider.node.setSiblingIndex(otherCollider.node.getSiblingIndex()+1)
// console.log("onPreSolve b:"+selfCollider.node.uuid+":"+selfCollider.node.getSiblingIndex()+"/"+otherCollider.node.uuid+":"+otherCollider.node.getSiblingIndex());
}
}
}
}
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
// if(selfCollider.group == otherCollider.group&&otherCollider.tag == 0&&selfCollider.tag == 0){
// let self_pos=selfCollider.node.getPosition();
// let other_pos=otherCollider.node.getPosition();
// // console.log('mon view group 相同');
// switch (selfCollider.group) {
// case BoxSet.HERO:
// if(self_pos.x < other_pos.x){
// // this.stop_cd=0.1
// }
// break;
// case BoxSet.MONSTER:
// if(self_pos.x > other_pos.x){
// // this.stop_cd=0.1
// }
// break
// }
// }
}
@@ -191,50 +179,18 @@ export class MonViewComp extends CCComp {
if(this.scale===-1&&this.node.position.x <= BoxSet.HERO_START+this.atk_cd){
return;
}
// if(this.enemy){
// return
// }
this.set_diry()
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y+dt*this.dir_y, this.node.position.z);
}
set_diry(){
this.dir_y=-(this.node.position.y-BoxSet.GAME_LINE)/60
} move_to(){
}
move_to(){
var move = this.ent.get(MoveToComp) || this.ent.add(MoveToComp);
move.target = v3(smc.Role.RoleView.node.position.x+10,smc.Role.RoleView.node.position.y);
move.node = this.node;
move.speed = this.ospeed;
// if(this.box_group == BoxSet.MON){
// if(smc.t_hero.eid != 0){
// var move = this.ent.get(MoveToComp) || this.ent.add(MoveToComp);
// if(smc.t_hero.pos.x < this.node.position.x){
// // this.node.setScale(-Math.abs(this.node.scale.x),this.node.scale.y)
// move.target = v3(smc.t_hero.pos.x+20,smc.t_hero.pos.y);
// }else{
// // this.node.setScale(Math.abs(this.node.scale.x),this.node.scale.y)
// move.target = v3(smc.t_hero.pos.x-20,smc.t_hero.pos.y);
// }
// move.node = this.node;
// move.speed = this.ospeed;
// }
// }
// if(this.box_group == BoxSet.HERO){
// if(smc.t_mon.eid != 0){
// var move = this.ent.get(MoveToComp) || this.ent.add(MoveToComp);
// if(smc.t_mon.pos.x < this.node.position.x){
// // this.node.setScale(-Math.abs(this.node.scale.x),this.node.scale.y)
// move.target = v3(smc.t_mon.pos.x+20,smc.t_mon.pos.y);
// }else{
// // this.node.setScale(Math.abs(this.node.scale.x),this.node.scale.y)
// move.target = v3(smc.t_mon.pos.x-20,smc.t_mon.pos.y);
// }
// move.node = this.node;
// move.speed = this.ospeed;
// }
// }
}
power_change(power: number){
this.power += power;