mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-06-19 19:17:21 +08:00
30 lines
772 B
TypeScript
30 lines
772 B
TypeScript
/*
|
|
* @Author: dgflash
|
|
* @Date: 2021-08-11 16:41:12
|
|
* @LastEditors: dgflash
|
|
* @LastEditTime: 2022-08-05 09:39:40
|
|
*/
|
|
|
|
import { Component, _decorator } from 'cc';
|
|
import { EffectSingleCase } from './EffectSingleCase';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
/**
|
|
* 延时释放特效
|
|
* 注:场景中频繁有特效添加和释放时,可考虑使用对象池优化创建对象的性能开销
|
|
*/
|
|
@ccclass('EffectDelayRelease')
|
|
export class EffectDelayRelease extends Component {
|
|
/** 延时释放时间(单位秒) */
|
|
@property
|
|
public delay: number = 1;
|
|
|
|
protected onEnable() {
|
|
this.scheduleOnce(this.onDelay, this.delay);
|
|
}
|
|
|
|
private onDelay() {
|
|
EffectSingleCase.instance.put(this.node);
|
|
}
|
|
}
|