技能+1
This commit is contained in:
37
assets/script/game/skills/LineMCom.ts
Normal file
37
assets/script/game/skills/LineMCom.ts
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user