去掉了 技能系统,技能由单个精灵独立处理
This commit is contained in:
@@ -18,10 +18,25 @@ export class CardComp extends CCComp {
|
||||
c_uuid:number=0;
|
||||
c_type:number=0;
|
||||
is_used:boolean=false;
|
||||
|
||||
onLoad(){
|
||||
this.on(GameEvent.CardRefresh,this.onCardRefresh,this)
|
||||
this.on(GameEvent.MissionStart,this.mission_start,this)
|
||||
this.on(GameEvent.MissionEnd,this.mission_end,this)
|
||||
this.on(GameEvent.CardRefresh,this.onHandler,this)
|
||||
this.on(GameEvent.MissionStart,this.onHandler,this)
|
||||
this.on(GameEvent.MissionEnd,this.onHandler,this)
|
||||
}
|
||||
/** 全局消息逻辑处理 */
|
||||
private onHandler(event: string, args: any) {
|
||||
switch (event) {
|
||||
case GameEvent.CardRefresh:
|
||||
this.onCardRefresh(event,args)
|
||||
break;
|
||||
case GameEvent.MissionStart:
|
||||
this.mission_start(event,args)
|
||||
break;
|
||||
case GameEvent.MissionEnd:
|
||||
this.mission_end(event,args)
|
||||
break;
|
||||
}
|
||||
}
|
||||
start() {
|
||||
this.init_card()
|
||||
@@ -31,10 +46,10 @@ export class CardComp extends CCComp {
|
||||
this.node.getChildByName("Button").active=false
|
||||
this.node.getChildByName("show").active=false
|
||||
}
|
||||
mission_start(){
|
||||
mission_start(event: string, args: any){
|
||||
|
||||
}
|
||||
mission_end(){
|
||||
mission_end(event: string, args: any){
|
||||
|
||||
}
|
||||
onCardRefresh(event: string, args: any){
|
||||
|
||||
30
assets/script/game/map/CardsComp.ts
Normal file
30
assets/script/game/map/CardsComp.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { _decorator } 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 { GameEvent } from "../common/config/GameEvent";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('CardsCompComp')
|
||||
@ecs.register('CardsComp', false)
|
||||
export class CardsCompComp extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
this.on(GameEvent.FightReady, this.onHandler, this);
|
||||
}
|
||||
|
||||
/** 全局消息逻辑处理 */
|
||||
private onHandler(event: string, args: any) {
|
||||
switch (event) {
|
||||
case GameEvent.FightReady:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/map/CardsComp.ts.meta
Normal file
9
assets/script/game/map/CardsComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "62b3677d-829c-4ccf-917c-8458242e255f",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/
|
||||
import { VictoryComp } from "./VictoryComp";
|
||||
import { CardControllerComp } from "./CardController";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { Hero } from "../hero/Hero";
|
||||
import { HartModelComp } from "../hero/HartModelComp";
|
||||
@@ -108,7 +107,6 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
|
||||
private cleanComponents() {
|
||||
ecs.query(ecs.allOf(HeroSkillsComp)).forEach(entity => {entity.remove(HeroSkillsComp);entity.destroy()});
|
||||
ecs.query(ecs.allOf(HeroViewComp)).forEach(entity => {entity.remove(HeroViewComp);entity.destroy()});
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ const { ccclass, property } = _decorator;
|
||||
export class MissionHeroCompComp extends CCComp {
|
||||
timer:Timer=new Timer(2)
|
||||
start_pos:any={
|
||||
0:{pos:v3(-50,135,0),has:false},
|
||||
0:{pos:v3(-50,0,0),has:false},
|
||||
1:{pos:v3(-170,205,0),has:false},
|
||||
2:{pos:v3(-170,65,0),has:false},
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export class MissionMonCompComp extends CCComp {
|
||||
// 添加刷怪队列
|
||||
private monsterQueue: Array<{uuid: number, position: number, isBoss: boolean}> = [];
|
||||
private isSpawning: boolean = false;// 是否正在生成怪物
|
||||
private spawnInterval: number = 0.5; // 每个怪物生成间隔时间
|
||||
private spawnInterval: number = 1; // 每个怪物生成间隔时间
|
||||
private spawnTimer: number = 0; // 生成计时器
|
||||
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
@@ -49,7 +49,7 @@ export class MissionMonCompComp extends CCComp {
|
||||
|
||||
|
||||
mon_refresh(){
|
||||
let positions = [0, 1, 2, 3];
|
||||
let positions = [0, 1, 2];
|
||||
positions.forEach(pos => {
|
||||
let x = RandomManager.instance.getRandomInt(0, Missions[0].length, 1);
|
||||
this.addToSpawnQueue(Missions[0][x], pos, false);
|
||||
|
||||
Reference in New Issue
Block a user