using System;
using UnityEngine.Events;
namespace UnityEngine.AzureSky
{
/// Base class for setting a custom time event.
[Serializable]
public sealed class AzureCustomEvent
{
/// The minute value of this custom time event.
public int minute { get => m_minute; set => m_minute = value; }
[SerializeField] private int m_minute = 0;
/// The hour value of this custom time event.
public int hour { get => m_hour; set => m_hour = value; }
[SerializeField] private int m_hour = 0;
/// The day value of this custom time event.
public int day { get => m_day; set => m_day = value; }
[SerializeField] private int m_day = 0;
/// The month value of this custom time event.
public int month { get => m_month; set => m_month = value; }
[SerializeField] private int m_month = 0;
/// The year value of this custom time event.
public int year { get => m_year; set => m_year = value; }
[SerializeField] private int m_year = 0;
/// Stores the hour when the event was executed, used to avoid the event being invoked multiple times in the same hour.
public int executedHour { get => m_executedHour; set => m_executedHour = value; }
private int m_executedHour = -1;
/// Is the event already executed on the current hour?
public bool isAlreadyExecutedOnThisHour { get => m_isAlreadyExecutedOnThisHour; set => m_isAlreadyExecutedOnThisHour = value; }
private bool m_isAlreadyExecutedOnThisHour = false;
/// Returns the number of listeners attached to this custom event.
public int eventListenersCount => m_unityEvent.GetPersistentEventCount();
/// The UnityEvent associated to this custom event.
public UnityEvent unityEvent { get => m_unityEvent; set => m_unityEvent = value; }
[SerializeField] private UnityEvent m_unityEvent;
/// Invoke the Unity event attached to this custom event.
public void Invoke()
{
m_unityEvent?.Invoke();
}
}
}