chrisgregan
10 years ago
9 changed files with 52 additions and 1 deletions
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
@ -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); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 10cd462c89cb047158ccfb8a8df3f60a |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
Binary file not shown.
Loading…
Reference in new issue