36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
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
|
|
start() {
|
|
this.base =this.node.getComponent(SkillCom)
|
|
tween(this.node).to( this.base.in_time,
|
|
{ position: new Vec3(this.node.position.x,this.node.position.y) },
|
|
{
|
|
onComplete: (target?: object) => {
|
|
this.base.is_destroy=true
|
|
},
|
|
}
|
|
).start();
|
|
}
|
|
|
|
update(deltaTime: number) {
|
|
if(smc.mission.pause) return
|
|
this.cd+=deltaTime
|
|
if(this.cd>=this.base.cd){
|
|
// this.node.setPosition(v3(-1000,0,0))
|
|
this.node.active = false
|
|
this.node.active = true
|
|
this.cd=0
|
|
}
|
|
}
|
|
}
|
|
|
|
|