운송 애니메이션 추가

This commit is contained in:
SullyunShin
2025-05-27 14:53:01 +09:00
parent a5d9c158ec
commit cae4093c3f
132 changed files with 1447 additions and 898 deletions

View File

@@ -15,18 +15,11 @@ public class SimulationModelSource : SimulationModel
public List<GameObject> listProducts = new List<GameObject>();
public List<GameObject> listDefects = new List<GameObject>();
public Transform productPos;
public Vector3 productInterval;
public Vector3 productDistance = new Vector3(0, 0.321f, 0);
//ConcurrentQueue<Dictionary<string, object>> dataQueue;
ConcurrentQueue<JObject> dataQueue;
int productCount = 0;
int defectCount = 0;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
int defectCount = 0;
void Update()
{
int interval = 0;
@@ -36,7 +29,7 @@ public class SimulationModelSource : SimulationModel
for (int i = 0; i < productCount; i++)
{
GameObject gb = listProducts[i];
gb.transform.localPosition = productInterval * interval;
gb.transform.localPosition = productDistance * interval;
interval++;
}
}
@@ -46,15 +39,14 @@ public class SimulationModelSource : SimulationModel
for (int i = 0; i < defectCount; i++)
{
GameObject gb = listDefects[i];
gb.transform.localPosition = productInterval * interval;
gb.transform.localPosition = productDistance * interval;
interval++;
}
}
}
protected override IEnumerator RunSimulationCoroutine()
{
yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID));
Debug.Log(nodeID);
yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID));
while (dataQueue == null)
{
dataQueue = MQTTDataBase.Instance.GetDataQueue(nodeID);
@@ -72,33 +64,28 @@ public class SimulationModelSource : SimulationModel
}
if (dataQueue.TryDequeue(out JObject currentData))
{
string eventKey = "_event";
var productId = GetJsonValue(currentData, new string[] { "data", "product_id" })?.ToString();
string eventKey = "_event";
if (currentData.ContainsKey(eventKey))
{
string value = currentData[eventKey].ToString();
if (value.Contains(eventGenerateProduct))
{
Debug.Log("#### Got Product");
{
GameObject gb = Instantiate(productPrefab, productPos);
listProducts.Add(gb);
}
else if (value.Contains(eventGenerateDefect))
{
Debug.Log("#### Got Defect");
{
GameObject gb = Instantiate(defectPrefab, productPos);
listProducts.Add(gb);
}
else if (value.Contains(eventQueueProduct))
{
Debug.Log("#### Pass To Queue");
string dataKey = "data";
string queueIDKey = "queue";
string capacityKey = "queue_length";
string storeTypeKey = "queue_type";
string queueID = currentData[dataKey][queueIDKey].ToString();
int queueCapacity = int.Parse(currentData[dataKey][capacityKey].ToString());
string storeType = currentData[dataKey][storeTypeKey].ToString();
{
string[] queueIDKey = { "data", "queue" };
string[] capacityKey = { "data", "queue_length" };
string[] storeTypeKey = { "data", "queue_type" };
string queueID = GetJsonValue(currentData, queueIDKey)?.ToString();
int queueCapacity = GetJsonIntValue(currentData, capacityKey);
string storeType = GetJsonValue(currentData, storeTypeKey)?.ToString();
SimulationModel model = DataManager.I.GetModel(queueID);
GameObject product = null;
if (listProducts.Count > 0)