Files
heros/assets/script/game/map/LuckCardComp.ts

33 lines
770 B
TypeScript

import { _decorator, Animation, Component, Node, tween, v3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('LuckCardComp')
export class LuckCardComp extends Component {
timer:number=3;
start() {
this.timer=2
console.log("[LuckCardComp]:start")
}
update(deltaTime: number) {
this.timer-=deltaTime
if(this.timer<=0){
let anim=this.node.getComponent(Animation)
if(anim) anim.play("luckcardend")
this.do_destroy()
this.timer=2
}
}
do_destroy(){
tween(this.node)
.to(0.2, {
scale: v3(2,2,0),
}, {onComplete:()=>{
this.node.destroy()
}})
.start();
}
}