parent
e651039032
commit
1879ac8c53
|
@ -62,6 +62,7 @@ namespace Coffee.UIExtensions
|
|||
private SerializedProperty m_MeshSharing;
|
||||
private SerializedProperty m_GroupId;
|
||||
private SerializedProperty m_GroupMaxId;
|
||||
private SerializedProperty m_AbsoluteMode;
|
||||
|
||||
|
||||
private ReorderableList _ro;
|
||||
|
@ -150,6 +151,7 @@ namespace Coffee.UIExtensions
|
|||
m_MeshSharing = serializedObject.FindProperty("m_MeshSharing");
|
||||
m_GroupId = serializedObject.FindProperty("m_GroupId");
|
||||
m_GroupMaxId = serializedObject.FindProperty("m_GroupMaxId");
|
||||
m_AbsoluteMode = serializedObject.FindProperty("m_AbsoluteMode");
|
||||
|
||||
var sp = serializedObject.FindProperty("m_Particles");
|
||||
_ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true);
|
||||
|
@ -265,6 +267,9 @@ namespace Coffee.UIExtensions
|
|||
}
|
||||
}
|
||||
|
||||
// Absolute Mode
|
||||
EditorGUILayout.PropertyField(m_AbsoluteMode);
|
||||
|
||||
// Target ParticleSystems.
|
||||
_ro.DoLayoutList();
|
||||
|
||||
|
|
|
@ -54,6 +54,10 @@ namespace Coffee.UIExtensions
|
|||
[SerializeField]
|
||||
private int m_GroupMaxId = 0;
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("The particles will be emitted at the ParticleSystem position.\nMove the UIParticle/ParticleSystem to move the particle.")]
|
||||
private bool m_AbsoluteMode = false;
|
||||
|
||||
private List<UIParticleRenderer> m_Renderers = new List<UIParticleRenderer>();
|
||||
|
||||
#if !SERIALIZE_FIELD_MASKABLE
|
||||
|
@ -112,6 +116,17 @@ namespace Coffee.UIExtensions
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Absolute particle position mode.
|
||||
/// The particles will be emitted at the ParticleSystem position.
|
||||
/// Move the UIParticle/ParticleSystem to move the particle.
|
||||
/// </summary>
|
||||
public bool absoluteMode
|
||||
{
|
||||
get { return m_AbsoluteMode; }
|
||||
set { m_AbsoluteMode = value; }
|
||||
}
|
||||
|
||||
internal bool useMeshSharing
|
||||
{
|
||||
get { return m_MeshSharing != MeshSharing.None; }
|
||||
|
|
|
@ -249,7 +249,15 @@ namespace Coffee.UIExtensions
|
|||
Profiler.BeginSample("[UIParticleRenderer] Combine Mesh");
|
||||
if (_parent.canSimulate)
|
||||
{
|
||||
s_CombineInstances[0].transform = canvasRenderer.transform.worldToLocalMatrix * GetWorldMatrix(psPos, scale);
|
||||
if (_parent.absoluteMode)
|
||||
{
|
||||
s_CombineInstances[0].transform = canvasRenderer.transform.worldToLocalMatrix * GetWorldMatrix(psPos, scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
var diff = _particleSystem.transform.position - _parent.transform.position;
|
||||
s_CombineInstances[0].transform = canvasRenderer.transform.worldToLocalMatrix * Matrix4x4.Translate(diff.GetScaled(scale - Vector3.one)) * GetWorldMatrix(psPos, scale);
|
||||
}
|
||||
workerMesh.CombineMeshes(s_CombineInstances, true, true);
|
||||
|
||||
workerMesh.RecalculateBounds();
|
||||
|
|
Loading…
Reference in New Issue