mirror of
https://github.com/BotChain-Robots/ui.git
synced 2026-07-08 15:07:22 +02:00
switch from Unity version control to git
This commit is contained in:
36
Assets/ModuleSelectionManager.cs
Normal file
36
Assets/ModuleSelectionManager.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ModuleSelectionManager : MonoBehaviour
|
||||
{
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0)) // Left click
|
||||
{
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
if (Physics.Raycast(ray, out RaycastHit hit))
|
||||
{
|
||||
// Try get ServoBendModule directly on hit object
|
||||
ServoMotorModule module = hit.transform.GetComponent<ServoMotorModule>();
|
||||
|
||||
if (module != null)
|
||||
{
|
||||
// Deselect previous
|
||||
// if (ServoBendModule.selectedModule != null && ServoBendModule.selectedModule != module)
|
||||
// {
|
||||
// ServoBendModule.selectedModule.SetHighlight(false);
|
||||
// }
|
||||
|
||||
// Select this
|
||||
ServoMotorModule.selectedModule = module;
|
||||
// module.SetHighlight(true);
|
||||
|
||||
// Debug.Log($"[Selection] Selected: {module.name}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Debug.Log($"[Selection] Hit {hit.transform.name} — no ServoBendModule attached");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user