再次清理英雄,切换到像素

This commit is contained in:
panfudan
2025-08-10 15:48:34 +08:00
parent 4ea590e708
commit bce3580b22
124 changed files with 18188 additions and 2627 deletions

View File

@@ -32,8 +32,6 @@ export class BuffComp extends Component {
buff_cd:number=0;
wind_cd:number=0;
speek_time:number=0;
HeroView:HeroViewComp=null!
hp_bar:any=null
timer:Timer=new Timer(2);
buff_keys:any[]=["by1","by2","by3"]
@@ -45,11 +43,9 @@ export class BuffComp extends Component {
}
info_init(){
this.HeroView=this.node.getComponent(HeroViewComp)
this.top_node = this.node.getChildByName("top");
let hp_y=this.node.getComponent(UITransform).height
this.top_node.setPosition(0,hp_y,0)
this.hp_bar=this.top_node.getChildByName("hp").getComponent(ProgressBar)
// this.top_node.getChildByName("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false)
// this.vmdata_update()
@@ -60,7 +56,7 @@ export class BuffComp extends Component {
}
update(deltaTime: number) {
if(smc.mission.pause) return
this.hp_show()
if(this.wind_cd > 0 ) this.wind_cd -= deltaTime;
if(this.wind_cd <= 0 && this.node.getChildByName("wind").active){
this.node.getChildByName("wind").active = false;
@@ -75,15 +71,7 @@ export class BuffComp extends Component {
// this.in_speek(deltaTime)
// this.vmdata_update()
}
hp_show(){
// if(this.node.getComponent(HeroViewComp).fac == 0) return
let hp=this.HeroView.currentHp;
let hp_max=this.HeroView.currentHpMax;
let hp_progress= hp/hp_max;
this.hp_bar.progress = hp_progress;
if(this.HeroView.is_boss) return
this.top_node.getChildByName("hp").active = (hp == hp_max) ? false : true;
}
show_shield(val:boolean){
this.node.getChildByName("shielded").active=val
}
@@ -133,20 +121,20 @@ export class BuffComp extends Component {
var path = "game/skills/dead";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.setScale(node.scale.x*0.5,node.scale.y*0.5)
let pos = v3(this.node.position.x,this.node.position.y+30,this.node.position.z);
node.parent = this.node.parent;
node.setPosition(pos);
}
in_atked(anm:string="atked") {
in_atked(anm:string="atked",scale:number=1) {
var path = "game/skills/"+anm;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
let pos =v3(15,30);
node.setPosition(pos)
node.parent = this.node;
node.setScale(node.scale.x*scale,node.scale.y)
node.setPosition(this.node.position.x,this.node.position.y+30,this.node.position.z)
node.parent = this.node.parent;
}
in_iced(t:number=1,ap:number=0) {
console.log("[buffcomp]:in_iced",this.HeroView.hero_name,t,ap)
var path = "game/skills/iced";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
@@ -166,7 +154,8 @@ export class BuffComp extends Component {
var path = "game/skills/yun";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.setPosition(v3(0,0));
let height=this.node.getComponent(UITransform).height
node.setPosition(v3(0,height));
node.getComponent(timedCom).time = t;
node.getComponent(timedCom).ap = ap;
node.parent = this.node;

View File

@@ -228,8 +228,16 @@ export class HeroViewComp extends CCComp {
this.in_stop(dt);
// 处理伤害队列
this.processDamageQueue();
}
hp_show(){
// if(this.node.getComponent(HeroViewComp).fac == 0) return
let hp=this.currentHp;
let hp_max=this.currentHpMax;
let hp_progress= hp/hp_max;
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar).progress = hp_progress;
// this.node.getChildByName("top").getChildByName("hp").active = (hp == hp_max) ? false : true;
}
get isActive() {
@@ -343,17 +351,15 @@ export class HeroViewComp extends CCComp {
switch(buff){
case BuffAttr.ATK:
this.ap=this.check_atrr(BuffAttr.ATK)
break
case BuffAttr.ATK_CD:
this.cd=this.check_atrr(BuffAttr.ATK_CD)
break
case BuffAttr.HP:
let diff=this.check_atrr(BuffAttr.HP)-this.currentHpMax
this.currentHpMax=this.check_atrr(BuffAttr.HP)
this.currentHp+=diff
let diff=this.check_atrr(BuffAttr.HP)-this.currentHpMax
this.currentHpMax=this.check_atrr(BuffAttr.HP)
this.currentHp+=diff
this.hp_show()
break
}
}
@@ -409,6 +415,7 @@ export class HeroViewComp extends CCComp {
this.currentHp+=real_hp;
this.BUFFCOMP.tooltip(TooltipTypes.health,real_hp.toFixed(0));
}
this.hp_show()
// this.update_vm
}
@@ -636,13 +643,28 @@ export class HeroViewComp extends CCComp {
}else{
this.ent.destroy();
}
}
// this.update_vm
this.back()
this.showDamage(damage, is_crit,atked_anm);
}
//后退
back(){
if(this.fac==FacSet.MON) {
let tx=this.node.position.x+5
if(tx > 320) tx=320
tween(this.node).to(0.1, { position:v3(tx,this.node.position.y,0)}).start()
}
if(this.fac==FacSet.HERO) {
let tx=this.node.position.x-5
if(tx < -320) tx=-320
tween(this.node).to(0.1, { position:v3(tx,this.node.position.y,0)}).start()
}
}
//伤害计算 debuff 易伤
count_damage(remainingDamage:number){
let damage = 0;
@@ -840,7 +862,8 @@ export class HeroViewComp extends CCComp {
/** 立即显示伤害效果 */
private showDamageImmediate(damage: number, isCrit: boolean,anm:string="atked") {
// this.as.atked()
this.BUFFCOMP.in_atked(anm)
this.hp_show()
this.BUFFCOMP.in_atked(anm,this.fac==FacSet.HERO?1:-1)
this.atked_count++;
if (isCrit) {
this.BUFFCOMP.hp_tip(TooltipTypes.crit, damage.toFixed(0), damage);