Files
pixelheros/assets/script/game/hero/HeroSpine.ts
panFD 7aa8a47a65 refactor(hero): 统一角色状态初始化逻辑并调整UI布局
1. 将HeroSpine和HeroViewComp的默认状态从"idle"改为空字符串
2. 替换HeroViewComp中直接调用as.idle()为status_change方法
3. 调整role_controller预制体的UI元素位置和尺寸,适配240宽度布局
2026-06-12 20:28:33 +08:00

85 lines
1.4 KiB
TypeScript

import { Color, Component, EventTouch, Vec3, _decorator ,} from "cc";
import HeroAnmComp from "./HeroAnmComp";
const { ccclass, property } = _decorator;
@ccclass('HeroSpine')
export class HeroSpine extends Component {
@property(HeroAnmComp)
anm: HeroAnmComp = null;
status:string="";
onLoad() {
// 角色控制组件
}
protected start(): void {
this.idle();
}
/** 初始化动画 */
protected initAnimator() {
}
in_playing(){
}
change_status(value:string){
this.status=value
}
change_default(value:string){
}
default() {
}
idle(){
if(this.status=="idle") return
this.status="idle"
this.anm.idle()
}
atk() {
this.anm.atk()
}
max(){
this.anm.max()
}
play(name:string){
switch(name){
case "max":
this.max()
break
case "atk":
this.atk()
break
case "idle":
this.idle()
break
case "move":
this.move()
break
}
}
do_atked(){
this.anm.atked()
}
dead(){
}
do_buff(){
this.anm.buff()
}
buff(){
this.anm.buff()
}
move(){
if(this.status=="move") return
this.status="move"
this.anm.move()
}
}