35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { _decorator, Component, Node } from 'cc';
|
|
import { timedCom } from './timedCom';
|
|
import { HeroViewComp } from '../hero/HeroViewComp';
|
|
import { smc } from '../common/SingletonModuleComp';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('debuff')
|
|
export class debuff extends Component {
|
|
base: timedCom = null
|
|
hero:HeroViewComp = null
|
|
deff_cd: number = 0
|
|
ap: number = 0
|
|
start() {
|
|
this.base =this.node.getComponent(timedCom)
|
|
this.hero = this.node.parent.getComponent(HeroViewComp)
|
|
|
|
}
|
|
|
|
update(deltaTime: number) {
|
|
if(smc.mission.pause) return
|
|
this.deff_cd += deltaTime
|
|
if(this.deff_cd >=1){
|
|
// this.node.setPosition(v3(-1000,0,0))
|
|
if(this.hero){
|
|
// this.hero.in_atked()
|
|
// this.hero.hp_less(Math.ceil(this.base.ap/this.base.time))
|
|
// console.log("debuff 总扣血:"+this.base.ap+" 每秒: "+Math.ceil(this.base.ap/this.base.time))
|
|
}
|
|
this.deff_cd=0
|
|
}
|
|
}
|
|
}
|
|
|
|
|