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.
44 lines
875 B
44 lines
875 B
10 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace Fungus
|
||
|
{
|
||
|
[CommandInfo("Scripting",
|
||
|
"Set Active",
|
||
10 years ago
|
"Sets a game object in the scene to be active / inactive.")]
|
||
10 years ago
|
public class SetActive : Command
|
||
|
{
|
||
10 years ago
|
[Tooltip("Reference to game object to enable / disable")]
|
||
10 years ago
|
public GameObject targetGameObject;
|
||
|
|
||
10 years ago
|
[Tooltip("Set to true to enable the game object")]
|
||
10 years ago
|
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;
|
||
|
}
|
||
|
|
||
|
public override Color GetButtonColor()
|
||
|
{
|
||
|
return new Color32(235, 191, 217, 255);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|