加血buff 动画不关闭原因修复
This commit is contained in:
@@ -26,10 +26,13 @@
|
|||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 8
|
"__id__": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 10
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 10
|
"__id__": 12
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -224,6 +227,24 @@
|
|||||||
"__type__": "cc.CompPrefabInfo",
|
"__type__": "cc.CompPrefabInfo",
|
||||||
"fileId": "893nuUmClG0LvnTTvx/hI/"
|
"fileId": "893nuUmClG0LvnTTvx/hI/"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "9a6c0y9K1tOzYXTwBfeelsq",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 11
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "95QTVE2NFD8400FYKy4ZxR"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
"root": {
|
"root": {
|
||||||
|
|||||||
@@ -1,14 +1,30 @@
|
|||||||
import { _decorator, Component, Node } from 'cc';
|
import { _decorator, Animation, Component, Node, sp } from 'cc';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('AnmEndCom')
|
@ccclass('AnmEndCom')
|
||||||
export class AnmEndCom extends Component {
|
export class AnmEndCom extends Component {
|
||||||
start() {
|
start() {
|
||||||
|
|
||||||
|
if(this.node.getComponent(Animation)){
|
||||||
|
let anim = this.node.getComponent(Animation);
|
||||||
|
console.log("has anim",anim)
|
||||||
|
anim.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.node.getChildByName('anm')){
|
||||||
|
if(this.node.getChildByName('anm').getComponent('sp.Skeleton')){
|
||||||
|
var spine = this.node.getChildByName('anm').getComponent('sp.Skeleton') as sp.Skeleton;
|
||||||
|
console.log("has spine",spine)
|
||||||
|
spine.setCompleteListener((trackEntry) => {
|
||||||
|
this.onAnimationFinished()
|
||||||
|
console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
onAnimationFinished(){
|
||||||
update(deltaTime: number) {
|
this.node.active=false
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user