去掉hartmodel
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { CCComp } from "db://oops-framework/module/common/CCComp";
|
||||
import { MissionEvent } from "../common/config/MissionEvent";
|
||||
import { SkillConComp } from "./SkillConComp";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { _decorator } from "cc";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
/**
|
||||
* 角色属性数据
|
||||
*/
|
||||
@ccclass('HartMode')
|
||||
@ecs.register('HartModelComp')
|
||||
export class HartModelComp extends CCComp {
|
||||
SkillCon:SkillConComp
|
||||
onLoad(){
|
||||
console.log("HartModel加载",this)
|
||||
this.on(GameEvent.FightReady,this.start,this)
|
||||
this.on(GameEvent.CastHeroSkill,this.cast_skill,this)
|
||||
}
|
||||
start(){
|
||||
this.SkillCon=this.node.getComponent(SkillConComp)
|
||||
console.log("hart start",this.SkillCon)
|
||||
}
|
||||
|
||||
cast_skill(e:string,uuid:any){
|
||||
console.log("hart cast_skill",uuid ,e)
|
||||
const config = SkillSet[uuid];
|
||||
this.SkillCon.castSkill(config)
|
||||
}
|
||||
|
||||
reset() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"a32cd4cd-7797-4ef0-bf2d-bd3168fbd0cc","files":[],"subMetas":{},"userData":{}}
|
||||
@@ -7,7 +7,6 @@ import { HeroViewComp } from "./HeroViewComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
||||
import { HartModelComp } from "./HartModelComp";
|
||||
import { SkillConComp } from "./SkillConComp";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`Hero`)
|
||||
@@ -29,10 +28,10 @@ export class Hero extends ecs.Entity {
|
||||
this.remove(HeroModelComp);
|
||||
super.destroy();
|
||||
}
|
||||
hart_load() {
|
||||
hart_load(uuid:number=5001) {
|
||||
console.log("主体加载")
|
||||
let box_group=BoxSet.HERO
|
||||
var path = "game/heros/hart";
|
||||
var path = "game/heros/"+HeroInfo[uuid].path;
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
var scene = smc.map.MapView.scene;
|
||||
@@ -40,24 +39,25 @@ export class Hero extends ecs.Entity {
|
||||
let pos=v3(-277,0,0)
|
||||
node.setPosition(pos)
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||
hv.scale = 1;
|
||||
hv.fac = 0;
|
||||
hv.type = 0;
|
||||
hv.is_master=true;
|
||||
hv.type = hero.type;
|
||||
hv.box_group = box_group;
|
||||
hv.hero_uuid= 9999;
|
||||
hv.hero_name= "主体";
|
||||
hv.speed =hv.ospeed = 0;
|
||||
hv.dis = 0;
|
||||
hv.hp= hv.hp_max =5;
|
||||
hv.ap = 0;
|
||||
hv.lv=0
|
||||
hv.cd = 9999
|
||||
hv.ap_u=0
|
||||
hv.ap_ur=0
|
||||
hv.hp_up=0
|
||||
hv.atk_skill=0
|
||||
hv.hero_uuid= uuid;
|
||||
hv.hero_name= hero.name;
|
||||
hv.speed =hv.ospeed = hero.speed;
|
||||
hv.dis = hero.dis;
|
||||
hv.hp= hv.hp_max =hero.hp;
|
||||
hv.ap = hero.ap;
|
||||
hv.lv=1
|
||||
hv.cd = hero.a_cd
|
||||
hv.ap_u=hero.ap_u
|
||||
hv.ap_ur=hero.ap_ur
|
||||
hv.hp_up=hero.hp_up
|
||||
hv.atk_skill=hero.skills[0]
|
||||
this.add(hv);
|
||||
this.add(HartModelComp)
|
||||
}
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,info:any={ap:0,hp:0},fight_pos:number=0) {
|
||||
|
||||
@@ -17,13 +17,8 @@ const { ccclass, property } = _decorator;
|
||||
@ecs.register('HeroView', false) // 定义为 ECS 组件
|
||||
export class HeroViewComp extends CCComp {
|
||||
BUFFCOMP:BuffComp=null!
|
||||
enemy_pos:Vec3=null!
|
||||
// enemy:any=null!;
|
||||
as: HeroSpine = null!
|
||||
anm_timer:Timer = new Timer(0.3);
|
||||
anm_name="idle"
|
||||
status:String = "idle"
|
||||
|
||||
hero_uuid:number = 1001;
|
||||
hero_name : string = "hero";
|
||||
fight_pos:number=0;
|
||||
@@ -36,12 +31,13 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
box_group:number = BoxSet.HERO;
|
||||
|
||||
|
||||
is_dead:boolean = false; //是否摧毁
|
||||
is_stop:boolean = false;
|
||||
is_atking:boolean = false;
|
||||
|
||||
is_boss:boolean = false;
|
||||
is_big_boss:boolean = false;
|
||||
is_master:boolean =false;
|
||||
ap_u:number=0;
|
||||
ap_ur:number=0;
|
||||
hp_up:number=0;
|
||||
@@ -258,8 +254,8 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
do_dead(){
|
||||
console.log("角色死亡",this.hero_uuid)
|
||||
if(this.hero_uuid == 9999){
|
||||
console.log("任务失败")
|
||||
if(this.is_master){
|
||||
console.log("英雄死亡")
|
||||
oops.message.dispatchEvent(GameEvent.FightEnd,this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ export class SkillConComp extends CCComp {
|
||||
}
|
||||
onLoad(){
|
||||
this.HeroView=this.node.getComponent(HeroViewComp)
|
||||
console.log(this.HeroView.uuid+"=>"+this.HeroView.hero_name+"=> SkillConComp onLoad")
|
||||
// console.log(this.HeroView.uuid+"=>"+this.HeroView.hero_name+"=> SkillConComp onLoad")
|
||||
this.on(GameEvent.CastHeroSkill,this.cast_master_skill,this)
|
||||
}
|
||||
start() {
|
||||
this.HeroView=this.node.getComponent(HeroViewComp)
|
||||
console.log(this.HeroView.uuid+"=>"+this.HeroView.hero_name+"=> SkillConComp start")
|
||||
// console.log(this.HeroView.uuid+"=>"+this.HeroView.hero_name+"=> SkillConComp start")
|
||||
this.HeroEntity=this.HeroView.ent
|
||||
}
|
||||
|
||||
@@ -41,6 +41,14 @@ export class SkillConComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
cast_master_skill(e:string,uuid:any){
|
||||
if(!this.HeroView) return
|
||||
if(!this.HeroView.is_master) return
|
||||
console.log("hart cast_skill",uuid ,e)
|
||||
const config = SkillSet[uuid];
|
||||
this.castSkill(config)
|
||||
}
|
||||
|
||||
/** 施放技能 */
|
||||
castSkill(config: typeof SkillSet[keyof typeof SkillSet]) {
|
||||
// console.log(view.uuid+"=>"+view.hero_name+"施放技能:"+config.uuid);
|
||||
|
||||
Reference in New Issue
Block a user