Files
heros/assets/script/game/skills/CdCom.ts
2025-01-12 23:58:35 +08:00

30 lines
800 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('CdCom')
export class CdCom 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
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
}
}
}