技能动画添加

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

View File

@@ -3,6 +3,7 @@ import { HeroViewComp } from './HeroViewComp';
import { oops } from 'db://oops-framework/core/Oops';
import { ecs } from 'db://oops-framework/libs/ecs/ECS';
import { Tooltip } from '../skills/Tooltip';
import { timedCom } from '../skills/timedCom';
const { ccclass, property } = _decorator;
@ccclass('BuffComp')
@@ -25,9 +26,7 @@ export class BuffComp extends Component {
dehp_cd:number=0;
decrit_cd:number=0;
iced_cd:number=0;
buff_cd:number=0;
yun_cd:number=0;
wind_cd:number=0;
speek_time:number=0;
@@ -108,16 +107,6 @@ export class BuffComp extends Component {
}
if(this.yun_cd > 0 ) this.yun_cd -= deltaTime;
if(this.yun_cd <= 0 && this.node.getChildByName("yun").active){
this.node.getChildByName("yun").active = false;
}
if(this.iced_cd > 0 ) this.iced_cd -= deltaTime;
if(this.iced_cd <= 0 && this.node.getChildByName("iced").active){
this.node.getChildByName("iced").active = false;
}
if(this.buff_cd > 0 ) this.buff_cd -= deltaTime;
if(this.buff_cd <= 0 && this.node.getChildByName("buff").active){
this.node.getChildByName("buff").active = false;
@@ -175,14 +164,6 @@ export class BuffComp extends Component {
this.node.getChildByName("top").getChildByName("buff").getChildByName("crit").active = true;
}
show_iced(t:number=1){
this.iced_cd = t;
this.node.getChildByName("iced").active = true;
}
show_yun(t:number=1){
this.iced_cd = t;
this.node.getChildByName("yun").active = true;
}
show_wind(t:number=1){
this.wind_cd = t;
@@ -226,7 +207,21 @@ export class BuffComp extends Component {
node.setPosition(pos)
node.parent = this.node;
}
in_iced(t:number=1) {
var path = "game/skills/iced";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.getComponent(timedCom).time = t;
node.parent = this.node;
}
in_yun(t:number=1) {
var path = "game/skills/yun";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.setPosition(v3(0,90));
node.getComponent(timedCom).time = t;
node.parent = this.node;
}
to_speek(words:string,time:number=0.5){
this.speek_time=0.5
this.node.getChildByName("tooltip").active=true

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){