|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using UnityEngine; |
|
|
|
|
using UnityEngine.Serialization; |
|
|
|
|
using System; |
|
|
|
|
using System.Collections; |
|
|
|
|
|
|
|
|
@ -7,16 +8,19 @@ namespace Fungus
|
|
|
|
|
[CommandInfo("Flow", |
|
|
|
|
"Wait", |
|
|
|
|
"Waits for period of time before executing the next command in the block.")] |
|
|
|
|
|
|
|
|
|
[AddComponentMenu("")] |
|
|
|
|
public class Wait : Command |
|
|
|
|
public class Wait : Command, ISerializationCallbackReceiver |
|
|
|
|
{ |
|
|
|
|
#region Obsolete Properties |
|
|
|
|
[HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD; |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
[Tooltip("Duration to wait for")] |
|
|
|
|
public float duration = 1; |
|
|
|
|
public FloatData _duration = new FloatData(1); |
|
|
|
|
|
|
|
|
|
public override void OnEnter() |
|
|
|
|
{ |
|
|
|
|
Invoke ("OnWaitComplete", duration); |
|
|
|
|
Invoke ("OnWaitComplete", _duration.Value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void OnWaitComplete() |
|
|
|
@ -26,13 +30,29 @@ namespace Fungus
|
|
|
|
|
|
|
|
|
|
public override string GetSummary() |
|
|
|
|
{ |
|
|
|
|
return duration.ToString() + " seconds"; |
|
|
|
|
return _duration.Value.ToString() + " seconds"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override Color GetButtonColor() |
|
|
|
|
{ |
|
|
|
|
return new Color32(235, 191, 217, 255); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
// ISerializationCallbackReceiver implementation |
|
|
|
|
// |
|
|
|
|
|
|
|
|
|
public virtual void OnBeforeSerialize() |
|
|
|
|
{} |
|
|
|
|
|
|
|
|
|
public virtual void OnAfterDeserialize() |
|
|
|
|
{ |
|
|
|
|
if (durationOLD != default(float)) |
|
|
|
|
{ |
|
|
|
|
_duration.Value = durationOLD; |
|
|
|
|
durationOLD = default(float); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |