import { _decorator, v3, Vec3 } from "cc"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { Monster } from "../hero/Mon"; import { BoxSet } from "../common/config/BoxSet"; import { HeroSet } from "../common/config/heroSet"; import { Missions } from "../common/config/MissionSet"; import { RandomManager } from "db://oops-framework/core/common/random/RandomManager"; import { Timer } from "db://oops-framework/core/common/timer/Timer"; const { ccclass, property } = _decorator; /** 视图层对象 */ @ccclass('MissionMonCompComp') @ecs.register('MissionMonComp', false) export class MissionMonCompComp extends CCComp { timer:Timer=new Timer(5) /** 视图层逻辑代码分离演示 */ start() { // var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象 // this.on(ModuleEvent.Cmd, this.onHandler, this); this.test_call() } protected update(dt: number): void { // if(this.timer.update(dt)){ // this.mon_refresh() // } } test_call(){ this.addMonster(5202,0,true) } mon_refresh(){ let num =3 let t_num= Missions[0].length let y_num= Missions[1].length let b_num= Missions[2].length let tc=1 let yc=2 let bc=1 for(let i=0;i(Monster); let scale = -1 let pos:Vec3 = v3(-1*HeroSet.StartPos[1]+i*10,BoxSet.GAME_LINE); mon.load(pos,scale,uuid,is_boss); } /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ reset() { this.node.destroy(); } }