技能动画添加

This commit is contained in:
2025-01-05 09:10:21 +08:00
parent 66f4a0de82
commit 511459c66c
118 changed files with 22272 additions and 8796 deletions

View File

@@ -116,9 +116,9 @@ export class HeroViewComp extends CCComp {
crit_count: number = 0;
stop_cd: number = 0.5; /*停止倒计时*/
yun_cd: number = 0.5; //眩晕倒计时
ice_cd: number = 0.5; //冰冻倒计时
stop_cd: number = 0; /*停止倒计时*/
yun_cd: number = 0; //眩晕倒计时
ice_cd: number = 0; //冰冻倒计时
dir_y:number = 0;
speek_time:number = 0;
@@ -131,7 +131,6 @@ export class HeroViewComp extends CCComp {
this.as.idle()
this.BUFFCOMP=this.node.getComponent(BuffComp);
/** 方向 */
this.node.setScale(this.scale,1);
this.node.getChildByName("top").setScale(this.scale,1);
@@ -164,47 +163,48 @@ export class HeroViewComp extends CCComp {
}
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D) {
onBeginContact (seCol: Collider2D, oCol: Collider2D) {
if(otherCollider.tag==BoxSet.SKILL_TAG &&selfCollider.tag!=BoxSet.SKILL_TAG){
if(selfCollider.group != otherCollider.group){
let skill = otherCollider.node.getComponent(SkillCom)!;
console.log(Date.now()+this.hero_name+":"+this.uuid+' onBeginContact: '+skill.uuid);
if(oCol.tag==BoxSet.SKILL_TAG &&seCol.tag!=BoxSet.SKILL_TAG){
if(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
this.check_uatk(skill);
}
}
}
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D) {
onEndContact (seCol: Collider2D, oCol: Collider2D) {
}
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
let self_x = selfCollider.node.position.x;
let other_x = otherCollider.node.position.x;
if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){
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(selfCollider.group==BoxSet.HERO){
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x < other_x && Math.abs(other_x-self_x) < 40 ){
// this.node.setSiblingIndex(otherCollider.node.getSiblingIndex()-10)
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(selfCollider.group==BoxSet.MONSTER){
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x > other_x && Math.abs(other_x-self_x) < 40 ){
// this.node.setSiblingIndex(otherCollider.node.getSiblingIndex()-10)
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(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){
if(seCol.group != oCol.group&&oCol.tag == 0){
this.stop_cd = 0.1;
this.is_atking=true
}
}
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
onPostSolve (seCol: Collider2D, oCol: Collider2D) {
}
update(dt: number){
if(!smc.mission.play||smc.mission.pause) return
@@ -222,10 +222,15 @@ export class HeroViewComp extends CCComp {
this.check_enemy_alive()
this.check_mission_buff()
if(this.ice_cd > 0){ this.ice_cd -=dt; return }
if(this.yun_cd > 0){ this.yun_cd -=dt; return }
if(this.ice_cd > 0){
this.ice_cd -=dt;
return
}
if(this.yun_cd > 0){
this.yun_cd -=dt;
return
}
this.at += dt;
this.in_stop(dt);
this.in_atk(dt);
this.move(dt);
@@ -336,6 +341,7 @@ export class HeroViewComp extends CCComp {
}
return
}
this.check_debuff(skill)
if(this.check_dodge()) return
this.in_atked();
let d=this.def/skill.ap
@@ -347,6 +353,44 @@ export class HeroViewComp extends CCComp {
l_hp=Math.ceil(l_hp)
this.hp_less(l_hp,skill.is_crit);
}
check_debuff(skill:any){
console.log(this.hero_name+":"+this.uuid+"check_debuff "+skill.debuff);
if(skill.debuff == 0) return
let num=RandomManager.instance.getRandomInt(0,100)
switch (skill.debuff){
case 1:
// console.log(this.hero_name+":"+this.uuid+"冰冻触判断: i="+num+":rate="+skill.rate);
if(num > skill.rate) return
// console.log(this.hero_name+":"+this.uuid+"冰冻触成功: i="+num+":decd="+skill.decd);
this.ice_cd = skill.decd
this.BUFFCOMP.in_iced(skill.decd)
break;
case 2:
if(num > skill.rate) return
break;
case 3:
if(num > skill.rate) return
this.yun_cd = skill.decd
this.BUFFCOMP.in_yun(skill.decd)
break;
case 4:
if(num > skill.rate) return
break;
case 5:
if(num > skill.rate) return
break;
case 6:
if(num > skill.rate) return
break;
case 7:
if(num > skill.rate) return
break;
case 8:
if(num > skill.rate) return
break;
}
}
//能量判断
check_power(){
if(this.pw >= this.pwm){