箭落地 1 秒后才消失

This commit is contained in:
k8w 2021-12-03 21:08:24 +08:00
parent 82285176d2
commit 322a153ed2
3 changed files with 16 additions and 2 deletions

View File

@ -10,6 +10,7 @@
"_techIdx": 0, "_techIdx": 0,
"_defines": [ "_defines": [
{ {
"USE_INSTANCING": true,
"USE_TEXTURE": true "USE_TEXTURE": true
} }
], ],

View File

@ -40,10 +40,23 @@ export class Arrow extends Component {
this._updatePosAndForward(percent); this._updatePosAndForward(percent);
if (percent >= 1) { if (percent >= 1) {
this.node.removeFromParent(); this.remove();
} }
} }
private _isRemoved = false;
remove() {
if (this._isRemoved) {
return;
}
this._isRemoved = true;
// 落地 1 秒后消失
this.scheduleOnce(() => {
this.node.removeFromParent()
}, 1)
}
private _updatePosAndForward(percent: number) { private _updatePosAndForward(percent: number) {
let nextPos = this._getPos(percent); let nextPos = this._getPos(percent);
this.node.position = nextPos; this.node.position = nextPos;

View File

@ -216,7 +216,7 @@
"propertyPath": [ "propertyPath": [
"_useBakedAnimation" "_useBakedAnimation"
], ],
"value": false "value": true
}, },
{ {
"__type__": "cc.TargetInfo", "__type__": "cc.TargetInfo",