#if HAVE_NODECANVAS
using System;
using ParadoxNotion.Design;
using NodeCanvas.Framework;
using CanvasGroup = UnityEngine.CanvasGroup;
namespace Framework.UI {
/// Turns a CanvasGroup (UGUI) either on or off
[Category("UI")]
[Description("Turn a CanvasGroup (UGUI) on or off")]
public class ToggleCanvasGroupTask : ActionTask {
/// Canvas group that will be toggled
[RequiredField]
public BBParameter GroupToChange;
/// Whether the CanvasGroup should be toggled on or off
public bool State = true;
/// Provides a summary description for the task
protected override string info {
get {
if(this.State) {
return "Show " + this.GroupToChange.ToString();
} else {
return "Hide " + this.GroupToChange.ToString();
}
}
}
/// Called once when the action is executed
protected override void OnExecute() {
if(this.GroupToChange.value != null) {
this.GroupToChange.value.gameObject.SetActive(this.State);
}
EndAction();
}
}
} // namespace Framework.UI
#endif // HAVE_NODECANVAS