2017-08-11 22:53:23 +08:00
|
|
|
/// Credit glennpow, Zarlang
|
2017-06-29 21:07:29 +08:00
|
|
|
/// Sourced from - http://forum.unity3d.com/threads/free-script-particle-systems-in-ui-screen-space-overlay.406862/
|
2020-07-09 03:38:28 +08:00
|
|
|
/// Updated by Zarlang with a more robust implementation, including TextureSheet animation support
|
2017-06-29 21:07:29 +08:00
|
|
|
|
|
|
|
namespace UnityEngine.UI.Extensions
|
|
|
|
{
|
|
|
|
#if UNITY_5_3_OR_NEWER
|
|
|
|
[ExecuteInEditMode]
|
2017-08-11 20:15:42 +08:00
|
|
|
[RequireComponent(typeof(CanvasRenderer), typeof(ParticleSystem))]
|
|
|
|
[AddComponentMenu("UI/Effects/Extensions/UIParticleSystem")]
|
2017-06-29 21:07:29 +08:00
|
|
|
public class UIParticleSystem : MaskableGraphic
|
|
|
|
{
|
2017-08-11 20:15:42 +08:00
|
|
|
[Tooltip("Having this enabled run the system in LateUpdate rather than in Update making it faster but less precise (more clunky)")]
|
|
|
|
public bool fixedTime = true;
|
2017-06-29 21:07:29 +08:00
|
|
|
|
2018-09-25 21:12:04 +08:00
|
|
|
[Tooltip("Enables 3d rotation for the particles")]
|
|
|
|
public bool use3dRotation = false;
|
|
|
|
|
2017-06-29 21:07:29 +08:00
|
|
|
private Transform _transform;
|
2017-08-11 20:15:42 +08:00
|
|
|
private ParticleSystem pSystem;
|
|
|
|
private ParticleSystem.Particle[] particles;
|
2017-06-29 21:07:29 +08:00
|
|
|
private UIVertex[] _quad = new UIVertex[4];
|
2017-08-11 20:15:42 +08:00
|
|
|
private Vector4 imageUV = Vector4.zero;
|
|
|
|
private ParticleSystem.TextureSheetAnimationModule textureSheetAnimation;
|
|
|
|
private int textureSheetAnimationFrames;
|
|
|
|
private Vector2 textureSheetAnimationFrameSize;
|
|
|
|
private ParticleSystemRenderer pRenderer;
|
2020-04-19 18:42:58 +08:00
|
|
|
private bool isInitialised = false;
|
2017-08-11 20:15:42 +08:00
|
|
|
|
|
|
|
private Material currentMaterial;
|
|
|
|
|
|
|
|
private Texture currentTexture;
|
|
|
|
|
|
|
|
#if UNITY_5_5_OR_NEWER
|
|
|
|
private ParticleSystem.MainModule mainModule;
|
|
|
|
#endif
|
2017-06-29 21:07:29 +08:00
|
|
|
|
|
|
|
public override Texture mainTexture
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2017-08-11 20:15:42 +08:00
|
|
|
return currentTexture;
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected bool Initialize()
|
|
|
|
{
|
|
|
|
// initialize members
|
|
|
|
if (_transform == null)
|
|
|
|
{
|
|
|
|
_transform = transform;
|
|
|
|
}
|
2017-08-11 20:15:42 +08:00
|
|
|
if (pSystem == null)
|
2017-06-29 21:07:29 +08:00
|
|
|
{
|
2017-08-11 20:15:42 +08:00
|
|
|
pSystem = GetComponent<ParticleSystem>();
|
2017-06-29 21:07:29 +08:00
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
if (pSystem == null)
|
2017-06-29 21:07:29 +08:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
#if UNITY_5_5_OR_NEWER
|
|
|
|
mainModule = pSystem.main;
|
|
|
|
if (pSystem.main.maxParticles > 14000)
|
2017-06-29 21:07:29 +08:00
|
|
|
{
|
2017-08-11 20:15:42 +08:00
|
|
|
mainModule.maxParticles = 14000;
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
2017-08-11 20:15:42 +08:00
|
|
|
#else
|
|
|
|
if (pSystem.maxParticles > 14000)
|
|
|
|
pSystem.maxParticles = 14000;
|
|
|
|
#endif
|
2017-06-29 21:07:29 +08:00
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
pRenderer = pSystem.GetComponent<ParticleSystemRenderer>();
|
|
|
|
if (pRenderer != null)
|
|
|
|
pRenderer.enabled = false;
|
2017-06-29 21:07:29 +08:00
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
if (material == null)
|
2018-06-27 03:15:42 +08:00
|
|
|
{
|
|
|
|
var foundShader = Shader.Find("UI Extensions/Particles/Additive");
|
|
|
|
if (foundShader)
|
|
|
|
{
|
|
|
|
material = new Material(foundShader);
|
|
|
|
}
|
|
|
|
}
|
2017-08-11 20:15:42 +08:00
|
|
|
|
|
|
|
currentMaterial = material;
|
|
|
|
if (currentMaterial && currentMaterial.HasProperty("_MainTex"))
|
2017-06-29 21:07:29 +08:00
|
|
|
{
|
2017-08-11 20:15:42 +08:00
|
|
|
currentTexture = currentMaterial.mainTexture;
|
|
|
|
if (currentTexture == null)
|
|
|
|
currentTexture = Texture2D.whiteTexture;
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
2017-08-11 20:15:42 +08:00
|
|
|
material = currentMaterial;
|
|
|
|
// automatically set scaling
|
|
|
|
#if UNITY_5_5_OR_NEWER
|
|
|
|
mainModule.scalingMode = ParticleSystemScalingMode.Hierarchy;
|
|
|
|
#else
|
|
|
|
pSystem.scalingMode = ParticleSystemScalingMode.Hierarchy;
|
2017-06-29 21:07:29 +08:00
|
|
|
#endif
|
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
particles = null;
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
2017-08-11 20:15:42 +08:00
|
|
|
#if UNITY_5_5_OR_NEWER
|
|
|
|
if (particles == null)
|
|
|
|
particles = new ParticleSystem.Particle[pSystem.main.maxParticles];
|
|
|
|
#else
|
|
|
|
if (particles == null)
|
|
|
|
particles = new ParticleSystem.Particle[pSystem.maxParticles];
|
|
|
|
#endif
|
2017-06-29 21:07:29 +08:00
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
imageUV = new Vector4(0, 0, 1, 1);
|
2017-06-29 21:07:29 +08:00
|
|
|
|
|
|
|
// prepare texture sheet animation
|
2017-08-11 20:15:42 +08:00
|
|
|
textureSheetAnimation = pSystem.textureSheetAnimation;
|
|
|
|
textureSheetAnimationFrames = 0;
|
|
|
|
textureSheetAnimationFrameSize = Vector2.zero;
|
|
|
|
if (textureSheetAnimation.enabled)
|
2017-06-29 21:07:29 +08:00
|
|
|
{
|
2017-08-11 20:15:42 +08:00
|
|
|
textureSheetAnimationFrames = textureSheetAnimation.numTilesX * textureSheetAnimation.numTilesY;
|
|
|
|
textureSheetAnimationFrameSize = new Vector2(1f / textureSheetAnimation.numTilesX, 1f / textureSheetAnimation.numTilesY);
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Awake()
|
|
|
|
{
|
|
|
|
base.Awake();
|
|
|
|
if (!Initialize())
|
|
|
|
enabled = false;
|
|
|
|
}
|
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
|
2017-06-29 21:07:29 +08:00
|
|
|
protected override void OnPopulateMesh(VertexHelper vh)
|
|
|
|
{
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
if (!Application.isPlaying)
|
|
|
|
{
|
|
|
|
if (!Initialize())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// prepare vertices
|
|
|
|
vh.Clear();
|
|
|
|
|
|
|
|
if (!gameObject.activeInHierarchy)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-04-19 18:42:58 +08:00
|
|
|
if (!isInitialised && !pSystem.main.playOnAwake)
|
|
|
|
{
|
|
|
|
pSystem.Stop(false, ParticleSystemStopBehavior.StopEmittingAndClear);
|
|
|
|
isInitialised = true;
|
|
|
|
}
|
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
Vector2 temp = Vector2.zero;
|
|
|
|
Vector2 corner1 = Vector2.zero;
|
|
|
|
Vector2 corner2 = Vector2.zero;
|
2017-06-29 21:07:29 +08:00
|
|
|
// iterate through current particles
|
2017-08-11 20:15:42 +08:00
|
|
|
int count = pSystem.GetParticles(particles);
|
2017-06-29 21:07:29 +08:00
|
|
|
|
|
|
|
for (int i = 0; i < count; ++i)
|
|
|
|
{
|
2017-08-11 20:15:42 +08:00
|
|
|
ParticleSystem.Particle particle = particles[i];
|
2017-06-29 21:07:29 +08:00
|
|
|
|
|
|
|
// get particle properties
|
2017-08-11 20:15:42 +08:00
|
|
|
#if UNITY_5_5_OR_NEWER
|
|
|
|
Vector2 position = (mainModule.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
|
|
|
|
#else
|
|
|
|
Vector2 position = (pSystem.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
|
|
|
|
#endif
|
2017-06-29 21:07:29 +08:00
|
|
|
float rotation = -particle.rotation * Mathf.Deg2Rad;
|
|
|
|
float rotation90 = rotation + Mathf.PI / 2;
|
2017-08-11 20:15:42 +08:00
|
|
|
Color32 color = particle.GetCurrentColor(pSystem);
|
|
|
|
float size = particle.GetCurrentSize(pSystem) * 0.5f;
|
2017-06-29 21:07:29 +08:00
|
|
|
|
|
|
|
// apply scale
|
2017-08-11 20:15:42 +08:00
|
|
|
#if UNITY_5_5_OR_NEWER
|
|
|
|
if (mainModule.scalingMode == ParticleSystemScalingMode.Shape)
|
2017-06-29 21:07:29 +08:00
|
|
|
position /= canvas.scaleFactor;
|
2017-08-11 20:15:42 +08:00
|
|
|
#else
|
|
|
|
if (pSystem.scalingMode == ParticleSystemScalingMode.Shape)
|
|
|
|
position /= canvas.scaleFactor;
|
|
|
|
#endif
|
2017-06-29 21:07:29 +08:00
|
|
|
|
|
|
|
// apply texture sheet animation
|
2017-08-11 20:15:42 +08:00
|
|
|
Vector4 particleUV = imageUV;
|
|
|
|
if (textureSheetAnimation.enabled)
|
2017-06-29 21:07:29 +08:00
|
|
|
{
|
|
|
|
#if UNITY_5_5_OR_NEWER
|
|
|
|
float frameProgress = 1 - (particle.remainingLifetime / particle.startLifetime);
|
2017-08-11 20:15:42 +08:00
|
|
|
|
|
|
|
if (textureSheetAnimation.frameOverTime.curveMin != null)
|
|
|
|
{
|
|
|
|
frameProgress = textureSheetAnimation.frameOverTime.curveMin.Evaluate(1 - (particle.remainingLifetime / particle.startLifetime));
|
|
|
|
}
|
|
|
|
else if (textureSheetAnimation.frameOverTime.curve != null)
|
|
|
|
{
|
|
|
|
frameProgress = textureSheetAnimation.frameOverTime.curve.Evaluate(1 - (particle.remainingLifetime / particle.startLifetime));
|
|
|
|
}
|
|
|
|
else if (textureSheetAnimation.frameOverTime.constant > 0)
|
|
|
|
{
|
|
|
|
frameProgress = textureSheetAnimation.frameOverTime.constant - (particle.remainingLifetime / particle.startLifetime);
|
|
|
|
}
|
2017-06-30 16:18:16 +08:00
|
|
|
#else
|
2017-06-29 21:07:29 +08:00
|
|
|
float frameProgress = 1 - (particle.lifetime / particle.startLifetime);
|
2017-07-01 00:29:36 +08:00
|
|
|
#endif
|
2017-08-11 20:15:42 +08:00
|
|
|
|
|
|
|
frameProgress = Mathf.Repeat(frameProgress * textureSheetAnimation.cycleCount, 1);
|
2017-06-29 21:07:29 +08:00
|
|
|
int frame = 0;
|
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
switch (textureSheetAnimation.animation)
|
2017-06-29 21:07:29 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
case ParticleSystemAnimationType.WholeSheet:
|
2017-08-11 20:15:42 +08:00
|
|
|
frame = Mathf.FloorToInt(frameProgress * textureSheetAnimationFrames);
|
2017-06-29 21:07:29 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ParticleSystemAnimationType.SingleRow:
|
2017-08-11 20:15:42 +08:00
|
|
|
frame = Mathf.FloorToInt(frameProgress * textureSheetAnimation.numTilesX);
|
2017-06-29 21:07:29 +08:00
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
int row = textureSheetAnimation.rowIndex;
|
2020-10-24 18:36:40 +08:00
|
|
|
if (textureSheetAnimation.rowMode == ParticleSystemAnimationRowMode.Random)
|
|
|
|
{ // FIXME - is this handled internally by rowIndex?
|
|
|
|
row = Mathf.Abs((int)particle.randomSeed % textureSheetAnimation.numTilesY);
|
|
|
|
}
|
2017-08-11 20:15:42 +08:00
|
|
|
frame += row * textureSheetAnimation.numTilesX;
|
2017-06-29 21:07:29 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
frame %= textureSheetAnimationFrames;
|
2017-06-29 21:07:29 +08:00
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
particleUV.x = (frame % textureSheetAnimation.numTilesX) * textureSheetAnimationFrameSize.x;
|
2020-10-24 18:36:40 +08:00
|
|
|
particleUV.y = 1.0f - ((frame / textureSheetAnimation.numTilesX) + 1) * textureSheetAnimationFrameSize.y;
|
2017-08-11 20:15:42 +08:00
|
|
|
particleUV.z = particleUV.x + textureSheetAnimationFrameSize.x;
|
|
|
|
particleUV.w = particleUV.y + textureSheetAnimationFrameSize.y;
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
temp.x = particleUV.x;
|
|
|
|
temp.y = particleUV.y;
|
|
|
|
|
2017-06-29 21:07:29 +08:00
|
|
|
_quad[0] = UIVertex.simpleVert;
|
|
|
|
_quad[0].color = color;
|
2017-08-11 20:15:42 +08:00
|
|
|
_quad[0].uv0 = temp;
|
2017-06-29 21:07:29 +08:00
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
temp.x = particleUV.x;
|
|
|
|
temp.y = particleUV.w;
|
2017-06-29 21:07:29 +08:00
|
|
|
_quad[1] = UIVertex.simpleVert;
|
|
|
|
_quad[1].color = color;
|
2017-08-11 20:15:42 +08:00
|
|
|
_quad[1].uv0 = temp;
|
2017-06-29 21:07:29 +08:00
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
temp.x = particleUV.z;
|
|
|
|
temp.y = particleUV.w;
|
2017-06-29 21:07:29 +08:00
|
|
|
_quad[2] = UIVertex.simpleVert;
|
|
|
|
_quad[2].color = color;
|
2017-08-11 20:15:42 +08:00
|
|
|
_quad[2].uv0 = temp;
|
2017-06-29 21:07:29 +08:00
|
|
|
|
2017-08-11 20:15:42 +08:00
|
|
|
temp.x = particleUV.z;
|
|
|
|
temp.y = particleUV.y;
|
2017-06-29 21:07:29 +08:00
|
|
|
_quad[3] = UIVertex.simpleVert;
|
|
|
|
_quad[3].color = color;
|
2017-08-11 20:15:42 +08:00
|
|
|
_quad[3].uv0 = temp;
|
2017-06-29 21:07:29 +08:00
|
|
|
|
|
|
|
if (rotation == 0)
|
|
|
|
{
|
|
|
|
// no rotation
|
2017-08-11 20:15:42 +08:00
|
|
|
corner1.x = position.x - size;
|
|
|
|
corner1.y = position.y - size;
|
|
|
|
corner2.x = position.x + size;
|
|
|
|
corner2.y = position.y + size;
|
|
|
|
|
|
|
|
temp.x = corner1.x;
|
|
|
|
temp.y = corner1.y;
|
|
|
|
_quad[0].position = temp;
|
|
|
|
temp.x = corner1.x;
|
|
|
|
temp.y = corner2.y;
|
|
|
|
_quad[1].position = temp;
|
|
|
|
temp.x = corner2.x;
|
|
|
|
temp.y = corner2.y;
|
|
|
|
_quad[2].position = temp;
|
|
|
|
temp.x = corner2.x;
|
|
|
|
temp.y = corner1.y;
|
|
|
|
_quad[3].position = temp;
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-09-25 21:12:04 +08:00
|
|
|
if (use3dRotation)
|
|
|
|
{
|
|
|
|
// get particle properties
|
|
|
|
#if UNITY_5_5_OR_NEWER
|
|
|
|
Vector3 pos3d = (mainModule.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
|
|
|
|
#else
|
|
|
|
Vector3 pos3d = (pSystem.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// apply scale
|
|
|
|
#if UNITY_5_5_OR_NEWER
|
|
|
|
if (mainModule.scalingMode == ParticleSystemScalingMode.Shape)
|
|
|
|
position /= canvas.scaleFactor;
|
|
|
|
#else
|
|
|
|
if (pSystem.scalingMode == ParticleSystemScalingMode.Shape)
|
|
|
|
position /= canvas.scaleFactor;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
Vector3[] verts = new Vector3[4]
|
|
|
|
{
|
|
|
|
new Vector3(-size, -size, 0),
|
|
|
|
new Vector3(-size, size, 0),
|
|
|
|
new Vector3(size, size, 0),
|
|
|
|
new Vector3(size, -size, 0)
|
|
|
|
};
|
|
|
|
|
|
|
|
Quaternion particleRotation = Quaternion.Euler(particle.rotation3D);
|
|
|
|
|
|
|
|
_quad[0].position = pos3d + particleRotation * verts[0];
|
|
|
|
_quad[1].position = pos3d + particleRotation * verts[1];
|
|
|
|
_quad[2].position = pos3d + particleRotation * verts[2];
|
|
|
|
_quad[3].position = pos3d + particleRotation * verts[3];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// apply rotation
|
|
|
|
Vector2 right = new Vector2(Mathf.Cos(rotation), Mathf.Sin(rotation)) * size;
|
|
|
|
Vector2 up = new Vector2(Mathf.Cos(rotation90), Mathf.Sin(rotation90)) * size;
|
|
|
|
|
|
|
|
_quad[0].position = position - right - up;
|
|
|
|
_quad[1].position = position - right + up;
|
|
|
|
_quad[2].position = position + right + up;
|
|
|
|
_quad[3].position = position + right - up;
|
|
|
|
}
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
vh.AddUIVertexQuad(_quad);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-19 18:42:58 +08:00
|
|
|
private void Update()
|
2017-06-29 21:07:29 +08:00
|
|
|
{
|
2017-08-11 20:15:42 +08:00
|
|
|
if (!fixedTime && Application.isPlaying)
|
2017-06-29 21:07:29 +08:00
|
|
|
{
|
2017-08-11 20:15:42 +08:00
|
|
|
pSystem.Simulate(Time.unscaledDeltaTime, false, false, true);
|
2017-06-29 21:07:29 +08:00
|
|
|
SetAllDirty();
|
2017-08-11 20:15:42 +08:00
|
|
|
|
|
|
|
if ((currentMaterial != null && currentTexture != currentMaterial.mainTexture) ||
|
|
|
|
(material != null && currentMaterial != null && material.shader != currentMaterial.shader))
|
|
|
|
{
|
|
|
|
pSystem = null;
|
|
|
|
Initialize();
|
|
|
|
}
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-19 18:42:58 +08:00
|
|
|
private void LateUpdate()
|
2017-06-29 21:07:29 +08:00
|
|
|
{
|
|
|
|
if (!Application.isPlaying)
|
|
|
|
{
|
|
|
|
SetAllDirty();
|
|
|
|
}
|
2017-08-11 20:15:42 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (fixedTime)
|
|
|
|
{
|
|
|
|
pSystem.Simulate(Time.unscaledDeltaTime, false, false, true);
|
|
|
|
SetAllDirty();
|
|
|
|
if ((currentMaterial != null && currentTexture != currentMaterial.mainTexture) ||
|
|
|
|
(material != null && currentMaterial != null && material.shader != currentMaterial.shader))
|
|
|
|
{
|
|
|
|
pSystem = null;
|
|
|
|
Initialize();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (material == currentMaterial)
|
|
|
|
return;
|
|
|
|
pSystem = null;
|
|
|
|
Initialize();
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
2019-03-08 02:11:51 +08:00
|
|
|
|
|
|
|
protected override void OnDestroy()
|
2018-09-25 22:28:08 +08:00
|
|
|
{
|
|
|
|
currentMaterial = null;
|
|
|
|
currentTexture = null;
|
|
|
|
}
|
2020-04-19 18:42:58 +08:00
|
|
|
|
|
|
|
public void StartParticleEmission()
|
|
|
|
{
|
2020-09-28 21:45:01 +08:00
|
|
|
pSystem.time = 0;
|
2020-04-19 18:42:58 +08:00
|
|
|
pSystem.Play();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void StopParticleEmission()
|
|
|
|
{
|
|
|
|
pSystem.Stop(false, ParticleSystemStopBehavior.StopEmittingAndClear);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void PauseParticleEmission()
|
|
|
|
{
|
|
|
|
pSystem.Stop(false, ParticleSystemStopBehavior.StopEmitting);
|
|
|
|
}
|
2017-06-29 21:07:29 +08:00
|
|
|
}
|
|
|
|
#endif
|
2016-05-28 07:04:08 +08:00
|
|
|
}
|