mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-05-12 16:36:58 +08:00
优化特效对象池中二次取出特效对象使用时,可自动播从第一帧开始播放动画
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: dgflash
|
||||
* @Date: 2021-08-11 16:41:12
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-07-25 11:51:15
|
||||
* @LastEditTime: 2022-08-05 09:39:40
|
||||
*/
|
||||
|
||||
import { Component, _decorator } from 'cc';
|
||||
@@ -19,7 +19,7 @@ export class EffectDelayRelease extends Component {
|
||||
@property
|
||||
public delay: number = 1;
|
||||
|
||||
start() {
|
||||
protected onEnable() {
|
||||
this.scheduleOnce(this.onDelay, this.delay);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: dgflash
|
||||
* @Date: 2021-12-30 19:16:47
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-04-07 17:08:44
|
||||
* @LastEditTime: 2022-08-05 09:39:33
|
||||
*/
|
||||
|
||||
import { Animation, Component, _decorator } from 'cc';
|
||||
@@ -14,13 +14,13 @@ const { ccclass, property } = _decorator;
|
||||
export class EffectFinishedRelease extends Component {
|
||||
@property({ type: Animation, tooltip: '资源对象池类型名' })
|
||||
anim: Animation = null!;
|
||||
|
||||
|
||||
onLoad() {
|
||||
this.anim.on(Animation.EventType.FINISHED, this.onFinished, this);
|
||||
this.anim.on(Animation.EventType.LASTFRAME, this.onFinished, this);
|
||||
}
|
||||
|
||||
start() {
|
||||
protected onEnable() {
|
||||
this.anim.play();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user