import { _decorator, Component, Node } from 'cc'; import { timedCom } from './timedCom'; import { HeroViewComp } from '../hero/HeroViewComp'; const { ccclass, property } = _decorator; @ccclass('debuff') export class debuff extends Component { base: timedCom = null hero:HeroViewComp = null cd: number = 0 ap: number = 0 start() { this.base =this.node.getComponent(timedCom) this.hero = this.node.parent.getComponent(HeroViewComp) } update(deltaTime: number) { this.cd += deltaTime if(this.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.cd=0 } } }