From 58a84737e52aa48357bbe51f2eae718a378f261b Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 13 Mar 2014 13:54:52 +0000 Subject: [PATCH] Added GameController.ShowSprite() with bool parameter --- Assets/Fungus/Scripts/GameController.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Assets/Fungus/Scripts/GameController.cs b/Assets/Fungus/Scripts/GameController.cs index 873286bd..8edf6199 100644 --- a/Assets/Fungus/Scripts/GameController.cs +++ b/Assets/Fungus/Scripts/GameController.cs @@ -278,7 +278,25 @@ namespace Fungus { FadeSprite(spriteRenderer, 1, 0, Vector2.zero); } - + + /** + * Shows or hides a sprite immediately, depending on the visible parameter. + * This method returns immediately but it queues an asynchronous command for later execution. + * @param spriteRenderer The sprite to be modified + * @param visible Shows the sprite when true, hides the sprite when false. + */ + public void ShowSprite(SpriteRenderer spriteRenderer, bool visible) + { + if (visible) + { + ShowSprite(spriteRenderer); + } + else + { + HideSprite(spriteRenderer); + } + } + /** * Fades the transparency of a sprite over a period of time. * This method returns immediately but it queues an asynchronous command for later execution.