hero 根据type 确定出生点

This commit is contained in:
2024-11-15 09:38:36 +08:00
parent d632513701
commit 425a8bac64
6 changed files with 44 additions and 38 deletions

View File

@@ -89,17 +89,12 @@ export class HeroViewComp extends CCComp {
crit_rate: number = 0;//暴击伤害加成
dodge: number = 10; //闪避率
shield:number = 0; //护盾,免伤1次减1
speed: number = 100; /** 角色移动速度 */
ospeed: number = 100; /** 角色初始速度 */
Tpos: Vec3 = v3(0,-60,0);
stop_cd: number = 0.5; /*停止倒计时*/
dir_y:number = 0;
speek_time:number = 0;
@@ -537,9 +532,10 @@ export class HeroViewComp extends CCComp {
if(this.hp <= 0){
this.dead();
this.is_dead = true;
setTimeout(() => {
this.ent.destroy();
}, 15);
// setTimeout(() => {
// this.ent.destroy();
// }, 15);
this.toDestroy()
}
}
add_atk(atk: number,time:number=0){
@@ -610,16 +606,16 @@ export class HeroViewComp extends CCComp {
}
in_atked() {
// var path = "game/skills/atked";
// var prefab: Prefab = oops.res.get(path, Prefab)!;
// var node = instantiate(prefab);
// let pos = v3(0,60)
// node.setPosition(pos)
// node.parent = this.node;
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
this.scheduleOnce(() => {
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
}, 0.1);
var path = "game/skills/atked";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
let pos = v3(0,60)
node.setPosition(pos)
node.parent = this.node;
// this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
// this.scheduleOnce(() => {
// this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
// }, 0.1);
}
@@ -631,8 +627,11 @@ export class HeroViewComp extends CCComp {
node.parent = this.node.parent;
}
toDestroy(){
this.node.setPosition(this.scale*9999,this.node.position.y)
}
toAlive(){
this.node.setPosition(-1*this.scale*BoxSet.HERO_START,this.node.position.y)
}
reset() {
this.is_dead = false;
this.node.destroy();