去掉原先spine 英雄怪物
This commit is contained in:
@@ -300,23 +300,23 @@ export const SkillSet = {
|
||||
debuff:DebuffAttr.STUN,deV:0.5,deC:0,deR:50,in:1,ap:100,cd:5,hit_num:1,hit:1,hited:0.3,buV:0,buC:0,buR:100,speed:720,cost:10,info:"召唤大火球攻击前方所有敌人,造成200%攻击的伤害,20%几率眩晕敌人"},
|
||||
|
||||
6026:{uuid:6026,name:"火墙", for_hero:true, sp_name:"max_fwall",AtkedType:AtkedType.atked,path:"3040",quality:Quality.BLUE, TType:TType.Frontline,maxC:1,
|
||||
TGroup:TGroup.Ally,SType:SType.damage,act:"atk",DTType:DTType.range,CdType:CdType.cd,AType:AType.fixedEnd,EType:EType.timeEnd,fname:"max",flash:false,with:90,
|
||||
TGroup:TGroup.Ally,SType:SType.damage,act:"max",DTType:DTType.range,CdType:CdType.cd,AType:AType.fixedEnd,EType:EType.timeEnd,fname:"max",flash:false,with:90,
|
||||
debuff:0,deV:0,deC:0,deR:100,in:10,ap:50,cd:5,hit_num:1,hit:1,hited:1,buV:0,buC:0,buR:100,speed:720,cost:10,info:"在最前方敌人位置,召唤一堵火墙,持续10秒,每秒造成50%攻击伤害"},
|
||||
|
||||
6027:{uuid:6027,name:"冰刺",for_hero:true,sp_name:"icez",AtkedType:AtkedType.atked,path:"3049",quality:Quality.BLUE, TType:TType.Frontline,maxC:1,
|
||||
TGroup:TGroup.Ally,SType:SType.damage,act:"atk",DTType:DTType.range,CdType:CdType.power,AType:AType.fixedEnd,EType:EType.animationEnd,fname:"max",flash:false,with:90,
|
||||
TGroup:TGroup.Ally,SType:SType.damage,act:"max",DTType:DTType.range,CdType:CdType.power,AType:AType.fixedEnd,EType:EType.animationEnd,fname:"max",flash:false,with:90,
|
||||
debuff:DebuffAttr.FROST,deV:0,deC:0,deR:100,in:1,ap:300,cd:5,hit_num:1,hit:1,hited:0.3,buV:0,buC:0,buR:100,speed:720,cost:10,info:"在最前方敌人位置,召唤冰刺攻击敌人,造成200%攻击的伤害,20%几率冰冻敌人"},
|
||||
|
||||
6028:{uuid:6028,name:"潮汐", for_hero:true, sp_name:"watert",AtkedType:AtkedType.atked,path:"3070",quality:Quality.BLUE, TType:TType.Frontline,maxC:1,
|
||||
TGroup:TGroup.Ally,SType:SType.damage,act:"atk",DTType:DTType.range,CdType:CdType.power,AType:AType.fixedEnd,EType:EType.animationEnd,fname:"max",flash:false,with:90,
|
||||
TGroup:TGroup.Ally,SType:SType.damage,act:"max",DTType:DTType.range,CdType:CdType.power,AType:AType.fixedEnd,EType:EType.animationEnd,fname:"max",flash:false,with:90,
|
||||
debuff:DebuffAttr.BACK,deV:0,deC:0,deR:100,in:3,ap:100,cd:5,hit_num:1,hit:1,hited:0.3,buV:0,buC:0,buR:100,speed:720,cost:10,info:"在最前方敌人位置,召唤水柱攻击敌人,每秒造成100%攻击的伤害,50%几率击退敌人"},
|
||||
|
||||
6029:{uuid:6029,name:"陨石术",for_hero:true, sp_name:"max_yunshi",AtkedType:AtkedType.fire,path:"3123",quality:Quality.BLUE, TType:TType.Frontline,maxC:1,
|
||||
TGroup:TGroup.Ally,SType:SType.damage,act:"atk",DTType:DTType.range,CdType:CdType.power,AType:AType.fixedEnd,EType:EType.animationEnd,fname:"max",flash:false,with:90,
|
||||
TGroup:TGroup.Ally,SType:SType.damage,act:"max",DTType:DTType.range,CdType:CdType.power,AType:AType.fixedEnd,EType:EType.animationEnd,fname:"max",flash:false,with:90,
|
||||
debuff:0,deV:0,deC:0,deR:100,in:3,ap:500,cd:5,hit_num:0,hit:1,hited:0.3,buV:0,buC:0,buR:100,speed:720,cost:10,info:"在最前方敌人位置,召唤陨石攻击敌人,造成500%攻击的伤害"},
|
||||
|
||||
6030:{uuid:6030,name:"冰墙", for_hero:false, sp_name:"icet",AtkedType:AtkedType.atked,path:"3050",quality:Quality.GREEN, TType:TType.Frontline,maxC:1,
|
||||
TGroup:TGroup.Enemy,SType:SType.damage,act:"atk",DTType:DTType.range,CdType:CdType.cd,AType:AType.linear,EType:EType.animationEnd,fname:"max",flash:false,with:90,
|
||||
TGroup:TGroup.Enemy,SType:SType.damage,act:"max",DTType:DTType.range,CdType:CdType.cd,AType:AType.linear,EType:EType.animationEnd,fname:"max",flash:false,with:90,
|
||||
debuff:DebuffAttr.BACK,deV:0,deC:0,deR:100,in:1,ap:400,cd:5,hit_num:1,hit:1,hited:0.3,buV:0,buC:0,buR:100,speed:720,cost:10,info:"在最前方敌人位置,召唤冰墙攻击敌人,造成200%攻击的伤害,50%几率击退敌人"},
|
||||
6031:{uuid:6031,name:"剑雨",for_hero:true, sp_name:"max_jianyu",AtkedType:AtkedType.fire,path:"3123",quality:Quality.BLUE, TType:TType.Frontline,maxC:1,
|
||||
TGroup:TGroup.Ally,SType:SType.damage,act:"max",DTType:DTType.range,CdType:CdType.power,AType:AType.fixedEnd,EType:EType.animationEnd,fname:"max",flash:false,with:90,
|
||||
|
||||
@@ -255,11 +255,11 @@ export const getGrowthModeDescription = (heroType: HType): string => {
|
||||
export const HeroInfo = {
|
||||
|
||||
//主将
|
||||
5001:{uuid:5001,name:"火焰骑士",path:"k2", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5001:{uuid:5001,name:"火焰骑士",path:"hk1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:100,ap:15,dis:100,cd:1,speed:150,skills:[6011,6020],
|
||||
buff:[],info:"剑类专精,穿刺伤害额外+10%"},
|
||||
|
||||
5002:{uuid:5002,name:"圣盾骑士",path:"k3", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5002:{uuid:5002,name:"hk1",path:"hk1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:100,ap:15,dis:100,cd:1,speed:150,skills:[6011,6004],
|
||||
buff:[],info:"斧类专精,风怒概率增加10%"},
|
||||
|
||||
@@ -271,93 +271,93 @@ export const HeroInfo = {
|
||||
// type:HType.warrior,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6010,6021,6001],
|
||||
// buff:[],info:"刀类专精,易伤效果额外持续1次"},
|
||||
|
||||
5005:{uuid:5005,name:"幽灵射手",path:"a4", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5005:{uuid:5005,name:"ha1",path:"ha1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.remote,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6025,6031],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
|
||||
5007:{uuid:5007,name:"混沌法师",path:"zh1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5007:{uuid:5007,name:"mh1",path:"hmh1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6002,6002],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
5008:{uuid:5008,name:"火焰法师",path:"zh2", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5008:{uuid:5008,name:"mf1",path:"hmf1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:100,skills:[6022,6029],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
5009:{uuid:5009,name:"风暴精灵",path:"d1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5009:{uuid:5009,name:"风暴精灵",path:"hk1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:100,skills:[6002,6002],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
5010:{uuid:5010,name:"战争祭祀",path:"d2", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5010:{uuid:5010,name:"战争祭祀",path:"hk1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:100,skills:[6024,6002],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
5011:{uuid:5011,name:"暴风射手",path:"a5", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5011:{uuid:5011,name:"ha2",path:"ha2", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.remote,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6003,6003],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
|
||||
|
||||
//怪物
|
||||
5201:{uuid:5201,name:"兽人战士",path:"mor1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5201:{uuid:5201,name:"兽人战士",path:"hk1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"mor2", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"hk1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:5,dis:350,cd:1,speed:100,skills:[6008],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"mor3", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"hk1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5204:{uuid:5204,name:"石卫", path:"mgem1",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5204:{uuid:5204,name:"石卫", path:"hk1",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:5,dis:90,cd:2.5,speed:100,skills:[6010],
|
||||
buff:[],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5205:{uuid:5205,name:"土卫", path:"mgem2",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5205:{uuid:5205,name:"土卫", path:"hk1",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:5,dis:90,cd:2.5,speed:100,skills:[6010],
|
||||
buff:[],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5206:{uuid:5206,name:"树卫", path:"mgem3",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5206:{uuid:5206,name:"树卫", path:"hk1",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:5,dis:90,cd:2.5,speed:100,skills:[6010],
|
||||
buff:[],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
|
||||
|
||||
5219:{uuid:5219,name:"牛头战士",path:"mn1", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
5219:{uuid:5219,name:"牛头战士",path:"hk1", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5220:{uuid:5220,name:"牛头战士",path:"mn2", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5220:{uuid:5220,name:"牛头战士",path:"hk1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5221:{uuid:5221,name:"牛头战士",path:"mn3", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5221:{uuid:5221,name:"牛头战士",path:"hk1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:5,dis:350,cd:1.5,speed:100,skills:[6008],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5222:{uuid:5222,name:"独眼巨人",path:"md1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5222:{uuid:5222,name:"独眼巨人",path:"hk1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5223:{uuid:5223,name:"独眼巨人",path:"md2", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5223:{uuid:5223,name:"独眼巨人",path:"hk1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5224:{uuid:5224,name:"独眼巨人",path:"md3", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5224:{uuid:5224,name:"独眼巨人",path:"hk1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:5,dis:350,cd:1.5,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5225:{uuid:5225,name:"精英独眼",path:"md4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5225:{uuid:5225,name:"精英独眼",path:"hk1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:300,cd:2,speed:100,skills:[6006],
|
||||
buff:[],info:"精英怪物-战士型"},
|
||||
|
||||
5226:{uuid:5226,name:"精英牛头",path:"mn4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5226:{uuid:5226,name:"精英牛头",path:"hk1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:300,cd:2,speed:100,skills:[6007],
|
||||
buff:[],info:"精英怪物-战士型"},
|
||||
|
||||
5227:{uuid:5227,name:"精英兽人",path:"mor4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5227:{uuid:5227,name:"精英兽人",path:"hk1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:300,cd:2,speed:100,skills:[6008],
|
||||
buff:[],info:"精英怪物-战士型"},
|
||||
|
||||
|
||||
@@ -61,12 +61,12 @@ export class BuffComp extends Component {
|
||||
if(this.wind_cd <= 0 && this.node.getChildByName("wind").active){
|
||||
this.node.getChildByName("wind").active = false;
|
||||
}
|
||||
if(this.timer.update(deltaTime)){
|
||||
this.timer.reset()
|
||||
this.show_buff(this.buff_keys[this.key_index])
|
||||
this.key_index++
|
||||
if(this.key_index>=this.buff_keys.length) this.key_index=0
|
||||
}
|
||||
// if(this.timer.update(deltaTime)){
|
||||
// this.timer.reset()
|
||||
// this.show_buff(this.buff_keys[this.key_index])
|
||||
// this.key_index++
|
||||
// if(this.key_index>=this.buff_keys.length) this.key_index=0
|
||||
// }
|
||||
|
||||
// this.in_speek(deltaTime)
|
||||
// this.vmdata_update()
|
||||
|
||||
119
assets/script/game/hero/HeroAnmComp-001.ts
Normal file
119
assets/script/game/hero/HeroAnmComp-001.ts
Normal file
@@ -0,0 +1,119 @@
|
||||
import { _decorator, CCClass, Component, sp } from "cc";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { FacSet } from "../common/config/BoxSet";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('HeroAnmComp')
|
||||
export default class HeroAnmComp extends Component{
|
||||
|
||||
mixTime:number= 0.2;
|
||||
|
||||
private spine?: sp.Skeleton;
|
||||
private _hasStop = true;
|
||||
private default_anim:string='Idle'
|
||||
onLoad () {
|
||||
var spine = this.spine = this.getComponent('sp.Skeleton') as sp.Skeleton;
|
||||
this._setMix('Walking', 'Idle');
|
||||
this._setMix('Walking', 'Attacking');
|
||||
this._setMix('Walking', 'Taunt');
|
||||
this._setMix('Walking', 'Hurt');
|
||||
this._setMix('Idle', 'Attacking');
|
||||
this._setMix('Idle', 'Taunt');
|
||||
this._setMix('Idle', 'Walking');
|
||||
this._setMix('Idle', 'Hurt');
|
||||
this._setMix('Attacking', 'Idle');
|
||||
this._setMix('Attacking', 'Walking');
|
||||
this._setMix('Attacking', 'Hurt');
|
||||
this._setMix('Attacking', 'Taunt');
|
||||
this._setMix('Taunt', 'Walking');
|
||||
this._setMix('Taunt', 'Idle');
|
||||
this._setMix('Taunt', 'Attacking');
|
||||
this._setMix('Taunt', 'Hurt');
|
||||
this._setMix('Hurt', 'Idle');
|
||||
this._setMix('Hurt', 'Attacking');
|
||||
this._setMix('Hurt', 'Taunt');
|
||||
this._setMix('Hurt', 'Walking');
|
||||
|
||||
spine.setCompleteListener((trackEntry) => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
if (animationName === 'Attacking'||animationName==='Taunt'||animationName==='Hurt') {
|
||||
this.spine!.clearTrack(1);
|
||||
this.spine?.setAnimation(0, this.default_anim, true);
|
||||
}
|
||||
var loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
|
||||
// console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex, animationName, loopCount);
|
||||
});
|
||||
spine.setEventListener(((trackEntry:any, event:any) => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
// console.log("[track %s][animation %s] event: %s, %s, %s, %s", trackEntry.trackIndex, animationName, event.data.name, event.intValue, event.floatValue, event.stringValue);
|
||||
}) as any);
|
||||
|
||||
this._hasStop = false;
|
||||
}
|
||||
|
||||
// OPTIONS
|
||||
|
||||
toggleDebugSlots () {
|
||||
this.spine!.debugSlots = !this.spine?.debugSlots;
|
||||
}
|
||||
|
||||
toggleDebugBones () {
|
||||
this.spine!.debugBones = !this.spine?.debugBones;
|
||||
}
|
||||
|
||||
toggleDebugMesh () {
|
||||
this.spine!.debugMesh = !this.spine?.debugMesh;
|
||||
}
|
||||
|
||||
toggleUseTint () {
|
||||
this.spine!.useTint = !this.spine?.useTint;
|
||||
}
|
||||
|
||||
toggleTimeScale () {
|
||||
if (this.spine!.timeScale === 1.0) {
|
||||
this.spine!.timeScale = 0.3;
|
||||
}
|
||||
else {
|
||||
this.spine!.timeScale = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
// ANIMATIONS
|
||||
|
||||
stop () {
|
||||
// this.spine?.clearTrack(0);
|
||||
this._hasStop = true;
|
||||
}
|
||||
|
||||
move () {
|
||||
if (this._hasStop) {
|
||||
this.spine?.setToSetupPose();
|
||||
}
|
||||
// console.log("do move",this.spine?.animation);
|
||||
this.spine?.setAnimation(0, 'Walking', true);
|
||||
this.default_anim='Walking'
|
||||
this._hasStop = false;
|
||||
}
|
||||
atk () {
|
||||
this.spine?.setAnimation(1, 'Attacking', false);
|
||||
}
|
||||
max () {
|
||||
this.spine?.setAnimation(1, 'Taunt', false);
|
||||
}
|
||||
atked () {
|
||||
if(this.spine.animation==='Hurt') return
|
||||
this.spine?.setAnimation(1, 'Hurt', false);
|
||||
}
|
||||
idle () {
|
||||
this.spine?.setToSetupPose();
|
||||
if(this.spine?.animation==='Idle') return
|
||||
// console.log("do idle",this.spine.animation);
|
||||
this.spine?.setAnimation(0, 'Idle', true);
|
||||
this.default_anim='Idle'
|
||||
}
|
||||
|
||||
_setMix (anim1: string, anim2: string) {
|
||||
this.spine?.setMix(anim1, anim2, this.mixTime);
|
||||
this.spine?.setMix(anim2, anim1, this.mixTime);
|
||||
}
|
||||
}
|
||||
1
assets/script/game/hero/HeroAnmComp-001.ts.meta
Normal file
1
assets/script/game/hero/HeroAnmComp-001.ts.meta
Normal file
@@ -0,0 +1 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"d8a3d973-c3c2-449f-82bd-adb9f6d5149d","files":[],"subMetas":{},"userData":{}}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator, CCClass, Component, sp } from "cc";
|
||||
import { _decorator, Animation, AnimationState, CCClass, Component, } from "cc";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { FacSet } from "../common/config/BoxSet";
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -6,114 +6,47 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('HeroAnmComp')
|
||||
export default class HeroAnmComp extends Component{
|
||||
|
||||
mixTime:number= 0.2;
|
||||
|
||||
private spine?: sp.Skeleton;
|
||||
private anmcon:any=null
|
||||
private _hasStop = true;
|
||||
private default_anim:string='Idle'
|
||||
anms:any[]=["idle","move","atk","max","debbuff","atked"]
|
||||
onLoad () {
|
||||
var spine = this.spine = this.getComponent('sp.Skeleton') as sp.Skeleton;
|
||||
this._setMix('Walking', 'Idle');
|
||||
this._setMix('Walking', 'Attacking');
|
||||
this._setMix('Walking', 'Taunt');
|
||||
this._setMix('Walking', 'Hurt');
|
||||
this._setMix('Idle', 'Attacking');
|
||||
this._setMix('Idle', 'Taunt');
|
||||
this._setMix('Idle', 'Walking');
|
||||
this._setMix('Idle', 'Hurt');
|
||||
this._setMix('Attacking', 'Idle');
|
||||
this._setMix('Attacking', 'Walking');
|
||||
this._setMix('Attacking', 'Hurt');
|
||||
this._setMix('Attacking', 'Taunt');
|
||||
this._setMix('Taunt', 'Walking');
|
||||
this._setMix('Taunt', 'Idle');
|
||||
this._setMix('Taunt', 'Attacking');
|
||||
this._setMix('Taunt', 'Hurt');
|
||||
this._setMix('Hurt', 'Idle');
|
||||
this._setMix('Hurt', 'Attacking');
|
||||
this._setMix('Hurt', 'Taunt');
|
||||
this._setMix('Hurt', 'Walking');
|
||||
|
||||
spine.setCompleteListener((trackEntry) => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
if (animationName === 'Attacking'||animationName==='Taunt'||animationName==='Hurt') {
|
||||
this.spine!.clearTrack(1);
|
||||
this.spine?.setAnimation(0, this.default_anim, true);
|
||||
}
|
||||
var loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
|
||||
// console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex, animationName, loopCount);
|
||||
});
|
||||
spine.setEventListener(((trackEntry:any, event:any) => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
// console.log("[track %s][animation %s] event: %s, %s, %s, %s", trackEntry.trackIndex, animationName, event.data.name, event.intValue, event.floatValue, event.stringValue);
|
||||
}) as any);
|
||||
|
||||
this._hasStop = false;
|
||||
this.anmcon=this.node.getComponent(Animation)
|
||||
this.anmcon.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||
}
|
||||
|
||||
// OPTIONS
|
||||
|
||||
toggleDebugSlots () {
|
||||
this.spine!.debugSlots = !this.spine?.debugSlots;
|
||||
}
|
||||
|
||||
toggleDebugBones () {
|
||||
this.spine!.debugBones = !this.spine?.debugBones;
|
||||
}
|
||||
|
||||
toggleDebugMesh () {
|
||||
this.spine!.debugMesh = !this.spine?.debugMesh;
|
||||
}
|
||||
|
||||
toggleUseTint () {
|
||||
this.spine!.useTint = !this.spine?.useTint;
|
||||
}
|
||||
|
||||
toggleTimeScale () {
|
||||
if (this.spine!.timeScale === 1.0) {
|
||||
this.spine!.timeScale = 0.3;
|
||||
}
|
||||
else {
|
||||
this.spine!.timeScale = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
// ANIMATIONS
|
||||
|
||||
stop () {
|
||||
// this.spine?.clearTrack(0);
|
||||
this._hasStop = true;
|
||||
}
|
||||
|
||||
move () {
|
||||
if (this._hasStop) {
|
||||
this.spine?.setToSetupPose();
|
||||
onAnimationFinished(type:Animation.EventType, state:AnimationState){
|
||||
console.log("[HeroAnmComp]: 动画播放完毕",state.name)
|
||||
if(state.name!="idle"&&state.name!="move"){
|
||||
this.anmcon.play(this.default_anim)
|
||||
}
|
||||
// console.log("do move",this.spine?.animation);
|
||||
this.spine?.setAnimation(0, 'Walking', true);
|
||||
this.default_anim='Walking'
|
||||
this._hasStop = false;
|
||||
}
|
||||
move () {
|
||||
if(this.anmcon.getState("move").isPlaying) return
|
||||
this.anmcon.play("move")
|
||||
this.default_anim='move'
|
||||
}
|
||||
atk () {
|
||||
this.spine?.setAnimation(1, 'Attacking', false);
|
||||
if(this.anmcon.getState("atk").isPlaying) return
|
||||
this.anmcon.play("atk")
|
||||
}
|
||||
max () {
|
||||
this.spine?.setAnimation(1, 'Taunt', false);
|
||||
if(this.anmcon.getState("max").isPlaying) return
|
||||
this.anmcon.play("max")
|
||||
}
|
||||
atked () {
|
||||
if(this.spine.animation==='Hurt') return
|
||||
this.spine?.setAnimation(1, 'Hurt', false);
|
||||
if(this.anmcon.getState("atked").isPlaying) return
|
||||
this.anmcon.play("atked")
|
||||
}
|
||||
idle () {
|
||||
this.spine?.setToSetupPose();
|
||||
if(this.spine?.animation==='Idle') return
|
||||
// console.log("do idle",this.spine.animation);
|
||||
this.spine?.setAnimation(0, 'Idle', true);
|
||||
this.default_anim='Idle'
|
||||
if(this.anmcon.getState("idle").isPlaying) return
|
||||
this.anmcon.play("idle")
|
||||
this.default_anim='idle'
|
||||
}
|
||||
|
||||
_setMix (anim1: string, anim2: string) {
|
||||
this.spine?.setMix(anim1, anim2, this.mixTime);
|
||||
this.spine?.setMix(anim2, anim1, this.mixTime);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user