using System; using UnityEngine; namespace Unity.Cinemachine { /// /// Structure for holding the priority of a camera. /// [Serializable] public struct PrioritySettings { /// /// If false, default priority of 0 will be used. /// If true, the the Priority field is valid. /// [Tooltip("Enable this to expose the Priority field")] public bool Enabled; /// The priorty value if enabled [Tooltip("Priority to use. 0 is default. Camera with highest priority is prioritized.")] [SerializeField] int m_Value; /// Priority to use, if Enabled is true public int Value { readonly get => Enabled ? m_Value : 0; set { m_Value = value; Enabled = true; } } /// Implicit conversion to int /// The priority settings to convert. /// The value of the priority settings. public static implicit operator int(PrioritySettings prioritySettings) => prioritySettings.Value; /// Implicit conversion from int /// The value to initialize the priority settings with. /// A new priority settings with the given priority. public static implicit operator PrioritySettings(int priority) => new () { Value = priority, Enabled = true }; } }