todo 技能存在时间准确性问题
This commit is contained in:
@@ -8,22 +8,20 @@ const { ccclass, property } = _decorator;
|
||||
export class BuffCom extends Component {
|
||||
cd:number = 0;
|
||||
base:SkillCom = null
|
||||
time:number = 0;
|
||||
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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user