BITKit/Packages/Runtime~/Unity/Common/Scripts/Selection/Selectable.cs

26 lines
688 B
C#
Raw Normal View History

2023-06-05 19:57:17 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit
{
public class Selectable : MonoBehaviour, ISelectable
{
public Transform GetTransform() => transform;
ISelectableComponent[] components;
void Start()
{
components = GetComponentsInChildren<ISelectableComponent>(true);
foreach (var x in components)
{
x.SetSelectionState(0);
}
}
public void SetSelectionState(SelectionState state)
{
foreach (var x in components)
{
x.SetSelectionState(state);
}
}
}
}