온유기/온수기 제어 패널 활성화 기능 개발 및 UI 제작

This commit is contained in:
정영민
2025-04-02 11:21:15 +09:00
parent 6ceb829c91
commit 1b9abae6bf
45 changed files with 1029783 additions and 1027764 deletions

View File

@@ -21,6 +21,7 @@ namespace CHN
public event Action<Machine> onRightClickMachine;
public event Action onRightClick;
public event Action<BoardType> onClickProductionBoard;
public event Action onClickThermostat;
public LayerMask floorLayers;
public int hitFloorIndex;
@@ -39,40 +40,11 @@ namespace CHN
private void Update()
{
//RaycastChangeView();
//RaycastOnClickThermostat();
RaycastOnClickMachine();
RaycastOnClickProductionStatusBoard();
}
//private void RaycastChangeView()
//{
// if (controller.viewMode != ViewMode.PerspectiveView)
// return;
// bool isChangeView = false;
// Transform camera = controller.camera.transform;
// LayerMask layerMask = LayerMask.GetMask("Floor Ground", "Floor Wall");
// if (Physics.Raycast(camera.position, camera.forward, out hit, Mathf.Infinity, layerMask))
// {
// var hitLayer = hit.collider.gameObject.layer;
// hitFloorIndex = hit.collider.gameObject.GetComponentInParent<Floor>().floorIndex;
// LayerMask wallMask = LayerMask.GetMask("Floor Wall");
// Collider[] wallOverlapCols = Physics.OverlapSphere(controller.option.target.position, controller.targetColliderRadius, wallMask);
// if (wallOverlapCols.Length > 0)
// {
// isChangeView = false;
// }
// }
// //topCanvas.panel_toptoolbar.SetChangeViewButtonState(isChangeView);
//}
private void RaycastOnClickMachine()
{
var floorMachines = FindSingle<Building>().currentFloor.machines;
@@ -117,6 +89,37 @@ namespace CHN
}
}
private void RaycastOnClickThermostat()
{
bool leftClick = Input.GetMouseButtonDown(0);
if (!leftClick)
{
return;
}
if (controller.IsClickUI)
{
return;
}
var layerMask = LayerMask.GetMask("Thermostat");
var ray = controller.camera.ScreenPointToRay(Input.mousePosition);
hitInfo = Physics.RaycastAll(ray, Mathf.Infinity, layerMask);
if (hitInfo.Length == 0)
return;
Array.Sort(hitInfo, (hit1, hit2) => hit1.distance.CompareTo(hit2.distance));
var hitColider = hitInfo[0].collider;
var board = hitColider.GetComponent<Thermostat>();
if (leftClick)
{
onClickThermostat?.Invoke();
}
}
private void ActivateMachinesHighlight(Machine currentMachine)
{
foreach (var machine in machines)