Browse Source

Adapt FlowChartEnabled and GameStarted handlers to the new messages propagation in EventHandlers.

master
fjruizpo 8 years ago
parent
commit
c9afad8821
  1. 3
      Assets/Fungus/Scripts/EventHandlers/FlowchartEnabled.cs
  2. 8
      Assets/Fungus/Scripts/EventHandlers/GameStarted.cs

3
Assets/Fungus/Scripts/EventHandlers/FlowchartEnabled.cs

@ -14,8 +14,9 @@ namespace Fungus
[AddComponentMenu("")] [AddComponentMenu("")]
public class FlowchartEnabled : EventHandler public class FlowchartEnabled : EventHandler
{ {
protected virtual void OnEnable() protected override void UnityOnEnable()
{ {
base.UnityOnEnable();
// Blocks use coroutines to schedule command execution, but Unity's coroutines are // Blocks use coroutines to schedule command execution, but Unity's coroutines are
// sometimes unreliable when enabling / disabling objects. // sometimes unreliable when enabling / disabling objects.
// To workaround this we execute the block on the next frame. // To workaround this we execute the block on the next frame.

8
Assets/Fungus/Scripts/EventHandlers/GameStarted.cs

@ -18,7 +18,13 @@ namespace Fungus
[Tooltip("Wait for a number of frames after startup before executing the Block. Can help fix startup order issues.")] [Tooltip("Wait for a number of frames after startup before executing the Block. Can help fix startup order issues.")]
[SerializeField] protected int waitForFrames = 1; [SerializeField] protected int waitForFrames = 1;
protected virtual IEnumerator Start() protected override void UnityStart()
{
base.UnityStart();
StartCoroutine(GameStartCoroutine());
}
protected virtual IEnumerator GameStartCoroutine()
{ {
int frameCount = waitForFrames; int frameCount = waitForFrames;
while (frameCount > 0) while (frameCount > 0)

Loading…
Cancel
Save