From 0b3b23d7c63208d0f081653c4ad7468c96f63886 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 4 Sep 2014 15:02:41 +0100 Subject: [PATCH] Added ShowSprite command. Moved mushroom sprites to FungusScript --- .../{Sprite => FungusScript}/Sprites.meta | 0 .../Sprites/Mushroom.png | Bin .../Sprites/Mushroom.png.meta | 0 .../Sprites/ScriptIcon32.png | Bin .../Sprites/ScriptIcon32.png.meta | 0 Assets/Fungus/Sprite/Commands/FadeSprite.cs | 2 +- Assets/Fungus/Sprite/Commands/ShowSprite.cs | 43 ++++++++++++++++++ .../Fungus/Sprite/Commands/ShowSprite.cs.meta | 8 ++++ Assets/Shuttle/ShuttleGame.unity | Bin 128788 -> 131248 bytes 9 files changed, 52 insertions(+), 1 deletion(-) rename Assets/Fungus/{Sprite => FungusScript}/Sprites.meta (100%) rename Assets/Fungus/{Sprite => FungusScript}/Sprites/Mushroom.png (100%) rename Assets/Fungus/{Sprite => FungusScript}/Sprites/Mushroom.png.meta (100%) rename Assets/Fungus/{Sprite => FungusScript}/Sprites/ScriptIcon32.png (100%) rename Assets/Fungus/{Sprite => FungusScript}/Sprites/ScriptIcon32.png.meta (100%) create mode 100644 Assets/Fungus/Sprite/Commands/ShowSprite.cs create mode 100644 Assets/Fungus/Sprite/Commands/ShowSprite.cs.meta diff --git a/Assets/Fungus/Sprite/Sprites.meta b/Assets/Fungus/FungusScript/Sprites.meta similarity index 100% rename from Assets/Fungus/Sprite/Sprites.meta rename to Assets/Fungus/FungusScript/Sprites.meta diff --git a/Assets/Fungus/Sprite/Sprites/Mushroom.png b/Assets/Fungus/FungusScript/Sprites/Mushroom.png similarity index 100% rename from Assets/Fungus/Sprite/Sprites/Mushroom.png rename to Assets/Fungus/FungusScript/Sprites/Mushroom.png diff --git a/Assets/Fungus/Sprite/Sprites/Mushroom.png.meta b/Assets/Fungus/FungusScript/Sprites/Mushroom.png.meta similarity index 100% rename from Assets/Fungus/Sprite/Sprites/Mushroom.png.meta rename to Assets/Fungus/FungusScript/Sprites/Mushroom.png.meta diff --git a/Assets/Fungus/Sprite/Sprites/ScriptIcon32.png b/Assets/Fungus/FungusScript/Sprites/ScriptIcon32.png similarity index 100% rename from Assets/Fungus/Sprite/Sprites/ScriptIcon32.png rename to Assets/Fungus/FungusScript/Sprites/ScriptIcon32.png diff --git a/Assets/Fungus/Sprite/Sprites/ScriptIcon32.png.meta b/Assets/Fungus/FungusScript/Sprites/ScriptIcon32.png.meta similarity index 100% rename from Assets/Fungus/Sprite/Sprites/ScriptIcon32.png.meta rename to Assets/Fungus/FungusScript/Sprites/ScriptIcon32.png.meta diff --git a/Assets/Fungus/Sprite/Commands/FadeSprite.cs b/Assets/Fungus/Sprite/Commands/FadeSprite.cs index c6d7e4d3..8fe6968d 100644 --- a/Assets/Fungus/Sprite/Commands/FadeSprite.cs +++ b/Assets/Fungus/Sprite/Commands/FadeSprite.cs @@ -10,7 +10,7 @@ namespace Fungus.Script public class FadeSprite : FungusCommand { public SpriteRenderer spriteRenderer; - public float duration; + public float duration = 1f; public Color targetColor = Color.white; public bool waitUntilFinished = true; diff --git a/Assets/Fungus/Sprite/Commands/ShowSprite.cs b/Assets/Fungus/Sprite/Commands/ShowSprite.cs new file mode 100644 index 00000000..9e9711fd --- /dev/null +++ b/Assets/Fungus/Sprite/Commands/ShowSprite.cs @@ -0,0 +1,43 @@ +using UnityEngine; +using System; +using System.Collections; + +namespace Fungus.Script +{ + [CommandInfo("Sprite", + "Show Sprite", + "Makes a sprite visible / invisible by setting the color alpha.")] + public class ShowSprite : FungusCommand + { + public SpriteRenderer spriteRenderer; + public bool visible = true; + + public override void OnEnter() + { + if (spriteRenderer != null) + { + Color spriteColor = spriteRenderer.color; + spriteColor.a = visible ? 1f : 0f; + spriteRenderer.color = spriteColor; + } + + Continue(); + } + + public override string GetSummary() + { + if (spriteRenderer == null) + { + return "Error: No sprite renderer selected"; + } + + return spriteRenderer.name + " to " + (visible ? "visible" : "invisible"); + } + + public override Color GetButtonColor() + { + return new Color32(221, 184, 169, 255); + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/Sprite/Commands/ShowSprite.cs.meta b/Assets/Fungus/Sprite/Commands/ShowSprite.cs.meta new file mode 100644 index 00000000..2cf83bf8 --- /dev/null +++ b/Assets/Fungus/Sprite/Commands/ShowSprite.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 10cd462c89cb047158ccfb8a8df3f60a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index 5577c1bea0a87a8dd6da062a3bcd99665c8340f8..f801a7b3babf47f0cdb0b7e9374c3997429f85f2 100644 GIT binary patch delta 3640 zcmZA43v`QD00;1U+f>Vp7@IJorijK!88SoTdCKuf9Xb@zDq31iwJKgs=ds1SLg)=T zYGdo>)t%T$&zUpX&UW-{O2=$H&K~iuwjMLA=j_q_Z*sr7Uvl~-Uw--D$9ErJ(mnU1 zE8dRjLugtL5Sg^>$x@>_oC+v-m3}jDEIP7(O&C|ChFeb-r)VX`a-1F)pbjxo4sT}i7S!bQ$xO? z?q7RNqPK&!1QW6Pyac9L$42+X$&XSa}*DPGs(5R94`%56qZOND|KPH8(qg*cWJjhC$QA{9)D) z7PF9$aiPM&Ts+JI6BP!{0Q0~`NV)#7+Aw>~?wDcGWvDA0fZzg{St>jbRu*PPSO6wB zk^qZcq%J#%*9VhxgL!>C=a3pn9Qy9`0Pr)IGOT8pXE7n`U{A#mj)v)$5K;hZ6gCFt zg2}nDFl}aN`2Q5SalAg5OVsD!b21*N&mv?7&Yy_j1XwX_j|lQy5=^(0kTRS%iQGh3 zC5)HVh{MxZn4(>V_Ys8LjSL+n!;YlratOh4Xt_8x?1&?!7-$1FhzdOjK7`GcD%{ck z@>`bWgshhe?}XLBHo*eoaKUC_<+?C@^`gFAusSrr+xSP=Zl22{q#MEb|Ar6vajoZ_ zId8%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