ISelectable Interface

ISelectable is an interface that defines the properties and behaviors required for objects that can be selected in a game system.

❗ Please refer to the "ISelectable Implementation Example" section.

public interface ISelectable
{
    public GameObject gameObject { get; }

    public bool enabled { get; set; }

    // Primary selection priority value. Used for primary filtering of selectable objects. 
    public int SelectionPriority1 { get; } 
    
    //Secondary selection priority value. Used for secondary filtering of selectable objects.
    public int SelectionPriority2 { get; } 
    
    //Tertiary selection priority value. Used for tertiary filtering of selectable objects.
    public int SelectionPriority3 { get; } 

    public int Order { get; }
    public int SubGroupId { get; }

    public bool CanBeMultiSelected { get; }
    public bool CanBeGrouped { get; }
    public bool CanBeSelected { get; }

    public UnityEvent<bool> OnSelectChanged { get; }
    public UnityEvent<bool> OnHoverChanged { get; }

    public bool IsNull => this as Component == null;

    public bool IsSameSelectable(ISelectable other)
    {
        return SubGroupId == other.SubGroupId
               && SelectionPriority1 == other.SelectionPriority1
               && SelectionPriority2 == other.SelectionPriority2
               && SelectionPriority3 == other.SelectionPriority3;
    }
}

Last updated