添加2个游戏层,敌方精灵随机出现在3个层内

This commit is contained in:
walkpan
2024-08-22 22:59:43 +08:00
parent 6e9faca1a3
commit 2917c12f14
65 changed files with 394 additions and 2540 deletions

View File

@@ -0,0 +1,68 @@
/*
* @Author: dgflash
* @Date: 2022-08-04 15:08:35
* @LastEditors: dgflash
* @LastEditTime: 2022-08-04 15:26:26
*/
import { Color, Component, EventTouch, sp, Vec3, _decorator } from "cc";
import { LayerUtil } from "../../../../extensions/oops-plugin-framework/assets/core/utils/LayerUtil";
import { smc } from "../../../script/game/common/SingletonModuleComp";
import HeroSpineAnimator from "./HeroSpineAnimator";
const { ccclass, property } = _decorator;
/**
* SPINE角色模型
*/
@ccclass('HeroSpine')
export class HeroSpine extends Component {
@property({ type: HeroSpineAnimator, tooltip: '动画控制器' })
animator: HeroSpineAnimator = null!;
private spine!: sp.Skeleton;
onLoad() {
// 角色控制组件
this.initAnimator();
LayerUtil.setNodeLayer(LayerUtil.MAP, this.node);
}
/** 初始化动画 */
protected initAnimator() {
this.spine = this.animator.getComponent(sp.Skeleton)!;
}
setSkin(value: string): void {
console.log("HeroSpine setSkin", value);
this.spine.setSkin(value);
}
play(animName: string, loop: boolean): void {
this.spine.setAnimation(0, animName, loop);
}
setAlpha(value: number): void {
var color: Color = this.spine.color;
color.a = 255 * (value / 1);
this.spine.color = color;
}
setPos(value: Vec3): void {
this.node.position = value;
}
checkTouch(event: EventTouch): boolean {
return false;
}
onDestroy() {
this.node.destroy();
}
walk() {
}
idle() {
}
}