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;
|
2018-11-28 13:19:48 +08:00
|
|
|
|
[SerializeField] ParticleSystem [] m_ParticleSystems;
|
|
|
|
|
[SerializeField] Mask [] m_Masks;
|
|
|
|
|
[SerializeField] Transform m_ScalingByTransform;
|
|
|
|
|
[SerializeField] UIParticle m_ScalingByUIParticle;
|
|
|
|
|
|
|
|
|
|
public void SetTimeScale (float scale)
|
2018-06-22 18:48:14 +08:00
|
|
|
|
{
|
|
|
|
|
Time.timeScale = scale;
|
|
|
|
|
}
|
2018-11-28 13:19:48 +08:00
|
|
|
|
|
|
|
|
|
public void EnableTrailRibbon (bool ribbonMode)
|
2018-07-13 12:21:32 +08:00
|
|
|
|
{
|
2018-11-28 13:19:48 +08:00
|
|
|
|
foreach (var p in m_ParticleSystems)
|
2018-07-13 12:21:32 +08:00
|
|
|
|
{
|
|
|
|
|
var trails = p.trails;
|
|
|
|
|
trails.mode = ribbonMode ? ParticleSystemTrailMode.Ribbon : ParticleSystemTrailMode.PerParticle;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-28 13:19:48 +08:00
|
|
|
|
|
|
|
|
|
public void EnableSprite (bool enabled)
|
2018-07-13 12:21:32 +08:00
|
|
|
|
{
|
2018-11-28 13:19:48 +08:00
|
|
|
|
foreach (var p in m_ParticleSystems)
|
2018-07-13 12:21:32 +08:00
|
|
|
|
{
|
|
|
|
|
var tex = p.textureSheetAnimation;
|
|
|
|
|
tex.enabled = enabled;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-28 13:19:48 +08:00
|
|
|
|
|
|
|
|
|
public void EnableMask (bool enabled)
|
2018-07-13 12:21:32 +08:00
|
|
|
|
{
|
2018-11-28 13:19:48 +08:00
|
|
|
|
foreach (var m in m_Masks)
|
2018-07-13 12:21:32 +08:00
|
|
|
|
{
|
|
|
|
|
m.enabled = enabled;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-28 13:19:48 +08:00
|
|
|
|
|
|
|
|
|
public void SetScale (float scale)
|
|
|
|
|
{
|
|
|
|
|
m_ScalingByTransform.localScale = Vector3.one * (10 * scale);
|
|
|
|
|
m_ScalingByUIParticle.scale = scale;
|
|
|
|
|
}
|
2018-06-22 18:48:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|