技能动画添加
This commit is contained in:
30
assets/script/game/skills/TgCom.ts
Normal file
30
assets/script/game/skills/TgCom.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { _decorator, Component, Node, v3 } from 'cc';
|
||||
import { SkillCom } from './SkillCom';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('TgCom')
|
||||
export class TgCom extends Component {
|
||||
time:number = 0
|
||||
cd:number = 0
|
||||
base:SkillCom = null
|
||||
start() {
|
||||
this.base =this.node.getComponent(SkillCom)
|
||||
this.node.setPosition(this.base.t_pos)
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
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
|
||||
}
|
||||
this.time+=deltaTime
|
||||
if(this.time>=this.base.in_time){
|
||||
this.base.is_destroy = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user