feat: add 'UpdateMode' option for UIParticleAttractor

close #250
pull/289/head
mob-sakai 2023-08-15 12:04:41 +09:00
parent e93051603e
commit 903f702d7b
1 changed files with 30 additions and 0 deletions

View File

@ -15,6 +15,12 @@ namespace Coffee.UIExtensions
Sphere,
}
public enum UpdateMode
{
Normal,
UnscaledTime,
}
[SerializeField]
private ParticleSystem m_ParticleSystem;
@ -33,6 +39,9 @@ namespace Coffee.UIExtensions
[SerializeField]
private Movement m_Movement;
[SerializeField]
private UpdateMode m_UpdateMode;
[SerializeField]
private UnityEvent m_OnAttracted;
@ -84,6 +93,18 @@ namespace Coffee.UIExtensions
}
}
public UpdateMode updateMode
{
get
{
return m_UpdateMode;
}
set
{
m_UpdateMode = value;
}
}
public UnityEvent onAttracted
{
get
@ -221,6 +242,15 @@ namespace Coffee.UIExtensions
private Vector3 GetAttractedPosition(Vector3 current, Vector3 target, float duration, float time)
{
var speed = m_MaxSpeed;
switch (m_UpdateMode)
{
case UpdateMode.Normal:
speed *= 60 * Time.deltaTime;
break;
case UpdateMode.UnscaledTime:
speed *= 60 * Time.unscaledDeltaTime;
break;
}
switch (m_Movement)
{
case Movement.Linear: