Skip to content

Commit c4e29d5

Browse files
committed
Fix the help overlay fade.
1 parent cfad6d4 commit c4e29d5

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Assets/MapGen/ContentLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ IEnumerator LoadAssets()
248248
Debug.Log("Took a total of " + watch.ElapsedMilliseconds + "ms to load all XML files.");
249249
Debug.Log(string.Format("loaded {0} meshes, {1} pattern textures, {2} colors, and {3} shape textures.", MeshContent.NumCreated, TextureContent.NumCreated, ColorContent.NumCreated, NormalContent.NumCreated));
250250
Debug.Log("Loading Complete. Press ESC to change settings or leave feedback. Have a nice day!");
251-
StartCoroutine(GameMap.Instance.EnableHelp());
251+
GameMap.Instance.ShowHelp();
252252
yield return null;
253253
}
254254

Assets/MapGen/GameMap.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,21 +377,26 @@ void Update()
377377
}
378378

379379
public float helpFadeLength = 0.5f;
380+
Coroutine helpFade;
380381
bool helpEnabled = false;
381382
private void ToggleHelp()
382383
{
383-
StopCoroutine(EnableHelp());
384-
StopCoroutine(DisableHelp());
384+
StopCoroutine(helpFade);
385385
if (helpEnabled)
386386
{
387-
StartCoroutine(DisableHelp());
387+
helpFade = StartCoroutine(DisableHelp());
388388
}
389389
else
390390
{
391-
StartCoroutine(EnableHelp());
391+
ShowHelp();
392392
}
393393
}
394394

395+
public void ShowHelp()
396+
{
397+
helpFade = StartCoroutine(EnableHelp());
398+
}
399+
395400
IEnumerator DisableHelp()
396401
{
397402
helpEnabled = false;
@@ -403,7 +408,7 @@ IEnumerator DisableHelp()
403408
helpOverlay.gameObject.SetActive(false);
404409
yield return null;
405410
}
406-
public IEnumerator EnableHelp()
411+
IEnumerator EnableHelp()
407412
{
408413
helpEnabled = true;
409414
helpOverlay.gameObject.SetActive(true);

0 commit comments

Comments
 (0)