mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-17 05:18:27 +00:00
destroy explosion when particle systems finish
This commit is contained in:
parent
07d802ce8f
commit
aaf9af8c3f
4 changed files with 55 additions and 1 deletions
|
@ -23294,6 +23294,7 @@ GameObject:
|
|||
- component: {fileID: 11400002}
|
||||
- component: {fileID: 11400000}
|
||||
- component: {fileID: 10800000}
|
||||
- component: {fileID: 7300375720519918962}
|
||||
m_Layer: 0
|
||||
m_Name: Explosion
|
||||
m_TagString: Untagged
|
||||
|
@ -23386,6 +23387,18 @@ Light:
|
|||
m_UseColorTemperature: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!114 &7300375720519918962
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 100010}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 09d6d62b56f152e449d502dce1494c75, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &100012
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
30
Assets/Scripts/Utilities/DestroyWhenParticleSystemsFinish.cs
Normal file
30
Assets/Scripts/Utilities/DestroyWhenParticleSystemsFinish.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SanAndreasUnity.Utilities
|
||||
{
|
||||
|
||||
public class DestroyWhenParticleSystemsFinish : MonoBehaviour
|
||||
{
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
var systems = this.GetComponentsInChildren<ParticleSystem>();
|
||||
|
||||
while (true)
|
||||
{
|
||||
yield return null;
|
||||
|
||||
if (systems.All(s => !s.isPlaying))
|
||||
{
|
||||
Object.Destroy(this.gameObject);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 09d6d62b56f152e449d502dce1494c75
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1 +1 @@
|
|||
Subproject commit 4527e028ba14b7802e8ba4da2dbdc90792adfa63
|
||||
Subproject commit 2cfe2611ba93a0cd8f61e68f6989d8fa7f6357f0
|
Loading…
Add table
Reference in a new issue