An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
938 B

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
[CommandInfo("Scripting",
"Set Active",
"Sets a game object in the scene to be active / inactive.")]
[AddComponentMenu("")]
public class SetActive : Command
{
[Tooltip("Reference to game object to enable / disable")]
public GameObject targetGameObject;
[Tooltip("Set to true to enable the game object")]
public BooleanData activeState;
public override void OnEnter()
{
if (targetGameObject != null)
{
targetGameObject.SetActive(activeState.Value);
}
Continue();
}
public override string GetSummary()
{
if (targetGameObject == null)
{
return "Error: No game object selected";
}
return targetGameObject.name + " = " + activeState.GetDescription();
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
}
}