This commit is contained in:
panw
2025-01-07 16:42:40 +08:00
parent 1c9c19c965
commit b9fa8c5d71
5 changed files with 55 additions and 9 deletions

View File

@@ -0,0 +1,37 @@
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
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.time+=deltaTime
if(this.time>=this.base.in_time){
this.base.is_destroy = true
}
this.node.setPosition(this.node.position.x+this.base.speed*deltaTime,this.node.position.y,this.node.position.z)
if(this.node.position.x>1000||this.node.position.x<-1000){
this.base.is_destroy = true
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "47be4e93-d36a-4a9c-aa51-ea6616fac6d1",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -17,7 +17,7 @@ export class TgCom extends Component {
update(deltaTime: number) {
if(smc.mission.pause) return
this.cd+=deltaTime
if(this.cd>=1){
if(this.cd>=this.base.cd){
// this.node.setPosition(v3(-1000,0,0))
this.node.active = false
this.node.active = true