dd
This commit is contained in:
12
assets/script/game/hero/BossModelComp.ts
Normal file
12
assets/script/game/hero/BossModelComp.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
|
||||
/**
|
||||
* 角色属性数据
|
||||
*/
|
||||
@ecs.register('BossModel')
|
||||
export class BossModelComp extends ecs.Comp {
|
||||
|
||||
reset() {
|
||||
|
||||
}
|
||||
}
|
||||
1
assets/script/game/hero/BossModelComp.ts.meta
Normal file
1
assets/script/game/hero/BossModelComp.ts.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"fa6157bf-a254-44af-a0c0-5d16f12cd761","files":[],"subMetas":{},"userData":{}}
|
||||
@@ -42,6 +42,9 @@ export class BuffComp extends Component {
|
||||
this.top_node.getChildByName("lv").active=(this.node.getComponent(HeroViewComp).fac == 0 ? true : false)
|
||||
// this.top_node.getChildByName("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false)
|
||||
this.top_node.getChildByName("sboss").active=this.node.getComponent(HeroViewComp).is_boss
|
||||
if(this.node.getComponent(HeroViewComp).hero_uuid == 9999){
|
||||
this.top_node.getChildByName("lv").active=false
|
||||
}
|
||||
this.top_node.getChildByName("lv").getChildByName("lv").getComponent(Label)!.string = this.node.getComponent(HeroViewComp).lv.toFixed(0)
|
||||
this.top_node.getChildByName("ihp").getChildByName("num").getComponent(Label)!.string = this.node.getComponent(HeroViewComp).hp.toFixed(0)
|
||||
this.top_node.getChildByName("iap").getChildByName("num").getComponent(Label)!.string = this.node.getComponent(HeroViewComp).ap.toFixed(0)
|
||||
|
||||
15
assets/script/game/hero/HartModelComp.ts
Normal file
15
assets/script/game/hero/HartModelComp.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
|
||||
/**
|
||||
* 角色属性数据
|
||||
*/
|
||||
@ecs.register('HartModel')
|
||||
export class HartModelComp extends ecs.Comp {
|
||||
onLoad(){
|
||||
console.log("HartModel加载",this)
|
||||
}
|
||||
reset() {
|
||||
|
||||
}
|
||||
}
|
||||
1
assets/script/game/hero/HartModelComp.ts.meta
Normal file
1
assets/script/game/hero/HartModelComp.ts.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"a32cd4cd-7797-4ef0-bf2d-bd3168fbd0cc","files":[],"subMetas":{},"userData":{}}
|
||||
@@ -8,6 +8,7 @@ import { BoxSet } from "../common/config/BoxSet";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||
import { HartModelComp } from "./HartModelComp";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`Hero`)
|
||||
|
||||
@@ -27,7 +28,36 @@ export class Hero extends ecs.Entity {
|
||||
this.remove(HeroViewComp);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
hart_load() {
|
||||
console.log("主体加载")
|
||||
let box_group=BoxSet.HERO
|
||||
var path = "game/heros/hart";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!
|
||||
let pos=v3(-277,150,0)
|
||||
node.setPosition(pos)
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
hv.scale = 1;
|
||||
hv.fac = 0;
|
||||
hv.type = 0;
|
||||
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
|
||||
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) {
|
||||
console.log("英雄加载:",uuid,pos,scale,info)
|
||||
@@ -63,8 +93,6 @@ export class Hero extends ecs.Entity {
|
||||
const move = this.get(BattleMoveComp);
|
||||
move.direction = 1; // 向右移动
|
||||
move.targetX = 800; // 右边界'
|
||||
|
||||
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ import { HeroSet } from "../common/config/heroSet";
|
||||
import { BuffComp } from "./BuffComp";
|
||||
import { getMonsterDrops, MonsterType } from "../common/config/RewardSet";
|
||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
|
||||
@@ -287,6 +289,9 @@ export class HeroViewComp extends CCComp {
|
||||
dead(){
|
||||
this.BUFFCOMP.dead()
|
||||
this.to_drop()
|
||||
if(this.hero_uuid == 9999){
|
||||
oops.message.dispatchEvent(GameEvent.MissionLoss,this)
|
||||
}
|
||||
}
|
||||
|
||||
//掉落物品
|
||||
|
||||
Reference in New Issue
Block a user