59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
namespace BITKit
|
|
{
|
|
public class Selectable : MonoBehaviour, ISelectable
|
|
{
|
|
public Transform GetTransform() => transform;
|
|
private void Start()
|
|
{
|
|
OnNone?.Invoke();
|
|
}
|
|
public Transform Transform => transform;
|
|
public void SetSelectionState(SelectionState state)
|
|
{
|
|
switch (state)
|
|
{
|
|
case SelectionState.None:
|
|
OnNone?.Invoke();
|
|
break;
|
|
case SelectionState.Hover:
|
|
OnHover?.Invoke();
|
|
break;
|
|
case SelectionState.Active:
|
|
OnActive?.Invoke();
|
|
break;
|
|
case SelectionState.Inactive:
|
|
OnInactive?.Invoke();
|
|
break;
|
|
case SelectionState.Focus:
|
|
OnFocus?.Invoke();
|
|
break;
|
|
case SelectionState.Selected:
|
|
OnSelected?.Invoke();
|
|
break;
|
|
case SelectionState.Enabled:
|
|
OnEnabled?.Invoke();
|
|
break;
|
|
case SelectionState.Checked:
|
|
OnChecked?.Invoke();
|
|
break;
|
|
case SelectionState.Root:
|
|
OnRoot?.Invoke();
|
|
break;
|
|
}
|
|
}
|
|
public event Action OnNone;
|
|
|
|
public event Action OnHover;
|
|
public event Action OnActive;
|
|
public event Action OnInactive;
|
|
public event Action OnFocus;
|
|
public event Action OnSelected;
|
|
public event Action OnEnabled;
|
|
public event Action OnChecked;
|
|
public event Action OnRoot;
|
|
}
|
|
} |