ParticleEffectForUGUI/Samples~/Demo/Scripts/UIParticle_Demo_UIParticleC...

41 lines
1.1 KiB
C#
Raw Normal View History

2022-06-09 00:50:36 +08:00
using UnityEngine;
2023-08-17 08:43:02 +08:00
using UnityEngine.Serialization;
2022-06-09 00:50:36 +08:00
namespace Coffee.UIExtensions.Demo
{
public class UIParticle_Demo_UIParticleController : MonoBehaviour
{
2023-08-17 08:43:02 +08:00
[FormerlySerializedAs("root")]
[SerializeField]
private Transform m_RootTransform;
2022-06-09 00:50:36 +08:00
2023-08-17 08:43:02 +08:00
public void UIParticle_MeshSharing(bool flag)
2022-06-09 00:50:36 +08:00
{
2023-08-17 08:43:02 +08:00
foreach (var uip in m_RootTransform.GetComponentsInChildren<UIParticle>(true))
2022-06-09 00:50:36 +08:00
{
2023-08-17 08:43:02 +08:00
uip.meshSharing = flag
? UIParticle.MeshSharing.Auto
: UIParticle.MeshSharing.None;
2022-06-09 00:50:36 +08:00
}
}
2023-08-17 08:43:02 +08:00
public void UIParticle_RandomGroup(bool flag)
2022-06-09 00:50:36 +08:00
{
2023-08-17 08:43:02 +08:00
foreach (var uip in m_RootTransform.GetComponentsInChildren<UIParticle>(true))
2022-06-09 00:50:36 +08:00
{
2023-08-17 08:43:02 +08:00
uip.groupMaxId = flag
? 4
: 0;
2022-06-09 00:50:36 +08:00
}
}
public void UIParticle_Scale(float scale)
{
2023-08-17 08:43:02 +08:00
foreach (var uip in m_RootTransform.GetComponentsInChildren<UIParticle>(true))
2022-06-09 00:50:36 +08:00
{
uip.scale = scale;
}
}
}
}