+ 龙怪 动画脚本 兼容2种动画
This commit is contained in:
@@ -319,78 +319,81 @@ export const HeroInfo = {
|
||||
],info:"说明"},
|
||||
|
||||
|
||||
//怪物
|
||||
5201:{uuid:5201,name:"兽人战士",path:"mor1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
//怪物
|
||||
5201:{uuid:5201,name:"兽人战士",path:"mor1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"mor2", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:8,dis:350,cd:1.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"mor3", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5204:{uuid:5204,name:"石卫", path:"mgem1",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5205:{uuid:5205,name:"土卫", path:"mgem2",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5206:{uuid:5206,name:"树卫", path:"mgem3",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"mor2", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:8,dis:350,cd:1.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"mor3", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5204:{uuid:5204,name:"石卫", path:"mgem1",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5205:{uuid:5205,name:"土卫", path:"mgem2",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5206:{uuid:5206,name:"树卫", path:"mgem3",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5216:{uuid:5216,name:"元素1", path:"my1", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:40,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5217:{uuid:5217,name:"元素2", path:"my2", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:40,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5218:{uuid:5218,name:"元素3", path:"my3", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:40,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5219:{uuid:5219,name:"牛头战士",path:"mn1", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5220:{uuid:5220,name:"牛头战士",path:"mn2", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5221:{uuid:5221,name:"牛头战士",path:"mn3", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:8,dis:350,cd:1.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5222:{uuid:5222,name:"独眼巨人",path:"md1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5223:{uuid:5223,name:"独眼巨人",path:"md2", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5224:{uuid:5224,name:"独眼巨人",path:"md3", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:8,dis:350,cd:1.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5225:{uuid:5225,name:"精英独眼",path:"md4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:200,cd:2,speed:25,skills:[6007],
|
||||
buff:[ ],info:"精英怪物-战士型"},
|
||||
|
||||
5226:{uuid:5226,name:"精英牛头",path:"mn4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:200,cd:2,speed:25,skills:[6007],
|
||||
buff:[ ],info:"精英怪物-战士型"},
|
||||
|
||||
5227:{uuid:5227,name:"精英兽人",path:"mor4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:200,cd:2,speed:25,skills:[6007],
|
||||
buff:[ ],info:"精英怪物-战士型"}
|
||||
5216:{uuid:5216,name:"元素1", path:"my1", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:40,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5217:{uuid:5217,name:"元素2", path:"my2", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:40,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5218:{uuid:5218,name:"元素3", path:"my3", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
type:HType.mage,hp:18,ap:15,dis:350,cd:2.5,speed:40,skills:[6007],
|
||||
buff:[ ],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5219:{uuid:5219,name:"牛头战士",path:"mn1", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5220:{uuid:5220,name:"牛头战士",path:"mn2", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5221:{uuid:5221,name:"牛头战士",path:"mn3", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:8,dis:350,cd:1.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5222:{uuid:5222,name:"独眼巨人",path:"md1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5223:{uuid:5223,name:"独眼巨人",path:"md2", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:8,dis:200,cd:2,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5224:{uuid:5224,name:"独眼巨人",path:"md3", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:8,dis:350,cd:1.5,speed:45,skills:[6007],
|
||||
buff:[ ],info:"普通怪物-战士型"},
|
||||
|
||||
5225:{uuid:5225,name:"精英独眼",path:"md4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:200,cd:2,speed:25,skills:[6007],
|
||||
buff:[ ],info:"精英怪物-战士型"},
|
||||
|
||||
5226:{uuid:5226,name:"精英牛头",path:"mn4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:200,cd:2,speed:25,skills:[6007],
|
||||
buff:[ ],info:"精英怪物-战士型"},
|
||||
|
||||
5227:{uuid:5227,name:"精英兽人",path:"mor4", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:200,cd:2,speed:25,skills:[6007],
|
||||
buff:[ ],info:"精英怪物-战士型"},
|
||||
5231:{uuid:5231,name:"龙1",path:"d1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:200,cd:2,speed:25,skills:[6007],
|
||||
buff:[ ],info:"精英怪物-战士型"},
|
||||
};
|
||||
|
||||
// ==================== 怪物系列分类配置 ====================
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator, CCClass, Component, sp } from "cc";
|
||||
import { _decorator, CCClass, Component, sp,Animation} from "cc";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('HeroAnmComp')
|
||||
@@ -6,56 +6,70 @@ export default class HeroAnmComp extends Component{
|
||||
|
||||
mixTime:number= 0.2;
|
||||
|
||||
private spine?: sp.Skeleton;
|
||||
private spine: sp.Skeleton;
|
||||
private _hasStop = true;
|
||||
private anm:Animation
|
||||
private is_spine:boolean=false
|
||||
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('Idle', 'Attacking');
|
||||
this._setMix('Idle', 'Taunt');
|
||||
this._setMix('Idle', 'Walking');
|
||||
this._setMix('Attacking', 'Idle');
|
||||
this._setMix('Attacking', 'Walking');
|
||||
this._setMix('Taunt', 'Walking');
|
||||
this._setMix('Taunt', 'Idle');
|
||||
|
||||
spine.setCompleteListener((trackEntry) => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
if (animationName === 'Attacking'||animationName==='Taunt'||animationName==='Hurt') {
|
||||
this.spine!.clearTrack(1);
|
||||
}
|
||||
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);
|
||||
|
||||
if(this.getComponent('sp.Skeleton')){
|
||||
this.is_spine=true
|
||||
this.spine=this.getComponent('sp.Skeleton') as sp.Skeleton;
|
||||
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('Idle', 'Attacking');
|
||||
this._setMix('Idle', 'Taunt');
|
||||
this._setMix('Idle', 'Walking');
|
||||
this._setMix('Attacking', 'Idle');
|
||||
this._setMix('Attacking', 'Walking');
|
||||
this._setMix('Taunt', 'Walking');
|
||||
this._setMix('Taunt', 'Idle');
|
||||
|
||||
spine.setCompleteListener((trackEntry) => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
if (animationName === 'Attacking'||animationName==='Taunt'||animationName==='Hurt') {
|
||||
this.spine!.clearTrack(1);
|
||||
}
|
||||
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);
|
||||
}else{
|
||||
this.is_spine=false
|
||||
this.anm=this.getComponent(Animation)
|
||||
}
|
||||
|
||||
this._hasStop = false;
|
||||
}
|
||||
|
||||
// OPTIONS
|
||||
|
||||
toggleDebugSlots () {
|
||||
if(!this.is_spine) return
|
||||
this.spine!.debugSlots = !this.spine?.debugSlots;
|
||||
}
|
||||
|
||||
toggleDebugBones () {
|
||||
if(!this.is_spine) return
|
||||
this.spine!.debugBones = !this.spine?.debugBones;
|
||||
}
|
||||
|
||||
toggleDebugMesh () {
|
||||
if(!this.is_spine) return
|
||||
this.spine!.debugMesh = !this.spine?.debugMesh;
|
||||
}
|
||||
|
||||
toggleUseTint () {
|
||||
if(!this.is_spine) return
|
||||
this.spine!.useTint = !this.spine?.useTint;
|
||||
}
|
||||
|
||||
toggleTimeScale () {
|
||||
if(!this.is_spine) return
|
||||
if (this.spine!.timeScale === 1.0) {
|
||||
this.spine!.timeScale = 0.3;
|
||||
}
|
||||
@@ -72,24 +86,45 @@ export default class HeroAnmComp extends Component{
|
||||
}
|
||||
|
||||
move () {
|
||||
if (this._hasStop) {
|
||||
this.spine?.setToSetupPose();
|
||||
if(!this.is_spine) {
|
||||
this.anm?.play('move')
|
||||
}else{
|
||||
if (this._hasStop) {
|
||||
this.spine?.setToSetupPose();
|
||||
}
|
||||
this.spine?.setAnimation(0, 'Walking', true);
|
||||
this._hasStop = false;
|
||||
}
|
||||
this.spine?.setAnimation(0, 'Walking', true);
|
||||
this._hasStop = false;
|
||||
|
||||
}
|
||||
atk () {
|
||||
this.spine?.setAnimation(1, 'Attacking', false);
|
||||
if(!this.is_spine) {
|
||||
this.anm?.play('atk')
|
||||
}else{
|
||||
this.spine?.setAnimation(1, 'Attacking', false);
|
||||
}
|
||||
}
|
||||
max () {
|
||||
this.spine?.setAnimation(1, 'Taunt', false);
|
||||
if(!this.is_spine) {
|
||||
this.anm?.play('atk')
|
||||
}else{
|
||||
this.spine?.setAnimation(1, 'Taunt', false);
|
||||
}
|
||||
}
|
||||
atked () {
|
||||
this.spine?.setAnimation(1, 'Hurt', false);
|
||||
if(!this.is_spine) {
|
||||
this.anm?.play('move')
|
||||
}else{
|
||||
this.spine?.setAnimation(1, 'Hurt', false);
|
||||
}
|
||||
}
|
||||
idle () {
|
||||
this.spine?.setToSetupPose();
|
||||
this.spine?.setAnimation(0, 'Idle', true);
|
||||
if(!this.is_spine) {
|
||||
this.anm?.play('move')
|
||||
}else{
|
||||
this.spine?.setToSetupPose();
|
||||
this.spine?.setAnimation(0, 'Idle', true);
|
||||
}
|
||||
}
|
||||
|
||||
_setMix (anim1: string, anim2: string) {
|
||||
|
||||
Reference in New Issue
Block a user