This commit is contained in:
2025-08-05 17:25:34 +08:00
parent 3db3cc78eb
commit 6f9529ada2
20 changed files with 3120 additions and 1623 deletions

View File

@@ -0,0 +1,39 @@
import { _decorator, Component, Node } from 'cc';
import { oops } from 'db://oops-framework/core/Oops';
import { GameEvent } from '../common/config/GameEvent';
const { ccclass, property } = _decorator;
@ccclass('LifeComp')
export class LifeComp extends Component {
loss_life:number=0
protected onLoad(): void {
oops.message.on(GameEvent.FightReady,this.onFightReady,this)
oops.message.on(GameEvent.LifeChange,this.onLifeChange,this)
}
start() {
this.node.setSiblingIndex(100)
}
update(deltaTime: number) {
}
onFightReady(args: any) {
console.log("[LifeComp]:onMissionStart",args)
let nodes=this.node.children
nodes[0].active=true
nodes[1].active=true
nodes[2].active=true
this.loss_life=0
}
onLifeChange(args: any) {
console.log("[LifeComp]:onLifeChange loss_life:",this.loss_life)
let nodes=this.node.children
nodes[this.loss_life].active=false
this.loss_life++
if(this.loss_life >= 3){
oops.message.dispatchEvent(GameEvent.MissionLoss)
}
}
}