大招修改为攻击触发,或者受伤触发
This commit is contained in:
@@ -40,14 +40,14 @@ export class HeroViewComp extends CCComp {
|
||||
hero_uuid:number = 1001;
|
||||
hero_name : string = "hero";
|
||||
hero_type:number = 1;
|
||||
level:number =1;
|
||||
lv:number =1;
|
||||
scale: number = 1; /** 角色阵营 1:hero -1 :mon */
|
||||
type: number = 1; /**角色类型 1近战 2 远程 3 辅助 */
|
||||
|
||||
box_group:number = BoxSet.HERO;
|
||||
atk_range:number = 150;
|
||||
private timer:Timer = new Timer(1); //计时器
|
||||
|
||||
|
||||
|
||||
is_dead:boolean = false; //是否摧毁
|
||||
is_stop:boolean = false;
|
||||
@@ -66,7 +66,7 @@ export class HeroViewComp extends CCComp {
|
||||
sk3:number = 1001;
|
||||
sk4:number = 1001;
|
||||
sk5:number = 1001;
|
||||
|
||||
skr:any=[0,0,0,0,0,0];
|
||||
ap: number = 10; /**攻击力 */
|
||||
ap_buff: number = 0;
|
||||
ap_buffs:any = [];
|
||||
@@ -204,9 +204,9 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.setPosition(pos)
|
||||
return
|
||||
}
|
||||
if (this.timer.update(dt)) {
|
||||
this.power_change(this.power_speed)
|
||||
}
|
||||
// if (this.timer.update(dt)) {
|
||||
// this.power_change(this.power_speed)
|
||||
// }
|
||||
// if(this.anm_timer.update(dt)) {
|
||||
// this.change_anm()
|
||||
// }
|
||||
@@ -307,20 +307,6 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
}
|
||||
}
|
||||
|
||||
power_change(power: number){
|
||||
this.power += power;
|
||||
if(this.power >= this.power_max){
|
||||
this.as.atk()
|
||||
// this.to_speek(smc.skills[this.sk2].name)
|
||||
this.scheduleOnce(()=>{
|
||||
this.handle_skill(this.sk2);
|
||||
},0.5)
|
||||
this.power = 0
|
||||
}
|
||||
// let power_progress= this.power/this.power_max;
|
||||
// this.node.getChildByName("top").getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
|
||||
}
|
||||
skill_pos(){
|
||||
return v3(0,35)
|
||||
}
|
||||
@@ -343,6 +329,54 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
return {pos,t_pos}
|
||||
}
|
||||
|
||||
in_atk(dt: number) {
|
||||
if(this.at >= this.cd){
|
||||
if(this.is_atking){
|
||||
this.at = 0;
|
||||
// console.log("cd:"+this.cd);
|
||||
this.as.atk();
|
||||
let i = RandomManager.instance.getRandomInt(0,100,3)
|
||||
console.log("大招触发判断: i="+i+":skr="+this.skr[this.lv]);
|
||||
if(i < this.skr[this.lv]){
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.handle_skill(this.sk2)
|
||||
|
||||
return
|
||||
}
|
||||
this.scheduleOnce(()=>{
|
||||
this.shoot_enemy(this.sk1)
|
||||
},0.3)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//使用max_skill
|
||||
handle_skill(skill:number){
|
||||
|
||||
switch (smc.skills[skill].tg) {
|
||||
case 0: //自己
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
break;
|
||||
case 1: //伙伴
|
||||
this.push_least_buff(skill)
|
||||
break;
|
||||
case 2: //自己和伙伴
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
this.push_least_buff(skill)
|
||||
break;
|
||||
case 3: //敌人
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
case 4: //敌人和自己
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
}
|
||||
}
|
||||
shoot_enemy(sk1:number,y:number=0,x:number=0){
|
||||
// console.log("mon shoot_enemy");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
@@ -413,32 +447,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
}
|
||||
//使用max_skill
|
||||
handle_skill(skill:number){
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
switch (smc.skills[skill].tg) {
|
||||
case 0: //自己
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
break;
|
||||
case 1: //伙伴
|
||||
this.push_least_buff(skill)
|
||||
break;
|
||||
case 2: //自己和伙伴
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
this.push_least_buff(skill)
|
||||
break;
|
||||
case 3: //敌人
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
case 4: //敌人和自己
|
||||
this.to_add_buff(this.node.getComponent(HeroViewComp),skill)
|
||||
this.shoot_enemy(skill)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
to_speek(words:string,time:number=0.5){
|
||||
this.speek_time=0.5
|
||||
this.node.getChildByName("tooltip").active=true
|
||||
@@ -455,24 +464,9 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.getChildByName("tooltip").active=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
in_atk(dt: number) {
|
||||
if(this.at >= this.cd){
|
||||
if(this.is_atking){
|
||||
this.at = 0;
|
||||
console.log("cd:"+this.cd);
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
this.shoot_enemy(this.sk1)
|
||||
},0.4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
heathed(){
|
||||
this.node.getChildByName("heathed").active=true
|
||||
|
||||
}
|
||||
hp_max_add(){
|
||||
console.log("hp_max_add 动画");
|
||||
@@ -527,7 +521,6 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
// console.log(this.ap_buffs)
|
||||
}
|
||||
|
||||
check_atk_buffs(dt: number){
|
||||
for(let i=0;i<this.ap_buffs.length;i++){
|
||||
let buff=this.ap_buffs[i];
|
||||
@@ -545,20 +538,15 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buff_icon_change(icon:string,value:boolean){
|
||||
// this.node.getChildByName("top").getChildByName("buff").getChildByName(icon).active=value
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_shield(shield:number){
|
||||
this.shield =shield
|
||||
if(this.shield > 0){
|
||||
this.node.getChildByName("shielded").active=true
|
||||
}
|
||||
}
|
||||
|
||||
tooltip(type:number=1,value:string="",s_uuid:number=1001,y:number=60){
|
||||
// console.log("tooltip",type);
|
||||
let tip =ecs.getEntity<Tooltip>(Tooltip);
|
||||
|
||||
Reference in New Issue
Block a user