dd
This commit is contained in:
@@ -37,7 +37,7 @@ export class Role extends ecs.Entity {
|
||||
}
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=101,skin:string="Character01") {
|
||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=101) {
|
||||
// var path = "game/monster/"+prefab_path;
|
||||
var path = "game/heros/role";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
@@ -46,7 +46,7 @@ export class Role extends ecs.Entity {
|
||||
node.parent = scene.entityLayer!.node!;
|
||||
// var as = node.getComponent(MonsterSpine);
|
||||
node.setPosition(pos)
|
||||
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
||||
console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
|
||||
// const url = 'game/heros/player';
|
||||
// resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
// const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
@@ -54,8 +54,6 @@ export class Role extends ecs.Entity {
|
||||
// sprite.spriteFrame = atlas.getSpriteFrame(RoleSet[uuid].path);
|
||||
// });
|
||||
var rv = node.getComponent(RoleViewComp)!;
|
||||
rv.skin=skin
|
||||
rv.setSkin()
|
||||
this.add(rv);
|
||||
this.hero_init(uuid,node)
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ export class RoleSpine extends Component {
|
||||
this.spine = this.animator.getComponent(sp.Skeleton)!;
|
||||
}
|
||||
atk() {
|
||||
this.spine.setAnimation(0, "Throwing", false);
|
||||
this.spine.setAnimation(0, "atk2", false);
|
||||
}
|
||||
|
||||
magic() {
|
||||
this.spine.setAnimation(0, "Hit", false);
|
||||
this.spine.setAnimation(0, "max", false);
|
||||
}
|
||||
setSkin(value: string): void {
|
||||
console.log("RoleSpine setSkin", value);
|
||||
|
||||
@@ -15,7 +15,7 @@ const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
|
||||
@disallowMultiple
|
||||
@requireComponent(sp.Skeleton)
|
||||
export default class RoleSpineAnimator extends Component {
|
||||
private animName: string = "Idle";
|
||||
private animName: string = "move";
|
||||
private loop: boolean = true;
|
||||
private spine!: sp.Skeleton;
|
||||
start() {
|
||||
@@ -32,8 +32,8 @@ export default class RoleSpineAnimator extends Component {
|
||||
this.spine.setEndListener(trackEntry => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
// console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
|
||||
if (animationName == "Throwing"||animationName == "Hit") {
|
||||
this.spine.setAnimation(0, "Idle", true);
|
||||
if (animationName == "atk2" ||animationName == "magic"||animationName=="max") {
|
||||
this.spine.setAnimation(0, "move", true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ export class RoleViewComp extends CCComp {
|
||||
hp_max:number = 1000;
|
||||
power: number = 0;
|
||||
stop_cd:number = 0;
|
||||
atk_cd:number = 10;
|
||||
atk_cd:number = 3;
|
||||
atk:number = 10;
|
||||
skill_uuid:number = 9003;
|
||||
max_skill_uuid:number = 1001;
|
||||
@@ -51,8 +51,8 @@ export class RoleViewComp extends CCComp {
|
||||
// let x = RandomManager.instance.getRandomInt(1,9,2)
|
||||
// this.as.setSkin("Character0"+x);
|
||||
this.atk_time = new Timer(this.atk_cd);
|
||||
// this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
// this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||
this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||
console.log("Role view start")
|
||||
let collider = this.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
@@ -113,16 +113,16 @@ export class RoleViewComp extends CCComp {
|
||||
}
|
||||
|
||||
in_atked() {
|
||||
// this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
// this.scheduleOnce(() => {
|
||||
// this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
// }, 0.1);
|
||||
var path = "game/skills/atked";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
let pos = v3(0,30)
|
||||
node.setPosition(pos)
|
||||
node.parent = this.node;
|
||||
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
this.scheduleOnce(() => {
|
||||
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
}, 0.1);
|
||||
// var path = "game/skills/atked";
|
||||
// var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
// var node = instantiate(prefab);
|
||||
// let pos = v3(0,30)
|
||||
// node.setPosition(pos)
|
||||
// node.parent = this.node;
|
||||
}
|
||||
hp_change(hp: number){
|
||||
this.hp -= hp;
|
||||
|
||||
Reference in New Issue
Block a user