角色动画 确定
This commit is contained in:
@@ -34,7 +34,7 @@ export class Role extends ecs.Entity {
|
||||
}
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=101) {
|
||||
load(pos: Vec3 = Vec3.ZERO,uuid:number=101,skin:string="Character01") {
|
||||
// var path = "game/monster/"+prefab_path;
|
||||
var path = "game/heros/role";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
@@ -42,23 +42,24 @@ export class Role extends ecs.Entity {
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!;
|
||||
// var as = node.getComponent(MonsterSpine);
|
||||
|
||||
node.setPosition(pos)
|
||||
// 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);
|
||||
// const url = 'game/heros/player';
|
||||
// resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
// const sprite = node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(RoleSet[uuid].path);
|
||||
});
|
||||
// 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)
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
|
||||
}
|
||||
|
||||
hero_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
|
||||
var rv = node.getComponent(RoleViewComp)!;
|
||||
|
||||
this.add(rv);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,13 @@ export class RoleSpine extends Component {
|
||||
protected initAnimator() {
|
||||
this.spine = this.animator.getComponent(sp.Skeleton)!;
|
||||
}
|
||||
|
||||
atk() {
|
||||
this.spine.setAnimation(0, "Throwing", false);
|
||||
}
|
||||
|
||||
magic() {
|
||||
this.spine.setAnimation(0, "Hit", false);
|
||||
}
|
||||
setSkin(value: string): void {
|
||||
console.log("RoleSpine setSkin", value);
|
||||
this.spine.setSkin(value);
|
||||
|
||||
@@ -15,15 +15,29 @@ const { ccclass, property, requireComponent, disallowMultiple } = _decorator;
|
||||
@disallowMultiple
|
||||
@requireComponent(sp.Skeleton)
|
||||
export default class RoleSpineAnimator extends Component {
|
||||
private animName: string = "move";
|
||||
private animName: string = "Idle";
|
||||
private loop: boolean = true;
|
||||
private spine!: sp.Skeleton;
|
||||
start() {
|
||||
this.spine = this.getComponent(sp.Skeleton)!;
|
||||
// console.log("RoleSpineAnimator start");
|
||||
// console.log("MonsterSpineAnimator start");
|
||||
this.playAnimation(this.animName, this.loop);
|
||||
}
|
||||
mixTime:number= 0.2;
|
||||
|
||||
protected onLoad(): void {
|
||||
this.spine = this.getComponent(sp.Skeleton)!;
|
||||
// this.spine?.setMix('atk', 'Idle', this.mixTime);
|
||||
// this.spine?.setMix('Idle','atk', this.mixTime);
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
lateUpdate(dt: number) {
|
||||
//
|
||||
}
|
||||
@@ -44,9 +58,9 @@ export default class RoleSpineAnimator extends Component {
|
||||
* @param loop 是否循环播放
|
||||
*/
|
||||
protected playAnimation(animName: string, loop: boolean) {
|
||||
// console.log("RoleSpineAnimator playAnimation");
|
||||
// console.log("MonsterSpineAnimator playAnimation");
|
||||
if (animName) {
|
||||
// console.log("RoleSpineAnimator playAnimation animName", animName);
|
||||
// console.log("MonsterSpineAnimator playAnimation animName", animName);
|
||||
this.animName = animName;
|
||||
this.loop = loop;
|
||||
this.spine.setAnimation(0, this.animName, this.loop);
|
||||
|
||||
@@ -5,13 +5,18 @@
|
||||
* @LastEditTime: 2022-08-17 12:36:18
|
||||
*/
|
||||
|
||||
import { Vec3, v3,_decorator ,Collider2D,Contact2DType,IPhysics2DContact,Material,Sprite,ProgressBar} from "cc";
|
||||
import { Vec3, v3,_decorator ,Collider2D,Contact2DType,IPhysics2DContact,Material,Sprite,ProgressBar, Prefab, instantiate} from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { RoleSpine } from "./RoleSpine";
|
||||
import {BoxSet} from "../common/config/BoxSet"
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { SkillCom } from "../skills/SkillCom";
|
||||
import { Skill } from "../skills/Skill";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 角色显示组件 */
|
||||
@@ -29,24 +34,27 @@ export class RoleViewComp extends CCComp {
|
||||
hp_max:number = 1000;
|
||||
power: number = 0;
|
||||
stop_cd:number = 0;
|
||||
atk_cd:number = 0;
|
||||
atk:number = 2;
|
||||
atk_cd:number = 20;
|
||||
atk:number = 10;
|
||||
skill_uuid:number = 9003;
|
||||
max_skill_uuid:number = 1001;
|
||||
skin="Character01";
|
||||
private atk_time:Timer = new Timer(1);
|
||||
|
||||
onLoad() {
|
||||
onLoad() {
|
||||
this.as = this.getComponent(RoleSpine);
|
||||
|
||||
}
|
||||
start () {
|
||||
this.sprite = this.node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite);
|
||||
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
|
||||
|
||||
// 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);
|
||||
console.log("Role view start")
|
||||
|
||||
let collider = this.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
}
|
||||
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(otherCollider.tag==BoxSet.SKILL_TAG){
|
||||
@@ -61,46 +69,53 @@ export class RoleViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
}
|
||||
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
|
||||
|
||||
}
|
||||
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
|
||||
|
||||
if(selfCollider.group == otherCollider.group){
|
||||
// console.log('monster view group 相同');
|
||||
|
||||
}else{
|
||||
// console.log('monster onPostSolve'+selfCollider.group+"|"+otherCollider.group);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
// onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
// onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
|
||||
update(dt: number){
|
||||
|
||||
if (this.atk_time.update(dt)) {
|
||||
this.toAtk(this.skill_uuid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
setSkin(){
|
||||
this.as.setSkin(this.skin);
|
||||
}
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
toAtk(uuid) {
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
this.shoot(this.skill_uuid);
|
||||
},0.5)
|
||||
}
|
||||
|
||||
|
||||
shoot(skill_uuid:number){
|
||||
// console.log("monster shoot");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let pos = v3(35,55)
|
||||
let scale = 1
|
||||
let speed =SkillSet[skill_uuid].speed;
|
||||
let dis = SkillSet[skill_uuid].dis;
|
||||
let atk = SkillSet[skill_uuid].atk+this.atk;
|
||||
let uuid = skill_uuid;
|
||||
skill.load(pos,speed,dis,scale,this.node,uuid,atk,2);
|
||||
}
|
||||
|
||||
in_atked() {
|
||||
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
this.scheduleOnce(() => {
|
||||
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
}, 0.1);
|
||||
// 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;
|
||||
@@ -110,8 +125,8 @@ export class RoleViewComp extends CCComp {
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
if(this.hp <= 0){
|
||||
console.log("dead");
|
||||
console.log("dead");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
9
assets/script/game/Role/role2.meta
Normal file
9
assets/script/game/Role/role2.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "826ec938-411f-429e-9693-747a063877b4",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
74
assets/script/game/Role/role2/Role2Spine.ts
Normal file
74
assets/script/game/Role/role2/Role2Spine.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* @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 ,Node} from "cc";
|
||||
import { LayerUtil } from "../../../../../extensions/oops-plugin-framework/assets/core/utils/LayerUtil";
|
||||
import { smc } from "../../common/SingletonModuleComp";
|
||||
import Role2SpineAnimator from "./Role2SpineAnimator";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
* RPG SPINE角色模型
|
||||
*/
|
||||
@ccclass('Role2Spine')
|
||||
export class Role2Spine extends Component {
|
||||
@property({ type: Role2SpineAnimator, tooltip: '动画控制器' })
|
||||
animator: Role2SpineAnimator = null!;
|
||||
|
||||
private spine!: sp.Skeleton;
|
||||
|
||||
onLoad() {
|
||||
// 角色控制组件
|
||||
|
||||
this.initAnimator();
|
||||
LayerUtil.setNodeLayer(LayerUtil.MAP, this.node);
|
||||
}
|
||||
atk() {
|
||||
this.spine.setAnimation(1, "atk", false);
|
||||
}
|
||||
|
||||
magic() {
|
||||
this.spine.setAnimation(1, "magic", false);
|
||||
}
|
||||
/** 初始化动画 */
|
||||
protected initAnimator() {
|
||||
this.spine = this.animator.getComponent(sp.Skeleton)!;
|
||||
}
|
||||
|
||||
setSkin(value: string): void {
|
||||
console.log("RoleSpine setSkin", value);
|
||||
this.spine.setSkin(value);
|
||||
}
|
||||
play(animName: string, loop: boolean): void {
|
||||
this.spine.setAnimation(1, 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() {
|
||||
|
||||
}
|
||||
}
|
||||
1
assets/script/game/Role/role2/Role2Spine.ts.meta
Normal file
1
assets/script/game/Role/role2/Role2Spine.ts.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"a12321b5-d9b0-4eb8-aa4c-9db175d0f9a8","files":[],"subMetas":{},"userData":{}}
|
||||
71
assets/script/game/Role/role2/Role2SpineAnimator.ts
Normal file
71
assets/script/game/Role/role2/Role2SpineAnimator.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* @Author: dgflash
|
||||
* @Date: 2022-08-04 15:08:35
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-08-04 15:26:38
|
||||
*/
|
||||
import { sp, _decorator ,Component} from "cc";
|
||||
|
||||
const { ccclass, property, requireComponent } = _decorator;
|
||||
|
||||
/**
|
||||
* Spine状态机组件(主状态机),trackIndex为0
|
||||
*/
|
||||
@ccclass
|
||||
@requireComponent(sp.Skeleton)
|
||||
export default class Role2SpineAnimator extends Component {
|
||||
private animName: string = "Idle";
|
||||
private loop: boolean = true;
|
||||
private spine!: sp.Skeleton;
|
||||
start() {
|
||||
this.spine = this.getComponent(sp.Skeleton)!;
|
||||
// console.log("MonsterSpineAnimator start");
|
||||
this.playAnimation(this.animName, this.loop);
|
||||
}
|
||||
mixTime:number= 0.2;
|
||||
|
||||
protected onLoad(): void {
|
||||
this.spine = this.getComponent(sp.Skeleton)!;
|
||||
// this.spine?.setMix('atk', 'Idle', this.mixTime);
|
||||
// this.spine?.setMix('Idle','atk', this.mixTime);
|
||||
this.spine.setEndListener(trackEntry => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
// console.log("[track %s][animation %s] end.", trackEntry.trackIndex, animationName);
|
||||
if (animationName == "atk"||animationName == "magic") {
|
||||
this.spine.setAnimation(1, "Idle", true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
lateUpdate(dt: number) {
|
||||
//
|
||||
}
|
||||
|
||||
play(animName: string, loop: boolean) {
|
||||
if (animName) {
|
||||
this.animName = animName;
|
||||
this.loop = loop;
|
||||
this.spine.setAnimation(1 ,this.animName, this.loop);
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 播放动画
|
||||
* @override
|
||||
* @param animName 动画名
|
||||
* @param loop 是否循环播放
|
||||
*/
|
||||
protected playAnimation(animName: string, loop: boolean) {
|
||||
// console.log("MonsterSpineAnimator playAnimation");
|
||||
if (animName) {
|
||||
// console.log("MonsterSpineAnimator playAnimation animName", animName);
|
||||
this.animName = animName;
|
||||
this.loop = loop;
|
||||
this.spine.setAnimation(1, this.animName, this.loop);
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
9
assets/script/game/Role/role2/Role2SpineAnimator.ts.meta
Normal file
9
assets/script/game/Role/role2/Role2SpineAnimator.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "93179a96-4683-4d2d-853c-a0f721f19f02",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
126
assets/script/game/Role/role2/Role2ViewComp.ts
Normal file
126
assets/script/game/Role/role2/Role2ViewComp.ts
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* @Author: dgflash
|
||||
* @Date: 2021-11-18 17:42:59
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-08-17 12:36:18
|
||||
*/
|
||||
|
||||
import { Vec3, v3,_decorator ,Collider2D,Contact2DType,IPhysics2DContact,Material,Sprite,ProgressBar} from "cc";
|
||||
import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { Role2Spine } from "./Role2Spine";
|
||||
import {BoxSet} from "../../common/config/BoxSet"
|
||||
import { smc } from "../../common/SingletonModuleComp";
|
||||
import { SkillCom } from "../../skills/SkillCom";
|
||||
import { Skill } from "../../skills/Skill";
|
||||
import { SkillSet } from "../../common/config/SkillSet";
|
||||
import { Timer } from "../../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
|
||||
import { RandomManager } from "../../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 角色显示组件 */
|
||||
@ccclass('Role2ViewComp') // 定义为 Cocos Creator 组件
|
||||
@ecs.register('RoleView2', false) // 定义为 ECS 组件
|
||||
export class Role2ViewComp extends CCComp {
|
||||
@property(Material)
|
||||
hitFlashMaterial: Material;
|
||||
orginalFlashMaterial: Material;
|
||||
sprite: Sprite;
|
||||
/** 角色动画 */
|
||||
as: Role2Spine = null!;
|
||||
/** 角色属性 */
|
||||
hp: number = 1000;
|
||||
hp_max:number = 1000;
|
||||
power: number = 0;
|
||||
stop_cd:number = 0;
|
||||
atk_cd:number = 2;
|
||||
atk:number = 10;
|
||||
skill_uuid:number = 9003;
|
||||
max_skill_uuid:number = 1001;
|
||||
skin:string ="Character01";
|
||||
private atk_time:Timer = new Timer(1);
|
||||
|
||||
onLoad() {
|
||||
this.as = this.getComponent(Role2Spine);
|
||||
|
||||
}
|
||||
start () {
|
||||
// this.as.setSkin(this.skin);
|
||||
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);
|
||||
console.log("Role view start")
|
||||
let collider = this.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
}
|
||||
}
|
||||
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
|
||||
if(otherCollider.tag==BoxSet.SKILL_TAG){
|
||||
if(selfCollider.group != otherCollider.group){
|
||||
let skill = otherCollider.node.getComponent(SkillCom)!;
|
||||
// console.log('onPostSolve',skill);
|
||||
// this.in_atked();
|
||||
if(this.hp <= 0 ){
|
||||
return
|
||||
}
|
||||
this.hp_change(skill.atk);
|
||||
}
|
||||
}
|
||||
}
|
||||
// onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
// onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
// onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {}
|
||||
|
||||
update(dt: number){
|
||||
if (this.atk_time.update(dt)) {
|
||||
this.toAtk(this.skill_uuid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
toAtk(uuid) {
|
||||
this.as.atk();
|
||||
this.scheduleOnce(()=>{
|
||||
this.shoot(this.skill_uuid);
|
||||
},0.4)
|
||||
}
|
||||
|
||||
shoot(skill_uuid:number){
|
||||
console.log("monster shoot");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let pos = v3(60,50)
|
||||
let scale = 1
|
||||
let speed =SkillSet[skill_uuid].speed;
|
||||
let dis = SkillSet[skill_uuid].dis;
|
||||
let atk = SkillSet[skill_uuid].atk+this.atk;
|
||||
let uuid = skill_uuid;
|
||||
skill.load(pos,speed,dis,scale,this.node,uuid,atk,2);
|
||||
}
|
||||
setSkin(skin:string="Character01"){
|
||||
this.as.setSkin(skin);
|
||||
}
|
||||
|
||||
in_atked() {
|
||||
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
this.scheduleOnce(() => {
|
||||
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
}, 0.1);
|
||||
}
|
||||
hp_change(hp: number){
|
||||
this.hp -= hp;
|
||||
if(this.hp > this.hp_max){
|
||||
this.hp = this.hp_max;
|
||||
}
|
||||
let hp_progress= this.hp/this.hp_max;
|
||||
this.node.getChildByName("hp").getComponent(ProgressBar)!.progress = hp_progress;
|
||||
if(this.hp <= 0){
|
||||
console.log("dead");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
1
assets/script/game/Role/role2/Role2ViewComp.ts.meta
Normal file
1
assets/script/game/Role/role2/Role2ViewComp.ts.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"4810c3ad-8287-4fcd-bdb3-dd44247d61ed","files":[],"subMetas":{},"userData":{}}
|
||||
Reference in New Issue
Block a user