复活完成
This commit is contained in:
@@ -2,7 +2,7 @@ import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label ,Node,Prefab,insta
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { HeroSpine } from "./HeroSpine";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { BoxSet, FacSet } from "../common/config/BoxSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { SkillSet, TargetGroup, TargetType } from "../common/config/SkillSet";
|
||||
@@ -76,7 +76,8 @@ export class HeroViewComp extends CCComp {
|
||||
dir_y:number = 0;
|
||||
speek_time:number = 0;
|
||||
is_stop_temp:boolean = false;i
|
||||
|
||||
Friend_alive_cd:Timer=new Timer(10)
|
||||
|
||||
private damageQueue: Array<{
|
||||
damage: number,
|
||||
isCrit: boolean,
|
||||
@@ -92,28 +93,10 @@ export class HeroViewComp extends CCComp {
|
||||
this.FIGHTCON=this.node.parent.getComponent(FightConComp);
|
||||
console.log("hero view comp ",this.FIGHTCON)
|
||||
this.on(GameEvent.ChangeATK,this.change_atk,this)
|
||||
this.on(GameEvent.ChangeATK_EQUIP_SPECIAL_ATTR,this.change_equip_special_attr,this)
|
||||
// let anm = this.node.getChildByName("anm")
|
||||
// anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
|
||||
// 注册单个碰撞体的回调函数
|
||||
|
||||
// let collider = this.getComponent(Collider2D);
|
||||
// collider.group = this.box_group;
|
||||
// // console.log("hero collider ",this.scale,collider);
|
||||
// if (collider) {
|
||||
// collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
// // collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
|
||||
// collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
|
||||
// // collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
// }
|
||||
|
||||
}
|
||||
// onBeginContact (seCol: Collider2D, oCol: Collider2D) {
|
||||
// console.log("碰撞开始 ",this.scale,seCol,oCol);
|
||||
// }
|
||||
// onEndContact (seCol: Collider2D, oCol: Collider2D) { console.log("碰撞结束 ",this.scale,seCol,oCol);}
|
||||
// onPreSolve (seCol: Collider2D, oCol: Collider2D) {console.log("碰撞预处理 ",this.scale,seCol,oCol);}
|
||||
// onPostSolve (seCol: Collider2D, oCol: Collider2D) {console.log("碰撞后处理 ",this.scale,seCol,oCol); }
|
||||
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start () {
|
||||
this.as.idle()
|
||||
@@ -127,7 +110,7 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
/* 显示角色血量 */
|
||||
this.node.getChildByName("top").getChildByName("hp").active = true;
|
||||
// console.log("hero parent",this.node.parent)
|
||||
this.Friend_alive_cd=new Timer(FightSet.FRIEND_LIVE_CD)
|
||||
}
|
||||
update(dt: number){
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
@@ -135,6 +118,12 @@ export class HeroViewComp extends CCComp {
|
||||
// this.ent.destroy();
|
||||
// return
|
||||
// }
|
||||
if(this.is_dead) {
|
||||
if(this.Friend_alive_cd.update(dt)){
|
||||
console.log("alive friend")
|
||||
this.to_alive()
|
||||
}
|
||||
}
|
||||
if(this.timer.update(dt)){
|
||||
// this.add_ap(10)
|
||||
};
|
||||
@@ -149,7 +138,17 @@ export class HeroViewComp extends CCComp {
|
||||
this.in_stop(dt);
|
||||
// 处理伤害队列
|
||||
this.processDamageQueue();
|
||||
}
|
||||
}
|
||||
|
||||
change_equip_special_attr(e:GameEvent,data:any){
|
||||
console.log("change_equip_special_attr",data)
|
||||
this.up_friend_alive_cd(data.friend_live_cd_less)
|
||||
}
|
||||
|
||||
up_friend_alive_cd(less:number){
|
||||
this.Friend_alive_cd=new Timer(FightSet.FRIEND_LIVE_CD-less)
|
||||
}
|
||||
|
||||
change_atk(e:GameEvent,data:any){
|
||||
switch(data){
|
||||
case EquipSpecialAttr.ICE:
|
||||
@@ -296,10 +295,17 @@ export class HeroViewComp extends CCComp {
|
||||
this.hp -= remainingDamage;
|
||||
if(this.hp <= 0) {
|
||||
if(this == null) return;
|
||||
this.is_dead=true
|
||||
this.BUFFCOMP.dead()
|
||||
this.do_dead()
|
||||
console.log("[HeroViewComp]:dead,fac => "+(this.fac==FacSet.HERO?"hero":"monster"))
|
||||
if(this.ent == null) return;
|
||||
this.ent.destroy();
|
||||
|
||||
if(this.fac ==FacSet.HERO){
|
||||
this.to_grave()
|
||||
}else{
|
||||
this.ent.destroy();
|
||||
}
|
||||
}
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
this.showDamage(remainingDamage, true);
|
||||
@@ -309,10 +315,21 @@ export class HeroViewComp extends CCComp {
|
||||
this.BUFFCOMP.dead()
|
||||
this.to_drop()
|
||||
|
||||
}
|
||||
to_grave(){
|
||||
tween(this.node).to(0.5, { position:v3(-900,this.node.position.y+300,0)},{
|
||||
onComplete: (target?: object) => {
|
||||
this.node.setPosition(-900,this.node.position.y-300,0)
|
||||
}
|
||||
}
|
||||
).start()
|
||||
}
|
||||
to_alive(){
|
||||
this.is_dead=false
|
||||
this.node.setPosition(HeroPos[0].pos)
|
||||
this.hp=this.hp_max
|
||||
this.BUFFCOMP.update_info_hp()
|
||||
this.node.setPosition(HeroPos[this.fight_pos].pos)
|
||||
this.BUFFCOMP.heathed()
|
||||
}
|
||||
//掉落物品
|
||||
to_drop(){
|
||||
|
||||
Reference in New Issue
Block a user