60 lines
1.7 KiB
C#
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;
|
||
|
}
|
||
|
}
|
||
|
}
|