dd
This commit is contained in:
@@ -6,6 +6,7 @@ import { timedCom } from '../skills/timedCom';
|
||||
import { smc } from '../common/SingletonModuleComp';
|
||||
import { HeroViewComp } from './HeroViewComp';
|
||||
import { GameEvent } from '../common/config/GameEvent';
|
||||
import { Timer } from 'db://oops-framework/core/common/timer/Timer';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('BuffComp')
|
||||
@@ -33,6 +34,10 @@ export class BuffComp extends Component {
|
||||
speek_time:number=0;
|
||||
HeroView:HeroViewComp=null!
|
||||
hp_bar:any=null
|
||||
|
||||
timer:Timer=new Timer(2);
|
||||
buff_keys:any[]=["by1","by2","by3"]
|
||||
key_index:number=0;
|
||||
protected onLoad(): void {
|
||||
}
|
||||
start() {
|
||||
@@ -47,11 +52,11 @@ export class BuffComp extends Component {
|
||||
this.hp_bar=this.top_node.getChildByName("hp").getComponent(ProgressBar)
|
||||
// this.top_node.getChildByName("hp").active=(this.node.getComponent(HeroViewComp).fac == 1 ? true : false)
|
||||
|
||||
this.vmdata_update()
|
||||
// this.vmdata_update()
|
||||
}
|
||||
|
||||
to_update_vmdata(){
|
||||
this.vmdata_update(false)
|
||||
// this.vmdata_update(false)
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
if(smc.mission.pause) return
|
||||
@@ -60,11 +65,13 @@ export class BuffComp extends Component {
|
||||
if(this.wind_cd <= 0 && this.node.getChildByName("wind").active){
|
||||
this.node.getChildByName("wind").active = false;
|
||||
}
|
||||
|
||||
if(this.buff_cd > 0 ) this.buff_cd -= deltaTime;
|
||||
if(this.buff_cd <= 0 && this.node.getChildByName("buff").active){
|
||||
this.node.getChildByName("buff").active = false;
|
||||
if(this.timer.update(deltaTime)){
|
||||
this.timer.reset()
|
||||
this.show_buff(this.buff_keys[this.key_index])
|
||||
this.key_index++
|
||||
if(this.key_index>=this.buff_keys.length) this.key_index=0
|
||||
}
|
||||
|
||||
// this.in_speek(deltaTime)
|
||||
// this.vmdata_update()
|
||||
}
|
||||
@@ -132,9 +139,10 @@ export class BuffComp extends Component {
|
||||
}
|
||||
|
||||
|
||||
show_buff(t:number=1){
|
||||
this.buff_cd = t;
|
||||
this.node.getChildByName("buff").active = true;
|
||||
show_buff(key:string="bb"){
|
||||
this.node.getChildByName("buff").getChildByName("by1").active = key == "by1"
|
||||
this.node.getChildByName("buff").getChildByName("by2").active = key == "by2"
|
||||
this.node.getChildByName("buff").getChildByName("by3").active = key == "by3"
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user