버그 처리
This commit is contained in:
@@ -88,13 +88,11 @@ namespace UVC.Factory.Component
|
||||
else // 이미 데이터가 있는 경우 (업데이트)
|
||||
{
|
||||
|
||||
if (data.Id == "HFF09CNA8061") Debug.Log($"AGV: {newData}");
|
||||
|
||||
// 새 데이터를 기반으로 목표 위치와 회전을 갱신합니다.
|
||||
UpdatePositionAndRotation(newData);
|
||||
// 기존 데이터(data)에 새로운 데이터(newData)의 내용을 덮어씁니다.
|
||||
foreach (var keyValue in newData)
|
||||
{
|
||||
{
|
||||
data[keyValue.Key] = keyValue.Value;
|
||||
}
|
||||
}
|
||||
@@ -124,23 +122,17 @@ namespace UVC.Factory.Component
|
||||
|
||||
float? newX = newData.GetFloat("X");
|
||||
float? newY = newData.GetFloat("Y");
|
||||
if (data.Id == "HFF09CNA8061") Debug.Log($"AGV newX.HasValue:{newX.HasValue}, newY.HasValue:{newY.HasValue}");
|
||||
if (newX.HasValue || newY.HasValue)
|
||||
float x = data.GetFloat("X").Value;
|
||||
float y = data.GetFloat("Y").Value;
|
||||
if ((newX.HasValue && x != newX) || (newY.HasValue && y != newY))
|
||||
{
|
||||
float x = data.GetFloat("X").Value;
|
||||
float y = data.GetFloat("Y").Value;
|
||||
|
||||
Vector3 newTargetPosition = transform.position;
|
||||
if (newX.HasValue && x != newX) newTargetPosition.x = newX.Value * scaleFactor;
|
||||
if (newY.HasValue && y != newY) newTargetPosition.z = newY.Value * scaleFactor;
|
||||
// 현재 위치와 새로운 목표 위치 사이의 거리를 계산합니다.
|
||||
float distanceToTarget = Vector3.Distance(transform.position, newTargetPosition);
|
||||
if (data.Id == "HFF09CNA8061") Debug.Log($"AGV distanceToTarget:{distanceToTarget}, x:{newTargetPosition.x}_{transform.position.x}, z:{newTargetPosition.z}_{transform.position.z}, y:{newTargetPosition.y}_{transform.position.y}");
|
||||
if (distanceToTarget > 0)
|
||||
{
|
||||
|
||||
//Debug.Log($"AGV {data.GetString("VHL_NAME")} moving to new position: {newTargetPosition} (Distance: {distanceToTarget})");
|
||||
|
||||
// 거리가 설정된 임계값을 초과하면, 보간을 건너뛰고 즉시 위치을 설정합니다.
|
||||
if (distanceToTarget > teleportDistanceThreshold)
|
||||
{
|
||||
@@ -156,31 +148,26 @@ namespace UVC.Factory.Component
|
||||
}
|
||||
|
||||
float? newDegree = newData.GetFloat("DEGREE");
|
||||
if (newDegree.HasValue)
|
||||
if (newDegree.HasValue && data.GetFloat("DEGREE").Value != newDegree.Value)
|
||||
{
|
||||
if (data.GetFloat("DEGREE").Value != newDegree.Value)
|
||||
{
|
||||
Quaternion newTargetRotation = Quaternion.Euler(0, newDegree.Value, 0);
|
||||
Quaternion newTargetRotation = Quaternion.Euler(0, newDegree.Value, 0);
|
||||
|
||||
// 거리가 설정된 임계값을 초과하면, 보간을 건너뛰고 즉시 위치/회전을 설정합니다
|
||||
if (isTeleport) transform.rotation = newTargetRotation;
|
||||
// 거리가 설정된 임계값을 초과하면, 보간을 건너뛰고 즉시 위치/회전을 설정합니다
|
||||
if (isTeleport) transform.rotation = newTargetRotation;
|
||||
|
||||
// 새로운 목표 지점을 설정합니다.
|
||||
// (순간이동을 했든 안 했든, 다음 프레임부터의 보간을 위해 목표 지점은 항상 갱신되어야 합니다.)
|
||||
this.targetRotation = newTargetRotation;
|
||||
changed = true;
|
||||
}
|
||||
// 새로운 목표 지점을 설정합니다.
|
||||
// (순간이동을 했든 안 했든, 다음 프레임부터의 보간을 위해 목표 지점은 항상 갱신되어야 합니다.)
|
||||
this.targetRotation = newTargetRotation;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (data.Id == "HFF09CNA8061") Debug.Log($"AGV changed: {changed}");
|
||||
|
||||
if (changed)
|
||||
{
|
||||
ChangeColor(Color.red);
|
||||
}
|
||||
else
|
||||
{
|
||||
//ChangeColor(Color.white);
|
||||
ChangeColor(Color.white);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace UVC.Factory.Component
|
||||
public class AGVManager : SingletonScene<AGVManager>
|
||||
{
|
||||
|
||||
private readonly string prefabPath = "Prefabs/UI/Factory/AGV";
|
||||
private readonly string prefabPath = "Prefabs/Factory/AGV";
|
||||
private GameObjectPool<AGV>? agvPool;
|
||||
|
||||
public GameObjectPool<AGV> AGVPool
|
||||
@@ -168,7 +168,7 @@ namespace UVC.Factory.Component
|
||||
var RemovedItems = arr.RemovedItems;
|
||||
var ModifiedList = arr.ModifiedList;
|
||||
|
||||
Debug.Log($"AGVManager received data: count:{arr.Count}, Added={AddedItems.Count}, Removed={RemovedItems.Count}, Modified={ModifiedList.Count}");
|
||||
//Debug.Log($"AGVManager received data: count:{arr.Count}, Added={AddedItems.Count}, Removed={RemovedItems.Count}, Modified={ModifiedList.Count}");
|
||||
|
||||
// 새로 추가된 AGV 처리
|
||||
foreach (var item in AddedItems.ToList())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
@@ -201,14 +201,14 @@ namespace UVC.Factory.Component
|
||||
{
|
||||
if (data.ContainsKey(key))
|
||||
{
|
||||
info[key] = data[key];
|
||||
info[key] = data[key]!;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// dataOrderedMask가 설정되어 있지 않으면 모든 데이터를 사용합니다.
|
||||
info = new Dictionary<string, object>(data);
|
||||
info = new Dictionary<string, object>(data!);
|
||||
}
|
||||
InfoWindow.Instance.Show(transform, info);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user