#if HAVE_NODECANVAS
using System;
using ParadoxNotion.Design;
using NodeCanvas.Framework;
using CanvasGroup = UnityEngine.CanvasGroup;
namespace Framework.UI {
/// Changes the alpha value of a CanvasGroup (UGUI)
[Category("UI")]
[Description("Change the alpha value of a CanvasGroup (UGUI)")]
public class SetCanvasGroupAlphaTask : ActionTask {
/// Canvas group that will be faded
[RequiredField]
public BBParameter CanvasToChange;
/// Opacity level that will be assigned to the CanvasGroup
public float Opacity = 0.5f;
/// Provides a summary description for the task
protected override string info {
get {
return
"Set " + this.CanvasToChange.ToString() +
" alpha to " + this.Opacity.ToString("0.0");
}
}
/// Called once when the action is executed
protected override void OnExecute() {
if(this.CanvasToChange.value != null) {
this.CanvasToChange.value.alpha = this.Opacity;
}
EndAction();
}
}
} // namespace Framework.UI
#endif // HAVE_NODECANVAS