This commit is contained in:
2024-07-18 22:53:13 +08:00
parent dca11ad5b5
commit 4cd06064fe
129 changed files with 2440 additions and 6754 deletions

View File

@@ -35,8 +35,8 @@ export class Role extends ecs.Entity {
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO, isOwn: boolean = false) {
var path = isOwn ? "game/player/own" : "game/player/player";
load(pos: Vec3 = Vec3.ZERO, isMonster: boolean = false,skin:string = "war") {
var path = "game/player/player";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
@@ -45,13 +45,12 @@ export class Role extends ecs.Entity {
node.setPosition(pos)
var mv = node.getComponent(RoleViewComp)!;
this.add(mv);
var as = node.getComponent(RoleSpine);
as.setSkin(skin);
// as.setPlayer(pos);
if (isOwn) {
smc.map.MapView.scene.setPlayer(node.getComponent(Charactor));
if (isMonster) {
node.setScale(-1, 1, 1);
}
}

View File

@@ -26,7 +26,7 @@ export class RoleSpine extends Component implements ICharactorClip {
onLoad() {
// 角色控制组件
this.charactor = this.addComponent(Charactor)!;
// this.charactor = this.addComponent(Charactor)!;
this.initAnimator();
@@ -66,6 +66,9 @@ export class RoleSpine extends Component implements ICharactorClip {
break;
}
}
setSkin(value: string): void {
this.spine.setSkin(value);
}
setAlpha(value: number): void {
var color: Color = this.spine.color;

View File

@@ -19,7 +19,7 @@ const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
export default class RoleSpineAnimator extends AnimatorSpine {
private charactor!: Charactor;
private dir: CharactorDirection = CharactorDirection.bottom;
private animName: string = "Stand";
private animName: string = "idle";
private loop: boolean = true;
start() {
@@ -45,7 +45,7 @@ export default class RoleSpineAnimator extends AnimatorSpine {
this.animName = animName;
this.loop = loop;
animName = `huaxian/${this.getDirection(this.charactor.direction)}${animName}`;
// animName = `huaxian/${this.getDirection(this.charactor.direction)}${animName}`;
this._spine.setAnimation(0, animName, loop);
}
else {