场景技能 环境设置完成,下步 技能执行
This commit is contained in:
@@ -4,7 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { MSkills, MSkillset, MSlist, SkillSet } from "../common/config/SkillSet";
|
||||
import { HeroModelComp } from "../hero/HeroModelComp";
|
||||
import { RewardSet } from "../common/config/RewardSet";
|
||||
import { BoxSet, GameSet } from "../common/config/BoxSet";
|
||||
@@ -25,6 +25,7 @@ import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/
|
||||
import { HCard } from "./HCard";
|
||||
import { HCardComp } from "./HCardComp";
|
||||
import { MSkill } from "../skills/MSkill";
|
||||
import { MSkillComp } from "../skills/MSkillComp";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@@ -57,7 +58,18 @@ export class MissionComp extends CCComp {
|
||||
game_over:boolean = false;
|
||||
start_ys:any[] = [0,70,-70];
|
||||
mon_index:number = 0
|
||||
|
||||
msk:any={
|
||||
on :false,
|
||||
uuid:1001,
|
||||
type:1,
|
||||
lv: 1
|
||||
}
|
||||
mmsk:any={
|
||||
on :false,
|
||||
uuid:1001,
|
||||
type:1,
|
||||
lv: 1
|
||||
}
|
||||
onLoad(){
|
||||
|
||||
}
|
||||
@@ -91,7 +103,8 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
this.count_hero_pos()
|
||||
this.count_mon_pos()
|
||||
|
||||
this.check_exp()
|
||||
this.check_m_exp()
|
||||
// if (this.game_timer.update(dt)) {
|
||||
// smc.vm_data.game.g_time += 1;
|
||||
// }
|
||||
@@ -113,35 +126,163 @@ export class MissionComp extends CCComp {
|
||||
smc.vm_data.mission.a_exp=0 //近战经验石
|
||||
smc.vm_data.mission.b_exp=0 //远程经验石
|
||||
smc.vm_data.mission.c_exp=0 //辅助经验石
|
||||
smc.vm_data.mission.d_exp=0 //特殊经验石
|
||||
smc.vm_data.mission.ma_exp=0 //敌方近战经验石
|
||||
smc.vm_data.mission.mb_exp=0 //敌方远程经验石
|
||||
smc.vm_data.mission.mc_exp=0 //敌方辅助经验石
|
||||
smc.vm_data.mission.md_exp=0 //敌方特殊经验石
|
||||
this.call_mskill()
|
||||
this.msk={ on :false, uuid:1001,type:1,lv: 1}
|
||||
this.mmsk={ on :false, uuid:1001,type:1,lv: 1}
|
||||
this.node.getChildByName("exp").getChildByName("a_exp").active = true
|
||||
this.node.getChildByName("exp").getChildByName("b_exp").active = true
|
||||
this.node.getChildByName("exp").getChildByName("c_exp").active = true
|
||||
this.node.getChildByName("mexp").getChildByName("a_exp").active = true
|
||||
this.node.getChildByName("mexp").getChildByName("b_exp").active = true
|
||||
this.node.getChildByName("mexp").getChildByName("c_exp").active = true
|
||||
|
||||
}
|
||||
call_mskill(){
|
||||
let msk=ecs.getEntity<MSkill>(MSkill)
|
||||
let praent = this.node.getChildByName("exp").getChildByName("a_exp").getChildByName("skill")
|
||||
msk.load(1001,1,praent)
|
||||
check_exp(){
|
||||
if(!this.msk.on){
|
||||
if(smc.vm_data.mission.a_exp >= MSkillset.confirm_exp){
|
||||
this.msk.type = 1
|
||||
this.msk.on = true
|
||||
this.select_msk(1)
|
||||
this.node.getChildByName("exp").getChildByName("b_exp").active = false
|
||||
this.node.getChildByName("exp").getChildByName("c_exp").active = false
|
||||
}
|
||||
if(smc.vm_data.mission.b_exp >= MSkillset.confirm_exp){
|
||||
this.msk.type = 2
|
||||
this.msk.on = true
|
||||
this.select_msk(2)
|
||||
this.node.getChildByName("exp").getChildByName("a_exp").active = false
|
||||
this.node.getChildByName("exp").getChildByName("c_exp").active = false
|
||||
}
|
||||
if(smc.vm_data.mission.c_exp >= MSkillset.confirm_exp){
|
||||
this.msk.type = 3
|
||||
this.msk.on = true
|
||||
this.select_msk(3)
|
||||
this.node.getChildByName("exp").getChildByName("a_exp").active = false
|
||||
this.node.getChildByName("exp").getChildByName("b_exp").active = false
|
||||
}
|
||||
}else{
|
||||
switch (this.msk.type){
|
||||
case 1:
|
||||
if(smc.vm_data.mission.a_exp >= MSkills[this.msk.uuid].up_exp){
|
||||
this.msk.lv += 1
|
||||
smc.vm_data.mission.a_exp = 0
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(smc.vm_data.mission.b_exp >= MSkills[this.msk.uuid].up_exp){
|
||||
this.msk.lv += 1
|
||||
smc.vm_data.mission.b_exp = 0
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(smc.vm_data.mission.c_exp >= MSkills[this.msk.uuid].up_exp){
|
||||
this.msk.lv += 1
|
||||
smc.vm_data.mission.c_exp = 0
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
check_m_exp(){
|
||||
if(!this.mmsk.on){
|
||||
if(smc.vm_data.mission.ma_exp >= MSkillset.confirm_exp){
|
||||
this.mmsk.type = 1
|
||||
this.mmsk.on = true
|
||||
this.select_mmsk(1)
|
||||
this.node.getChildByName("mexp").getChildByName("b_exp").active = false
|
||||
this.node.getChildByName("mexp").getChildByName("c_exp").active = false
|
||||
}
|
||||
if(smc.vm_data.mission.mb_exp >= MSkillset.confirm_exp){
|
||||
this.mmsk.type = 2
|
||||
this.mmsk.on = true
|
||||
this.select_mmsk(2)
|
||||
this.node.getChildByName("mexp").getChildByName("a_exp").active = false
|
||||
this.node.getChildByName("mexp").getChildByName("c_exp").active = false
|
||||
}
|
||||
if(smc.vm_data.mission.mc_exp >= MSkillset.confirm_exp){
|
||||
this.mmsk.type = 3
|
||||
this.mmsk.on = true
|
||||
this.select_mmsk(3)
|
||||
this.node.getChildByName("mexp").getChildByName("a_exp").active = false
|
||||
this.node.getChildByName("mexp").getChildByName("b_exp").active = false
|
||||
}
|
||||
}else{
|
||||
switch (this.mmsk.type){
|
||||
case 1:
|
||||
if(smc.vm_data.mission.ma_exp >= MSkills[this.mmsk.uuid].up_exp){
|
||||
this.mmsk.lv += 1
|
||||
smc.vm_data.mission.ma_exp = 0
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(smc.vm_data.mission.mb_exp >= MSkills[this.mmsk.uuid].up_exp){
|
||||
this.mmsk.lv += 1
|
||||
smc.vm_data.mission.mb_exp = 0
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(smc.vm_data.mission.mc_exp >= MSkills[this.mmsk.uuid].up_exp){
|
||||
this.mmsk.lv += 1
|
||||
smc.vm_data.mission.mc_exp = 0
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
select_msk(type:number){
|
||||
smc.vm_data.mission.a_exp=0
|
||||
smc.vm_data.mission.b_exp=0
|
||||
smc.vm_data.mission.c_exp=0
|
||||
let sk:any=RandomManager.instance.getRandomByObjectList(MSlist[type],1)
|
||||
this.msk.uuid=sk[0]
|
||||
let skill=ecs.getEntity<MSkill>(MSkill)
|
||||
let praent = this.node.getChildByName("msk")
|
||||
skill.load(this.msk.uuid,1,praent)
|
||||
}
|
||||
select_mmsk(type:number){
|
||||
smc.vm_data.mission.ma_exp=0
|
||||
smc.vm_data.mission.mb_exp=0
|
||||
smc.vm_data.mission.mc_exp=0
|
||||
let sk:any=RandomManager.instance.getRandomByObjectList(MSlist[type],1)
|
||||
this.mmsk.uuid=sk[0]
|
||||
let mskill=ecs.getEntity<MSkill>(MSkill)
|
||||
let praent = this.node.getChildByName("mmsk")
|
||||
mskill.load(this.msk.uuid,1,praent)
|
||||
}
|
||||
call_msk(){
|
||||
|
||||
}
|
||||
|
||||
mission_end(){
|
||||
smc.vm_data.mission.play=false
|
||||
let heros:any= ecs.query(ecs.allOf(HeroModelComp));
|
||||
let monsters:any= ecs.query(ecs.allOf(MonModelComp));
|
||||
let hcards:any= ecs.query(ecs.allOf(HCardComp));
|
||||
let hcns=this.node.getChildByName("hcards")
|
||||
for(let i=0;i<hcns.children.length;i++){
|
||||
hcns.children[i].destroy()
|
||||
let mska:any= ecs.query(ecs.allOf(MSkillComp));
|
||||
for(let i=0;i<mska.length;i++){
|
||||
mska[i].MSkillComp.reset()
|
||||
mska[i].MSkillComp.ent.destroy()
|
||||
}
|
||||
// let hcns=this.node.getChildByName("hcards")
|
||||
// for(let i=0;i<hcns.children.length;i++){
|
||||
// hcns.children[i].destroy()
|
||||
// }
|
||||
for(let i=0;i<heros.length;i++){
|
||||
|
||||
heros[i].HeroView.reset()
|
||||
heros[i].HeroView.ent.destroy()
|
||||
|
||||
}
|
||||
for(let i=0;i<hcards.length;i++){
|
||||
hcards[i].HCardComp.reset()
|
||||
hcards[i].HCardComp.ent.destroy()
|
||||
}
|
||||
for(let i=0;i<monsters.length;i++){
|
||||
monsters[i].HeroView.reset()
|
||||
monsters[i].HeroView.ent.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user