add initial play animation delay option to UIShiny

This commit is contained in:
Anton Pawlik
2019-02-13 10:39:19 +01:00
parent 086ad3fd35
commit 87cacfa3ff
2 changed files with 21 additions and 1 deletions
@@ -19,6 +19,13 @@ namespace Coffee.UIExtensions
[Tooltip("Playing.")]
public bool play = false;
/// <summary>
/// Gets or sets the delay before looping.
/// </summary>
[Tooltip("Initial play delay.")]
[Range(0f, 10f)]
public float initialPlayDelay = 0;
/// <summary>
/// Gets or sets a value indicating whether can loop.
/// </summary>
@@ -67,7 +74,14 @@ namespace Coffee.UIExtensions
}
s_UpdateActions.Add(OnWillRenderCanvases);
_time = 0;
if (play)
{
_time = -initialPlayDelay;
}
else
{
_time = 0;
}
_callback = callback;
}
@@ -31,6 +31,7 @@ namespace Coffee.UIExtensions.Editors
var player = serializedObject.FindProperty("m_Player");
_spPlay = player.FindPropertyRelative("play");
_spDuration = player.FindPropertyRelative("duration");
_spInitialPlayDelay = player.FindPropertyRelative("initialPlayDelay");
_spLoop = player.FindPropertyRelative("loop");
_spLoopDelay = player.FindPropertyRelative("loopDelay");
_spUpdateMode = player.FindPropertyRelative("updateMode");
@@ -75,6 +76,10 @@ namespace Coffee.UIExtensions.Editors
GUILayout.Space(10);
EditorGUILayout.LabelField("Effect Player", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(_spPlay);
if (_spPlay.boolValue)
{
EditorGUILayout.PropertyField(_spInitialPlayDelay);
}
EditorGUILayout.PropertyField(_spDuration);
EditorGUILayout.PropertyField(_spLoop);
EditorGUILayout.PropertyField(_spLoopDelay);
@@ -115,6 +120,7 @@ namespace Coffee.UIExtensions.Editors
SerializedProperty _spLoop;
SerializedProperty _spLoopDelay;
SerializedProperty _spDuration;
SerializedProperty _spInitialPlayDelay;
SerializedProperty _spUpdateMode;
}
}