Files
heros/assets/script/game/skills/LineMCom.ts
2025-01-10 16:50:18 +08:00

31 lines
909 B
TypeScript

import { _decorator, Component, Node } from 'cc';
import { SkillCom } from './SkillCom';
import { smc } from '../common/SingletonModuleComp';
const { ccclass, property } = _decorator;
@ccclass('LineMCom')
export class LineMCom extends Component {
base:SkillCom = null
time:number = 0
cd: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){
// this.node.setPosition(v3(-1000,0,0))
this.node.active = false
this.node.active = true
this.cd=0
}
this.node.setPosition(this.node.position.x+this.base.speed*deltaTime,this.node.position.y,this.node.position.z)
}
}