This commit is contained in:
2024-11-20 23:58:07 +08:00
parent a0f89d8a90
commit 76d7e6677c
52 changed files with 1940 additions and 6355 deletions

View File

@@ -20,6 +20,7 @@ export class HCardComp extends CCComp {
hp:any=[]
life:any=[]
pw:any=[]
is_dead:boolean=false
protected onLoad(): void {
@@ -36,11 +37,21 @@ export class HCardComp extends CCComp {
console.log("hcard start")
}
protected update(dt: number): void {
if(this.is_dead) return
if(this.heros[this.hi].HeroView.is_dead){
this.node.getChildByName("dead").active=true
this.node.getChildByName("bg").getComponent(Sprite).grayscale=true
this.is_dead=true
}else{
this.node.getChildByName("dead").active=false
this.node.getChildByName("bg").getComponent(Sprite).grayscale=false
this.is_dead=false
}
this.hp.string=this.heros[this.hi].HeroView.hp_max
this.ap.string=this.heros[this.hi].HeroView.ap
this.life.progress=this.heros[this.hi].HeroView.hp/this.heros[this.hi].HeroView.hp_max
this.pw.progress=this.heros[this.hi].HeroView.pw/this.heros[this.hi].HeroView.pwm
}
/** 视图对象通过 ecs.Entity.remove(ControllerComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {

View File

@@ -0,0 +1,18 @@
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('move')
export class move extends Component {
start() {
}
update(dt: number) {
this.node.setPosition(this.node.position.x+dt*15,this.node.position.y)
if(this.node.position.x >= 1700){
this.node.setPosition(-1700,this.node.position.y)
}
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "c68767c6-5154-4de2-97e5-895a76f9f8ea",
"files": [],
"subMetas": {},
"userData": {}
}