5555
This commit is contained in:
@@ -43,14 +43,27 @@ export class MapViewComp extends CCComp {
|
||||
if (pos == null) {
|
||||
this.scene.node.active = true
|
||||
smc.own = ecs.getEntity<Role>(Role);
|
||||
smc.own.load(this.aStarToVec3("0,0"), true);
|
||||
smc.own.load(this.aStarToVec3("-360,-60"), false);
|
||||
// smc.own.loadJoystick();
|
||||
|
||||
// 测试玩家
|
||||
var test = ecs.getEntity<Role>(Role);
|
||||
test.load(this.aStarToVec3("-300,0"), false);
|
||||
test.load(this.aStarToVec3("-270,-60"), false);
|
||||
var test1 = ecs.getEntity<Role>(Role);
|
||||
test1.load(this.aStarToVec3("-180,-60"), false);
|
||||
var test2 = ecs.getEntity<Role>(Role);
|
||||
test2.load(this.aStarToVec3("-300,300"), false);
|
||||
test2.load(this.aStarToVec3("-90,-60"), false);
|
||||
|
||||
// var test3 = ecs.getEntity<Role>(Role);
|
||||
// test3.load(this.aStarToVec3("0,-60"), false);
|
||||
var test4 = ecs.getEntity<Role>(Role);
|
||||
test4.load(this.aStarToVec3("90,-60"), true,"monster");
|
||||
var test5 = ecs.getEntity<Role>(Role);
|
||||
test5.load(this.aStarToVec3("180,-60"), true,"magic");
|
||||
var test6 = ecs.getEntity<Role>(Role);
|
||||
test6.load(this.aStarToVec3("270,-60"), true,"heath");
|
||||
var test7 = ecs.getEntity<Role>(Role);
|
||||
test7.load(this.aStarToVec3("360,-60"), true);
|
||||
}
|
||||
else {
|
||||
this.scene.setPlayer(pos);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user