You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-05-14 20:20:06 +00:00
feat: random mesh sharing group
The mesh sharing group id will be selected randomly.
This commit is contained in:
@@ -51,6 +51,9 @@ namespace Coffee.UIExtensions
|
||||
[SerializeField]
|
||||
private int m_GroupId = 0;
|
||||
|
||||
[SerializeField]
|
||||
private int m_GroupMaxId = 0;
|
||||
|
||||
private List<UIParticleRenderer> m_Renderers = new List<UIParticleRenderer>();
|
||||
|
||||
#if !SERIALIZE_FIELD_MASKABLE
|
||||
@@ -59,6 +62,7 @@ namespace Coffee.UIExtensions
|
||||
|
||||
private DrivenRectTransformTracker _tracker;
|
||||
private Camera _orthoCamera;
|
||||
private int _groupId;
|
||||
|
||||
/// <summary>
|
||||
/// Should this graphic be considered a target for raycasting?
|
||||
@@ -87,8 +91,25 @@ namespace Coffee.UIExtensions
|
||||
/// </summary>
|
||||
public int groupId
|
||||
{
|
||||
get { return m_GroupId; }
|
||||
set { m_GroupId = value; }
|
||||
get { return _groupId; }
|
||||
set
|
||||
{
|
||||
if (m_GroupId == value) return;
|
||||
m_GroupId = value;
|
||||
if (m_GroupId != m_GroupMaxId)
|
||||
ResetGroupId();
|
||||
}
|
||||
}
|
||||
|
||||
public int groupMaxId
|
||||
{
|
||||
get { return m_GroupMaxId; }
|
||||
set
|
||||
{
|
||||
if (m_GroupMaxId == value) return;
|
||||
m_GroupMaxId = value;
|
||||
ResetGroupId();
|
||||
}
|
||||
}
|
||||
|
||||
internal bool useMeshSharing
|
||||
@@ -295,6 +316,7 @@ namespace Coffee.UIExtensions
|
||||
#if !SERIALIZE_FIELD_MASKABLE
|
||||
maskable = m_Maskable;
|
||||
#endif
|
||||
ResetGroupId();
|
||||
_tracker.Add(this, rectTransform, DrivenTransformProperties.Scale);
|
||||
UIParticleUpdater.Register(this);
|
||||
RegisterDirtyMaterialCallback(UpdateRendererMaterial);
|
||||
@@ -303,6 +325,18 @@ namespace Coffee.UIExtensions
|
||||
base.OnEnable();
|
||||
}
|
||||
|
||||
internal void ResetGroupId()
|
||||
{
|
||||
if (m_GroupId == m_GroupMaxId)
|
||||
{
|
||||
_groupId = m_GroupId;
|
||||
}
|
||||
else
|
||||
{
|
||||
_groupId = Random.Range(m_GroupId, m_GroupMaxId + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function is called when the behaviour becomes disabled.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user