using System;
using UnityEngine;

namespace Patterns_And_Principles.Patterns.The_Observer_Pattern.Scripts.WithEvent._01_BasicExample
{
    public class Observer : MonoBehaviour
    {
        private void OnEnable()
        {
            Subject.ThingHappened += SubjectOnThingHappened;
        }

        private void SubjectOnThingHappened()
        {
            Debug.Log("[Observer] Subject triggered ThingHappened event. Observer received notification successfully.");
        }

        private void OnDisable()
        {
            Subject.ThingHappened -= SubjectOnThingHappened;
        }
    }
}