ParticleEffectForUGUI/Demo/UIParticle_Demo.cs

43 lines
856 B
C#
Raw Normal View History

2018-06-22 18:48:14 +08:00
using UnityEngine;
2018-07-13 12:21:32 +08:00
using UnityEngine.UI;
2018-06-22 18:48:14 +08:00
namespace Coffee.UIExtensions.Demo
{
public class UIParticle_Demo : MonoBehaviour
{
2018-07-13 12:21:32 +08:00
[SerializeField] Sprite m_Sprite;
[SerializeField] ParticleSystem[] m_ParticleSystems;
[SerializeField] Mask[] m_Masks;
2018-06-22 18:48:14 +08:00
public void SetTimeScale(float scale)
{
Time.timeScale = scale;
}
2018-07-13 12:21:32 +08:00
public void EnableTrailRibbon(bool ribbonMode)
{
foreach(var p in m_ParticleSystems)
{
var trails = p.trails;
trails.mode = ribbonMode ? ParticleSystemTrailMode.Ribbon : ParticleSystemTrailMode.PerParticle;
}
}
public void EnableSprite(bool enabled)
{
foreach(var p in m_ParticleSystems)
{
var tex = p.textureSheetAnimation;
tex.enabled = enabled;
}
}
public void EnableMask(bool enabled)
{
foreach(var m in m_Masks)
{
m.enabled = enabled;
}
}
2018-06-22 18:48:14 +08:00
}
}