删除好多英雄 专精几个英雄,继续英雄页面
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
import { _decorator, Component, Node, tween, Vec3 } from 'cc';
|
||||
import { _decorator, Component, Node, RigidBody2D, tween, Vec3 } from 'cc';
|
||||
import { SkillCom } from './SkillCom';
|
||||
import { HeroViewComp } from '../hero/HeroViewComp';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
import { HeroModelComp } from '../hero/HeroModelComp';
|
||||
import { ecs } from '../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS';
|
||||
import { BoxSet } from '../common/config/BoxSet';
|
||||
import { MonModelComp } from '../hero/MonModelComp';
|
||||
import { SkillSet } from '../common/config/SkillSet';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('CdCom')
|
||||
@@ -9,8 +14,10 @@ export class CdCom extends Component {
|
||||
cd:number = 0;
|
||||
base:SkillCom = null
|
||||
time:number = 0;
|
||||
rigid:RigidBody2D = null
|
||||
start() {
|
||||
this.base =this.node.getComponent(SkillCom)
|
||||
this.rigid = this.getComponent(RigidBody2D);
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
@@ -19,11 +26,36 @@ export class CdCom extends Component {
|
||||
if(this.cd>=this.base.cd){
|
||||
if(this.base.is_destroy) return
|
||||
// this.node.setPosition(v3(-1000,0,0))
|
||||
this.node.active = false
|
||||
this.node.active = true
|
||||
this.rigid.sleep()
|
||||
this.rigid.wakeUp()
|
||||
if(this.base.tg==2) this.do_all_buff()
|
||||
this.cd=0
|
||||
}
|
||||
}
|
||||
do_all_buff(){
|
||||
let heros:any = ecs.query(ecs.allOf(HeroModelComp));
|
||||
if(this.base.box_group==BoxSet.MONSTER) heros = ecs.query(ecs.allOf(MonModelComp));
|
||||
for (let i = 0; i < heros.length; i++) {
|
||||
let hero:any = heros[i].HeroView;
|
||||
// if (hero.in_grave) continue
|
||||
if(SkillSet[this.base.s_uuid].hp > 0){ //buff加血
|
||||
// let increase_hp=Math.floor(this.base.hp/(this.base.in_time/this.base.cd))
|
||||
let increase_hp=Math.floor(this.base.hp)
|
||||
hero.add_hp(increase_hp)
|
||||
}
|
||||
if(SkillSet[this.base.s_uuid].apup > 0){ //buff加攻击
|
||||
// let increase_atk=Math.floor(this.base.apup/(this.base.in_time/this.base.cd))
|
||||
let increase_atk=Math.floor(this.base.apup)
|
||||
hero.add_ap(increase_atk)
|
||||
}
|
||||
if(SkillSet[this.base.s_uuid].shield > 0){ //buff护盾
|
||||
hero.add_shield(this.base.shield)
|
||||
}
|
||||
if(SkillSet[this.base.s_uuid].mhp > 0){ //hp最大值
|
||||
hero.add_hp_max(this.base.mhp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@ export class EndAnmBomCom extends Component {
|
||||
this.rigid = this.getComponent(RigidBody2D);
|
||||
console.log("collider",this.collider,this.rigid)
|
||||
this.rigid.sleep()
|
||||
this.scheduleOnce(()=>{
|
||||
this.rigid.wakeUp()
|
||||
},0.5)
|
||||
|
||||
// this.collider.enabled = false
|
||||
// if(this.base.box_group ==BoxSet.HERO) this.collider.group = BoxSet.MONSTER
|
||||
// if(this.base.box_group ==BoxSet.MONSTER) this.collider.group = BoxSet.HERO
|
||||
@@ -34,25 +38,27 @@ export class EndAnmBomCom extends Component {
|
||||
this.onAnimationFinished()
|
||||
console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
||||
});
|
||||
spine.setEventListener((trackEntry, event:any) => {
|
||||
this.onEnvent(event)
|
||||
// console.log("[track %s][animation %s] event: %s", trackEntry.trackIndex, event.data.name, event.intValue);
|
||||
});
|
||||
// spine.setEventListener((trackEntry, event:any) => {
|
||||
// this.onEnvent(event)
|
||||
// // console.log("[track %s][animation %s] event: %s", trackEntry.trackIndex, event.data.name, event.intValue);
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onAnimationFinished(){
|
||||
if(!this.is_complete){
|
||||
// this.collider.group = this.base.box_group
|
||||
// this.node.active=false
|
||||
// this.node.active=true
|
||||
this.rigid.wakeUp()
|
||||
// this.collider.enabled = true
|
||||
console.log("动画结束,开始伤害")
|
||||
}
|
||||
|
||||
// if(!this.is_complete){
|
||||
// // this.collider.group = this.base.box_group
|
||||
// // this.node.active=false
|
||||
// // this.node.active=true
|
||||
// this.rigid.wakeUp()
|
||||
// // this.collider.enabled = true
|
||||
// console.log("动画结束,开始伤害")
|
||||
// }
|
||||
this.rigid.wakeUp()
|
||||
// this.collider.enabled = true
|
||||
console.log("动画结束,开始伤害")
|
||||
this.base.is_destroy = true
|
||||
|
||||
}
|
||||
|
||||
@@ -63,39 +63,11 @@ export class SkillCom extends CCComp {
|
||||
if(otCol.group != seCol.group&&otCol.tag ==0){
|
||||
this.atk_count+=1
|
||||
}
|
||||
// if(otCol.group == seCol.group&&otCol.tag ==0&&(this.tg==2||this.tg==0)){
|
||||
// this.to_console("skill onBeginContact 是对自己人的buff",seCol,otCol)
|
||||
// this.do_buff(otCol.node.getComponent(HeroViewComp))
|
||||
// }
|
||||
}
|
||||
to_console(value:any,value2:any=null,value3:any=null){
|
||||
console.log("["+this.s_name+this.s_uuid+"]:",value,value2,value3)
|
||||
}
|
||||
|
||||
do_buff(hero:any){
|
||||
this.to_console(" do_buff hero: ",hero)
|
||||
if(SkillSet[this.s_uuid].hp > 0){ //buff加血
|
||||
// let increase_hp=Math.floor(this.hp/(this.in_time/this.cd))
|
||||
let increase_hp=Math.floor(this.hp)
|
||||
hero.add_hp(increase_hp)
|
||||
}
|
||||
|
||||
if(SkillSet[this.s_uuid].apup > 0){ //buff加攻击
|
||||
// let increase_atk=Math.floor(this.apup/(this.in_time/this.cd))
|
||||
let increase_atk=Math.floor(this.apup)
|
||||
hero.add_ap(increase_atk)
|
||||
}
|
||||
|
||||
if(SkillSet[this.s_uuid].shield > 0){ //buff护盾
|
||||
console.log("do_buff shield: ",this.shield)
|
||||
hero.add_shield(this.shield)
|
||||
}
|
||||
if(SkillSet[this.s_uuid].mhp > 0){ //hp最大值
|
||||
// console.log("do_buff mhp: ",this.mhp/(this.in_time/this.cd))
|
||||
console.log("do_buff mhp: ",this.mhp)
|
||||
hero.add_hp_max(this.mhp/(this.in_time/this.cd))
|
||||
}
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
if(smc.mission.pause) return
|
||||
this.toDestroy()
|
||||
|
||||
Reference in New Issue
Block a user