Skip to content

Commit

Permalink
Fix the help overlay fade.
Browse files Browse the repository at this point in the history
  • Loading branch information
RosaryMala committed Mar 6, 2017
1 parent cfad6d4 commit c4e29d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Assets/MapGen/ContentLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ IEnumerator LoadAssets()
Debug.Log("Took a total of " + watch.ElapsedMilliseconds + "ms to load all XML files.");
Debug.Log(string.Format("loaded {0} meshes, {1} pattern textures, {2} colors, and {3} shape textures.", MeshContent.NumCreated, TextureContent.NumCreated, ColorContent.NumCreated, NormalContent.NumCreated));
Debug.Log("Loading Complete. Press ESC to change settings or leave feedback. Have a nice day!");
StartCoroutine(GameMap.Instance.EnableHelp());
GameMap.Instance.ShowHelp();
yield return null;
}

Expand Down
15 changes: 10 additions & 5 deletions Assets/MapGen/GameMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,21 +377,26 @@ void Update()
}

public float helpFadeLength = 0.5f;
Coroutine helpFade;
bool helpEnabled = false;
private void ToggleHelp()
{
StopCoroutine(EnableHelp());
StopCoroutine(DisableHelp());
StopCoroutine(helpFade);
if (helpEnabled)
{
StartCoroutine(DisableHelp());
helpFade = StartCoroutine(DisableHelp());
}
else
{
StartCoroutine(EnableHelp());
ShowHelp();
}
}

public void ShowHelp()
{
helpFade = StartCoroutine(EnableHelp());
}

IEnumerator DisableHelp()
{
helpEnabled = false;
Expand All @@ -403,7 +408,7 @@ IEnumerator DisableHelp()
helpOverlay.gameObject.SetActive(false);
yield return null;
}
public IEnumerator EnableHelp()
IEnumerator EnableHelp()
{
helpEnabled = true;
helpOverlay.gameObject.SetActive(true);
Expand Down

0 comments on commit c4e29d5

Please sign in to comment.