hero 根据type 确定出生点
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
export const HeroSet = {
|
||||
export const HeroInfo = {
|
||||
9001: {
|
||||
uuid: 9001, path: "k1", type: 1, lv: 1,name: "白骑士", wp:1001,arm:2001,ring:3001,shoes:4001,
|
||||
exp_type:0,lv2:5,lv3:10,lv4:20,lv5:30,a_exp:1,ua_exp:1,d_exp:10,ed_exp:1,
|
||||
@@ -18,4 +18,12 @@ export const HeroSet = {
|
||||
export const MonSet = {
|
||||
|
||||
|
||||
}
|
||||
export const HeroSet = {
|
||||
StartPos:{
|
||||
1: -200,
|
||||
2: -250,
|
||||
3: -300,
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,7 +89,6 @@ export class HeroViewComp extends CCComp {
|
||||
crit_rate: number = 0;//暴击伤害加成
|
||||
dodge: number = 10; //闪避率
|
||||
|
||||
|
||||
shield:number = 0; //护盾,免伤1次减1
|
||||
speed: number = 100; /** 角色移动速度 */
|
||||
ospeed: number = 100; /** 角色初始速度 */
|
||||
@@ -97,10 +96,6 @@ export class HeroViewComp extends CCComp {
|
||||
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,7 +627,10 @@ 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;
|
||||
|
||||
@@ -12,7 +12,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { LoadingViewComp } from "./view/LoadingViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { MonSet, HeroSet } from "../common/config/heroSet";
|
||||
import { MonSet, HeroInfo } from "../common/config/heroSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { Sitems } from "../common/config/ItemSet";
|
||||
|
||||
@@ -86,7 +86,7 @@ export class Initialize extends ecs.Entity {
|
||||
/** 加载完成进入游戏内容加载界面 */
|
||||
private onComplete(queue: AsyncQueue) {
|
||||
queue.complete = () => {
|
||||
smc.heros = HeroSet;
|
||||
smc.heros = HeroInfo;
|
||||
smc.monsters=MonSet;
|
||||
// console.log("加载完成!",smc.heros);
|
||||
smc.skills=SkillSet;
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Boss} from "../Boss/Boss";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { Talents } from "../common/config/TalentSet";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { HeroSet } from "../common/config/heroSet";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -159,10 +160,7 @@ export class MapMonsterComp extends CCComp {
|
||||
return
|
||||
}
|
||||
let m:any = RandomManager.instance.getRandomByObjectList(this.mission_list[this.monster_level],1)
|
||||
var scene = smc.map.MapView.scene;
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
this.addMonster(m[0],monster_layer,pos)
|
||||
this.addMonster(m[0])
|
||||
this.mon_index += 1
|
||||
if(this.mon_index>2){
|
||||
this.mon_index = 0
|
||||
@@ -184,7 +182,7 @@ export class MapMonsterComp extends CCComp {
|
||||
var scene = smc.map.MapView.scene;
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
this.addMonster(args.uuid,monster_layer,pos)
|
||||
this.addMonster(args.uuid)
|
||||
}
|
||||
set_start_point(){
|
||||
// this.start_p.setPosition(-240,BoxSet.GAME_LINE+this.start_ys[this.hero_index]+30,0)
|
||||
@@ -218,18 +216,17 @@ export class MapMonsterComp extends CCComp {
|
||||
/** 添加玩家 */
|
||||
private addHero(uuid:number=1001) {
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
var scene = smc.map.MapView.scene;
|
||||
let pos:Vec3 = v3(-210-this.hero_x*30,BoxSet.GAME_LINE);
|
||||
let monster_layer = scene.entityLayer!.node!
|
||||
let scale = 1
|
||||
hero.load(pos,scale,uuid,monster_layer);
|
||||
let pos:Vec3 = v3(HeroSet[smc.heros[uuid].type],BoxSet.GAME_LINE);
|
||||
hero.load(pos,scale,uuid);
|
||||
this.set_start_point()
|
||||
}
|
||||
private addMonster(uuid:number=1001,layer:any,pos:Vec3=v3(0,0,0)) {
|
||||
private addMonster(uuid:number=1001) {
|
||||
let monster = ecs.getEntity<Hero>(Hero);
|
||||
let scale = -1
|
||||
let index = -1
|
||||
monster.load(pos,scale,uuid,layer,index,false);
|
||||
let pos:Vec3 = v3(-1*HeroSet[smc.heros[uuid].type],BoxSet.GAME_LINE);
|
||||
monster.load(pos,scale,uuid,index,false);
|
||||
}
|
||||
|
||||
load_boss(){
|
||||
|
||||
@@ -16,7 +16,7 @@ import { MonSpine } from "./MonSpine";
|
||||
import { MonViewComp } from "./MonViewComp";
|
||||
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";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`Mon`)
|
||||
export class Mon extends ecs.Entity {
|
||||
|
||||
Reference in New Issue
Block a user