dd
This commit is contained in:
@@ -123,8 +123,6 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
onLoad() {
|
||||
this.as = this.getComponent(HeroSpine);
|
||||
// this.BoxRang = this.node.getChildByName("range_box");
|
||||
// this.BoxRang = this.node.getChildByName("range_box");
|
||||
|
||||
} /** 视图层逻辑代码分离演示 */
|
||||
|
||||
@@ -138,7 +136,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.node.getChildByName("top").setScale(this.scale,1);
|
||||
/** 显示角色血量 */
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
|
||||
|
||||
// this.node.getChildByName("shielded").active = false;
|
||||
// this.node.getChildByName("top").setScale(this.scale,1);
|
||||
// this.node.getChildByName("atk").setScale(this.scale,1);
|
||||
@@ -186,13 +184,13 @@ export class HeroViewComp extends CCComp {
|
||||
if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){
|
||||
|
||||
if(selfCollider.group==BoxSet.HERO){
|
||||
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x < other_x && Math.abs(other_x-self_x) < 20 ){
|
||||
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x < other_x && Math.abs(other_x-self_x) < 50 ){
|
||||
// this.node.setSiblingIndex(otherCollider.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) < 20 ){
|
||||
if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x > other_x && Math.abs(other_x-self_x) < 50 ){
|
||||
// this.node.setSiblingIndex(otherCollider.node.getSiblingIndex()-10)
|
||||
this.stop_cd = 0.1;
|
||||
}
|
||||
@@ -221,7 +219,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.check_power()
|
||||
this.check_atk_counts()
|
||||
this.check_enemy_alive()
|
||||
this.check_mission_buf()
|
||||
this.check_mission_buff()
|
||||
|
||||
if(this.ice_cd > 0){ this.ice_cd -=dt; return }
|
||||
if(this.yun_cd > 0){ this.yun_cd -=dt; return }
|
||||
@@ -231,18 +229,8 @@ export class HeroViewComp extends CCComp {
|
||||
this.in_atk(dt);
|
||||
this.move(dt);
|
||||
}
|
||||
check_iceed(dt:number){
|
||||
if(this.ice_cd > 0){
|
||||
this.ice_cd -= dt;
|
||||
if(this.ice_cd <= 0){
|
||||
this.ice_cd = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
check_yuned(dt:number){
|
||||
|
||||
}
|
||||
check_mission_buf(){
|
||||
check_mission_buff(){
|
||||
this.ap_max=(100+smc.vmdata.mission.ap)/100*this.ap
|
||||
this.crit_max=(100+smc.vmdata.mission.crit)/100*this.crit
|
||||
this.def_max=(100+smc.vmdata.mission.def)/100*this.def
|
||||
@@ -282,22 +270,6 @@ export class HeroViewComp extends CCComp {
|
||||
this.is_atking=false
|
||||
}
|
||||
}
|
||||
//进入墓地
|
||||
to_grave(){
|
||||
let pos =v3(-999,this.node.position.y)
|
||||
if(this.box_group == BoxSet.MONSTER){
|
||||
pos =v3(999,this.node.position.y)
|
||||
smc.vmdata.mission.mdead +=1
|
||||
}else{
|
||||
smc.vmdata.mission.dead +=1
|
||||
}
|
||||
this.node.setPosition(pos)
|
||||
|
||||
}
|
||||
//是否在墓地
|
||||
in_grave(){
|
||||
return this.node.position.x < -900 || this.node.position.x > 900;
|
||||
}
|
||||
//状态切换
|
||||
status_change(type:string){
|
||||
this.status=type
|
||||
@@ -378,10 +350,8 @@ export class HeroViewComp extends CCComp {
|
||||
check_power(){
|
||||
if(this.pw >= this.pwm){
|
||||
this.pw = 0
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.BUFFCOMP.max_show()
|
||||
|
||||
this.handle_skill(this.sk2)
|
||||
return true
|
||||
}else{
|
||||
@@ -443,10 +413,7 @@ export class HeroViewComp extends CCComp {
|
||||
// console.log("攻击判断: i="+i+":akr="+this.akr);
|
||||
if(i < this.akr){
|
||||
// console.log("攻击触发: i="+i+":akr="+this.akr);
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.BUFFCOMP.max_show()
|
||||
this.handle_skill(this.sk3)
|
||||
}
|
||||
}
|
||||
@@ -457,10 +424,7 @@ export class HeroViewComp extends CCComp {
|
||||
// console.log("闪避判断: i="+i+":dgr="+this.dgr);
|
||||
if(i < this.dgr){
|
||||
// console.log("闪避触发: i="+i+":dgr="+this.dgr);
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.BUFFCOMP.max_show()
|
||||
this.handle_skill(this.sk3)
|
||||
}
|
||||
}
|
||||
@@ -472,10 +436,7 @@ export class HeroViewComp extends CCComp {
|
||||
if(i < this.crr){
|
||||
// console.log("暴击触发: i="+i+":crr="+this.crr);
|
||||
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.BUFFCOMP.max_show()
|
||||
this.handle_skill(this.sk3)
|
||||
}
|
||||
}
|
||||
@@ -485,10 +446,7 @@ export class HeroViewComp extends CCComp {
|
||||
// console.log("受伤判断:i="+i+":akr="+this.uar);
|
||||
if(i < this.uar){
|
||||
// console.log("受伤触发: i="+i+":uar="+this.uar);
|
||||
this.node.getChildByName("max").active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.node.getChildByName("max").active=false
|
||||
},0.8)
|
||||
this.BUFFCOMP.max_show()
|
||||
this.handle_skill(this.sk3)
|
||||
}
|
||||
}
|
||||
@@ -616,13 +574,14 @@ export class HeroViewComp extends CCComp {
|
||||
power_add(p:number){
|
||||
this.pw+= p
|
||||
}
|
||||
hp_max_add(){
|
||||
console.log("hp_max_add 动画");
|
||||
}
|
||||
/**
|
||||
* 增加英雄的行动点数(AP)。
|
||||
* @param ap 要增加的行动点数。
|
||||
* @param time 可选参数,表示增加行动点数的时间,默认为0。
|
||||
*/
|
||||
add_ap(ap: number,time:number=0){
|
||||
this.ap += ap;
|
||||
}
|
||||
|
||||
add_shield(shield:number){
|
||||
this.shield =shield
|
||||
console.log("shield:",shield);
|
||||
@@ -636,7 +595,7 @@ export class HeroViewComp extends CCComp {
|
||||
this.BUFFCOMP.tooltip(2,hp.toFixed(0));
|
||||
}
|
||||
add_hp_max(hp: number=0){
|
||||
this.hp_max_add()
|
||||
this.BUFFCOMP.show_buff(1)
|
||||
this.hp += hp/100*this.hp_max;
|
||||
}
|
||||
hp_less(hp: number,is_crit:boolean=false){
|
||||
@@ -675,7 +634,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
in_atked() {
|
||||
this.BUFFCOMP.in_atked()
|
||||
this.BUFFCOMP.in_atked()
|
||||
// this.as.atked();
|
||||
this.atked_count++;
|
||||
this.exp_add(this.uaexp)
|
||||
@@ -686,10 +645,24 @@ export class HeroViewComp extends CCComp {
|
||||
this.exp_add(this.dexp)
|
||||
this.power_add(this.dpw)
|
||||
}
|
||||
toDestroy(){
|
||||
|
||||
|
||||
//进入墓地
|
||||
to_grave(){
|
||||
let pos =v3(-999,this.node.position.y)
|
||||
if(this.box_group == BoxSet.MONSTER){
|
||||
pos =v3(999,this.node.position.y)
|
||||
smc.vmdata.mission.mdead +=1
|
||||
}else{
|
||||
smc.vmdata.mission.dead +=1
|
||||
}
|
||||
this.node.setPosition(pos)
|
||||
|
||||
}
|
||||
toAlive(){
|
||||
//是否在墓地
|
||||
in_grave(){
|
||||
return this.node.position.x < -900 || this.node.position.x > 900;
|
||||
}
|
||||
to_alive(){
|
||||
let pos =v3(HeroSet.StartPos[this.type],this.node.position.y,this.node.position.z)
|
||||
this.node.setPosition(pos)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user