Files
heros/assets/script/game/hero/HeroSpine.ts

85 lines
1.5 KiB
TypeScript

import { Color, Component, EventTouch, sp, 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="Idle";
onLoad() {
// 角色控制组件
}
protected start(): void {
this.move();
}
/** 初始化动画 */
protected initAnimator() {
}
in_playing(){
}
change_status(value:string){
this.status=value
}
change_default(value:string){
}
default() {
}
idle(){
// console.log("do Idle");
if(this.status=="Idle") return
this.status="Idle"
this.anm.idle()
}
atk() {
// console.log("do atk");
this.anm.atk()
}
max(){
// console.log("do 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
}
}
move(){
// console.log("doing move");
if(this.status=="move") return
this.status="move"
this.anm.move()
}
atked() {
// console.log("do atked");
this.anm.atked()
}
onDestroy() {
this.node.destroy();
}
}