com.alicizax.unity.animatio.../Runtime/Core/Property/CanvasGroupProperty.cs
陈思海 11e5744b46 init
2025-02-07 16:05:13 +08:00

60 lines
1.7 KiB
C#

using UnityEngine;
namespace AlicizaX.AnimationFlow.Runtime {
[Category("Property"), Name("CanvasGroup")]
public class CanvasGroupProperty : ActionNode {
public CanvasGroup target;
public bool setAlpha = true;
public float alpha;
public bool setInteractable;
public bool interactable;
public bool setBlocksRaycasts;
public bool blocksRaycasts;
private float orgAlpha;
private bool orgInteractable;
private bool orgBlocksRaycasts;
public override void OnInit() {
orgAlpha = target.alpha;
orgInteractable = target.interactable;
orgBlocksRaycasts = target.blocksRaycasts;
}
public override void OnReset() {
if (setAlpha) {
target.alpha = orgAlpha;
}
if (setInteractable) {
target.interactable = orgInteractable;
}
if (setBlocksRaycasts) {
target.blocksRaycasts = orgBlocksRaycasts;
}
}
public override void OnEnter() {
if (setAlpha) {
target.alpha = alpha;
}
if (setInteractable) {
target.interactable = interactable;
}
if (setBlocksRaycasts) {
target.blocksRaycasts = blocksRaycasts;
}
}
public override bool Valid() {
return target != null;
}
public override bool HasSubTitle() {
return true;
}
public override string SubTitle() {
return target != null ? target.name : null;
}
}
}