修改了很多
This commit is contained in:
@@ -89,6 +89,8 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
onLoad() {
|
||||
this.as = this.getComponent(HeroSpine);
|
||||
let anm = this.node.getChildByName("anm")
|
||||
anm.setScale(anm.scale.x*0.7,anm.scale.y*0.7);
|
||||
// 注册单个碰撞体的回调函数
|
||||
|
||||
// let collider = this.getComponent(Collider2D);
|
||||
@@ -157,12 +159,8 @@ export class HeroViewComp extends CCComp {
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("top").getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
if(this.is_boss) return
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
// if(this.hp == this.hp_max){
|
||||
// this.node.getChildByName("top").getChildByName("hp").active = false;
|
||||
// } else{
|
||||
// this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
// }
|
||||
this.node.getChildByName("top").getChildByName("hp").active = (this.hp == this.hp_max) ? false : true;
|
||||
|
||||
}
|
||||
//移动
|
||||
|
||||
@@ -265,7 +263,7 @@ export class HeroViewComp extends CCComp {
|
||||
return this.node.position.y <= -900;
|
||||
}
|
||||
to_alive(){
|
||||
let pos =v3(HeroSet.StartPos[this.type],this.node.position.y,this.node.position.z)
|
||||
let pos =v3(HeroSet.Start_x[this.type],HeroSet.Start_y[this.type],this.node.position.z)
|
||||
this.node.setPosition(pos)
|
||||
this.revive()
|
||||
}
|
||||
|
||||
@@ -78,29 +78,18 @@ export class Monster extends ecs.Entity {
|
||||
hv.hero_name= hero.name;
|
||||
hv.speed =hv.ospeed = hero.speed;
|
||||
hv.dis = hero.dis;
|
||||
hv.pw = hero.pw;
|
||||
hv.pwm= hero.pwm;
|
||||
hv.pws= hero.pws
|
||||
hv.apw=hero.apw;
|
||||
hv.uapw=hero.uapw;
|
||||
hv.cpw=hero.cpw;
|
||||
hv.dpw=hero.dpw;
|
||||
hv.dopw=hero.dopw;
|
||||
hv.hp= hv.hp_max =hero.hp*(1+(lv-1)*0.2);
|
||||
hv.ap = hero.ap*(1+(lv-1)*0.2);
|
||||
hv.def= hero.def*(1+(lv-1)*0.2);
|
||||
hv.hp= hv.hp_max =hero.hp;
|
||||
hv.ap = hero.ap;
|
||||
hv.cd = hero.a_cd
|
||||
hv.crit = hero.crit*(1+(lv-1)*0.2); //暴击率
|
||||
hv.crit_add = hero.crit_add*(1+(lv-1)*0.2);//暴击伤害加成
|
||||
hv.dodge = hero.dodge*(1+(lv-1)*0.2); //闪避率
|
||||
|
||||
hv.atk_skill=hero.skills[0]
|
||||
this.add(hv);
|
||||
// 初始化多个技能组件
|
||||
const skillsComp = this.get(HeroSkillsComp);
|
||||
// 正确初始化已有技能
|
||||
hero.skills.forEach(skillId => {
|
||||
this.addSkill(skillId); // 使用addSkill方法确保初始化
|
||||
});
|
||||
|
||||
// // 初始化多个技能组件
|
||||
// const skillsComp = this.get(HeroSkillsComp);
|
||||
// // 正确初始化已有技能
|
||||
// hero.skills.forEach(skillId => {
|
||||
// this.addSkill(skillId); // 使用addSkill方法确保初始化
|
||||
// });
|
||||
|
||||
// 初始化移动参数
|
||||
const move = this.get(BattleMoveComp);
|
||||
|
||||
Reference in New Issue
Block a user