Files
Fishing2/Assets/Obvious/Soap/Examples/Content/Scripts/HealVignette.cs
2026-01-01 23:09:08 +08:00

26 lines
707 B
C#

using UnityEngine;
namespace Obvious.Soap.Example
{
[HelpURL("https://obvious-game.gitbook.io/soap/scene-documentation/4_scriptableevents/registering-to-events-from-code")]
public class HealVignette : MonoBehaviour
{
[SerializeField] private ScriptableEventInt _onPlayerHealedEvent = null;
[SerializeField] private FadeOut _fadeOut = null;
private void Awake()
{
_onPlayerHealedEvent.OnRaised += OnPlayerHealed;
}
private void OnDestroy()
{
_onPlayerHealedEvent.OnRaised -= OnPlayerHealed;
}
private void OnPlayerHealed(int amount)
{
_fadeOut.Activate();
}
}
}