using GatherAndDefend.Events; using System.Collections; using System.Collections.Generic; using UnityEngine; public class MaximumPopulationReachedCardAlert : MonoBehaviour { [SerializeField] private Animator _warningAnimator; private void Start() { EventAggregator.Instance.GetEvent().Attach(HandlePopulationChangedEvent); } private void HandlePopulationChangedEvent(PopulationChangedEventArgs args) { if (args.Pop / args.MaxPop >= GlobalConfig.Instance.Current.populationWarningPercentage) { // Show warning _warningAnimator.SetBool("isWarning", true); } else { // Hide warning _warningAnimator.SetBool("isWarning", false); } } }