dd
This commit is contained in:
1730
assets/resources/game/heros/hart.prefab
Normal file
1730
assets/resources/game/heros/hart.prefab
Normal file
File diff suppressed because it is too large
Load Diff
13
assets/resources/game/heros/hart.prefab.meta
Normal file
13
assets/resources/game/heros/hart.prefab.meta
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.1.50",
|
||||||
|
"importer": "prefab",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "0828a791-6a59-42fe-8703-bcf1b96d8980",
|
||||||
|
"files": [
|
||||||
|
".json"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {
|
||||||
|
"syncNodeName": "hart"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,5 +21,7 @@ export enum GameEvent {
|
|||||||
UseSkillCard = "UseSkillCard",
|
UseSkillCard = "UseSkillCard",
|
||||||
CallHero = "CallHero",
|
CallHero = "CallHero",
|
||||||
MissionSkill = "MissionSkill",
|
MissionSkill = "MissionSkill",
|
||||||
|
MissionLoss = "MissionLoss",
|
||||||
|
MissionWin = "MissionWin",
|
||||||
|
|
||||||
}
|
}
|
||||||
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("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("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false)
|
||||||
this.top_node.getChildByName("sboss").active=this.node.getComponent(HeroViewComp).is_boss
|
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("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("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)
|
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 { HeroInfo } from "../common/config/heroSet";
|
||||||
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
||||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||||
|
import { HartModelComp } from "./HartModelComp";
|
||||||
/** 角色实体 */
|
/** 角色实体 */
|
||||||
@ecs.register(`Hero`)
|
@ecs.register(`Hero`)
|
||||||
|
|
||||||
@@ -27,7 +28,36 @@ export class Hero extends ecs.Entity {
|
|||||||
this.remove(HeroViewComp);
|
this.remove(HeroViewComp);
|
||||||
super.destroy();
|
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) {
|
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)
|
console.log("英雄加载:",uuid,pos,scale,info)
|
||||||
@@ -63,8 +93,6 @@ export class Hero extends ecs.Entity {
|
|||||||
const move = this.get(BattleMoveComp);
|
const move = this.get(BattleMoveComp);
|
||||||
move.direction = 1; // 向右移动
|
move.direction = 1; // 向右移动
|
||||||
move.targetX = 800; // 右边界'
|
move.targetX = 800; // 右边界'
|
||||||
|
|
||||||
|
|
||||||
oops.message.dispatchEvent("hero_load",this)
|
oops.message.dispatchEvent("hero_load",this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import { HeroSet } from "../common/config/heroSet";
|
|||||||
import { BuffComp } from "./BuffComp";
|
import { BuffComp } from "./BuffComp";
|
||||||
import { getMonsterDrops, MonsterType } from "../common/config/RewardSet";
|
import { getMonsterDrops, MonsterType } from "../common/config/RewardSet";
|
||||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||||
|
import { oops } from "db://oops-framework/core/Oops";
|
||||||
|
import { GameEvent } from "../common/config/GameEvent";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
|
|
||||||
@@ -287,6 +289,9 @@ export class HeroViewComp extends CCComp {
|
|||||||
dead(){
|
dead(){
|
||||||
this.BUFFCOMP.dead()
|
this.BUFFCOMP.dead()
|
||||||
this.to_drop()
|
this.to_drop()
|
||||||
|
if(this.hero_uuid == 9999){
|
||||||
|
oops.message.dispatchEvent(GameEvent.MissionLoss,this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//掉落物品
|
//掉落物品
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import { CardControllerComp } from "./CardController";
|
|||||||
import { GameEvent } from "../common/config/GameEvent";
|
import { GameEvent } from "../common/config/GameEvent";
|
||||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||||
|
import { Hero } from "../hero/Hero";
|
||||||
|
import { HartModelComp } from "../hero/HartModelComp";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
/** 视图层对象 */
|
/** 视图层对象 */
|
||||||
@@ -111,6 +113,8 @@ export class MissionComp extends CCComp {
|
|||||||
hp:0,//血量
|
hp:0,//血量
|
||||||
ap:0,//攻击
|
ap:0,//攻击
|
||||||
}
|
}
|
||||||
|
let hero = ecs.getEntity<Hero>(Hero);
|
||||||
|
hero.hart_load()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { HeroModelComp } from "../hero/HeroModelComp";
|
|||||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||||
import { oops } from "db://oops-framework/core/Oops";
|
import { oops } from "db://oops-framework/core/Oops";
|
||||||
import { FightSet } from "../common/config/Mission";
|
import { FightSet } from "../common/config/Mission";
|
||||||
|
import { HartModelComp } from "../hero/HartModelComp";
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@@ -21,9 +22,9 @@ const { ccclass, property } = _decorator;
|
|||||||
export class MissionHeroCompComp extends CCComp {
|
export class MissionHeroCompComp extends CCComp {
|
||||||
timer:Timer=new Timer(2)
|
timer:Timer=new Timer(2)
|
||||||
start_pos:any={
|
start_pos:any={
|
||||||
0:{pos:v3(-150,135,0),has:false},
|
0:{pos:v3(-50,135,0),has:false},
|
||||||
1:{pos:v3(-270,205,0),has:false},
|
1:{pos:v3(-170,205,0),has:false},
|
||||||
2:{pos:v3(-270,65,0),has:false},
|
2:{pos:v3(-170,65,0),has:false},
|
||||||
}
|
}
|
||||||
current_hero_uuid:number=0
|
current_hero_uuid:number=0
|
||||||
onLoad(){
|
onLoad(){
|
||||||
@@ -57,7 +58,7 @@ export class MissionHeroCompComp extends CCComp {
|
|||||||
this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos2").getChildByName("hero").active=false
|
this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos2").getChildByName("hero").active=false
|
||||||
this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos3").getChildByName("hero").active=false
|
this.node.getChildByName("location").getChildByName("herospos").getChildByName("heropos3").getChildByName("hero").active=false
|
||||||
|
|
||||||
let heros=ecs.query(ecs.allOf(HeroModelComp))
|
let heros=ecs.query(ecs.allOf(HeroModelComp).excludeOf(HartModelComp))
|
||||||
for(let hero of heros){
|
for(let hero of heros){
|
||||||
let hv = hero.get(HeroViewComp)
|
let hv = hero.get(HeroViewComp)
|
||||||
if(hv.fight_pos==0){
|
if(hv.fight_pos==0){
|
||||||
@@ -110,7 +111,7 @@ export class MissionHeroCompComp extends CCComp {
|
|||||||
|
|
||||||
get_info_and_remove(fight_pos:number,uuid:number){
|
get_info_and_remove(fight_pos:number,uuid:number){
|
||||||
let info:any={ap:0,hp:0,lv:0}
|
let info:any={ap:0,hp:0,lv:0}
|
||||||
let heros=ecs.query(ecs.allOf(HeroModelComp))
|
let heros=ecs.query(ecs.allOf(HeroModelComp).excludeOf(HartModelComp))
|
||||||
for(let hero of heros){
|
for(let hero of heros){
|
||||||
if(hero.get(HeroViewComp).fight_pos==fight_pos){
|
if(hero.get(HeroViewComp).fight_pos==fight_pos){
|
||||||
let hv = hero.get(HeroViewComp)
|
let hv = hero.get(HeroViewComp)
|
||||||
|
|||||||
Reference in New Issue
Block a user