hero 根据type 确定出生点
This commit is contained in:
@@ -16,7 +16,7 @@ import { HeroSpine } from "./HeroSpine";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { HeroSet,MonSet } from "../common/config/heroSet";
|
||||
import { HeroInfo,MonSet } from "../common/config/heroSet";
|
||||
import { Role } from "../Role/Role";
|
||||
import { MoveToComp } from "../common/ecs/position/MoveTo";
|
||||
import { Talents } from "../common/config/TalentSet";
|
||||
@@ -42,7 +42,7 @@ export class Hero extends ecs.Entity {
|
||||
}
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!,index:number=-1,is_hero:boolean=true) {
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,index:number=-1,is_hero:boolean=true) {
|
||||
let box_group= 0
|
||||
|
||||
if (is_hero) {
|
||||
@@ -58,7 +58,9 @@ export class Hero extends ecs.Entity {
|
||||
var path = "game/hero/"+smc.heros[uuid].path;
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
node.parent=layer
|
||||
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!
|
||||
|
||||
node.setPosition(pos)
|
||||
this.hero_init(uuid,node,index,scale,box_group)
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user