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() { } /** * 播放待机动画:动画层成功切换才记录 status, * 被普攻/buff/大招拦截时返回 false 且不记录,保证记录与实际动画一致。 */ idle(): boolean { if(this.status=="idle") return true if(!this.anm.idle()) return false this.status="idle" return true } 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() } /** 播放移动动画(返回值语义与 idle() 一致:拦截时不记录状态) */ move(): boolean { if(this.status=="move") return true if(!this.anm.move()) return false this.status="move" return true } }