34 lines
925 B
TypeScript
34 lines
925 B
TypeScript
import { _decorator, Component, Node, tween, Vec3 } from 'cc';
|
|
import { SkillCom } from './SkillCom';
|
|
import { HeroViewComp } from '../hero/HeroViewComp';
|
|
import { smc } from '../common/SingletonModuleComp';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('BuffCom')
|
|
export class BuffCom extends Component {
|
|
cd:number = 0;
|
|
base:SkillCom = null
|
|
time:number = 0;
|
|
start() {
|
|
this.base =this.node.getComponent(SkillCom)
|
|
}
|
|
|
|
update(deltaTime: number) {
|
|
if(smc.mission.pause) return
|
|
this.cd+=deltaTime
|
|
this.time+=deltaTime
|
|
if(this.time>=this.base.in_time){
|
|
this.base.is_destroy = true
|
|
}
|
|
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.cd=0
|
|
}
|
|
}
|
|
}
|
|
|
|
|