comit
This commit is contained in:
@@ -4614,6 +4614,24 @@ Light:
|
||||
m_CorrespondingSourceObject: {fileID: 1377996960358852691, guid: 6d159c66df8395a40b6e819f4ef72a95, type: 3}
|
||||
m_PrefabInstance: {fileID: 28956631}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &493625739 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 6518512601816170710, guid: 6c1ed824d30fe8848957d865919227a0, type: 3}
|
||||
m_PrefabInstance: {fileID: 594906197750746389}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &493625742
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 493625739}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9846aa51eb7528b429862cfda7772b02, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
product: {fileID: 3554305899873773484, guid: a0607d71a04b3f4459be2d9646fcb429, type: 3}
|
||||
--- !u!1 &499325871
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -4737,8 +4755,8 @@ MonoBehaviour:
|
||||
m_TargetGraphic: {fileID: 1900070398}
|
||||
m_HandleRect: {fileID: 1900070397}
|
||||
m_Direction: 0
|
||||
m_Value: -0.000006283008
|
||||
m_Size: 0.94925356
|
||||
m_Value: 0
|
||||
m_Size: 0.94925374
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
@@ -7652,7 +7670,10 @@ PrefabInstance:
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 6518512601816170710, guid: 6c1ed824d30fe8848957d865919227a0, type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 493625742}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 6c1ed824d30fe8848957d865919227a0, type: 3}
|
||||
--- !u!224 &683822271461456720
|
||||
RectTransform:
|
||||
@@ -10150,7 +10171,7 @@ MonoBehaviour:
|
||||
m_TargetGraphic: {fileID: 2430122421531363926}
|
||||
m_HandleRect: {fileID: 1792930014543576916}
|
||||
m_Direction: 2
|
||||
m_Value: 1
|
||||
m_Value: 0
|
||||
m_Size: 1
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
@@ -10375,7 +10396,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: -1033.998
|
||||
value: -1017.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4141025361698125247, guid: ea4abd0239cb35e47914f9614cf08d69, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
|
||||
@@ -73,6 +73,7 @@ MonoBehaviour:
|
||||
logic:
|
||||
project:
|
||||
analyses:
|
||||
ProjectTitle:
|
||||
--- !u!114 &6191105916327120908
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -137,6 +138,7 @@ MonoBehaviour:
|
||||
text: {fileID: 0}
|
||||
projectMenuButton: {fileID: 0}
|
||||
menuPanel: {fileID: 0}
|
||||
projectSaveButton: {fileID: 0}
|
||||
--- !u!114 &5971518917654927081
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -224,6 +226,7 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 3645010147275428242}
|
||||
- component: {fileID: 6796491313723832443}
|
||||
- component: {fileID: 351461855981719754}
|
||||
m_Layer: 0
|
||||
m_Name: ObjectManager
|
||||
m_TagString: Untagged
|
||||
@@ -258,3 +261,16 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 44cad9a110d6f044d92cc97cf9538ce7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &351461855981719754
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6518512601816170710}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9846aa51eb7528b429862cfda7772b02, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
product: {fileID: 3554305899873773484, guid: a0607d71a04b3f4459be2d9646fcb429, type: 3}
|
||||
|
||||
19
Assets/WorkSpace/LH/Simulation/ProductManager.cs
Normal file
19
Assets/WorkSpace/LH/Simulation/ProductManager.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ProductManager : MonoBehaviour
|
||||
{
|
||||
public static ProductManager Instance;
|
||||
[SerializeField]
|
||||
GameObject product;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public GameObject SpawnProduct()
|
||||
{
|
||||
GameObject box = Instantiate(product);
|
||||
return box;
|
||||
}
|
||||
}
|
||||
2
Assets/WorkSpace/LH/Simulation/ProductManager.cs.meta
Normal file
2
Assets/WorkSpace/LH/Simulation/ProductManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9846aa51eb7528b429862cfda7772b02
|
||||
@@ -210,7 +210,7 @@ public class SimulationModelConveyor : SimulationModel
|
||||
|
||||
if (moveTargetCargo == null)
|
||||
{
|
||||
moveTargetCargo = storeModel.GetProduct();
|
||||
moveTargetCargo = ProductManager.Instance.SpawnProduct();
|
||||
storedCargo = moveTargetCargo;
|
||||
|
||||
moveTargetCargo.transform.position = startPosition;
|
||||
@@ -228,7 +228,7 @@ public class SimulationModelConveyor : SimulationModel
|
||||
|
||||
if (moveTargetCargo == null)
|
||||
{
|
||||
moveTargetCargo = storeModel.GetProduct();
|
||||
moveTargetCargo = ProductManager.Instance.SpawnProduct();
|
||||
storedCargo = moveTargetCargo;
|
||||
|
||||
moveTargetCargo.transform.position = startPosition;
|
||||
@@ -250,7 +250,8 @@ public class SimulationModelConveyor : SimulationModel
|
||||
SimulationModelStore storemodel = model.GetComponent<SimulationModelStore>();
|
||||
|
||||
moveTargetCargo = null;
|
||||
storemodel.StoreProduct(storedCargo);
|
||||
//storemodel.StoreProduct(storedCargo);
|
||||
Destroy(storedCargo);
|
||||
storedCargo = null;
|
||||
}
|
||||
|
||||
@@ -266,7 +267,8 @@ public class SimulationModelConveyor : SimulationModel
|
||||
SimulationModelStore storemodel = model.GetComponent<SimulationModelStore>();
|
||||
|
||||
moveTargetCargo = null;
|
||||
storemodel.StoreProduct(storedCargo);
|
||||
//storemodel.StoreProduct(storedCargo);
|
||||
Destroy(storedCargo);
|
||||
storedCargo = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ public class SimulationModelMove : SimulationModel
|
||||
for (int i = 0; i < moveData_loading.loaded_count; i++)
|
||||
{
|
||||
GameObject product = null;
|
||||
product = storeModel.GetProduct();
|
||||
product = ProductManager.Instance.SpawnProduct();
|
||||
if (product != null)
|
||||
{
|
||||
product.transform.parent = productPos;
|
||||
@@ -412,7 +412,7 @@ public class SimulationModelMove : SimulationModel
|
||||
for (int i = 0; i < moveData_loading.loaded_count; i++)
|
||||
{
|
||||
GameObject product = null;
|
||||
product = storeModel.GetProduct();
|
||||
product = ProductManager.Instance.SpawnProduct();
|
||||
if (product != null)
|
||||
{
|
||||
product.transform.parent = productPos;
|
||||
@@ -491,8 +491,9 @@ public class SimulationModelMove : SimulationModel
|
||||
if (listProducts.Count > 0)
|
||||
{
|
||||
GameObject product = listProducts[0];
|
||||
storeModel.StoreProduct(product);
|
||||
//storeModel.StoreProduct(product);
|
||||
listProducts.Remove(product);
|
||||
Destroy(product);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -290,7 +290,7 @@ public class SimulationModelProcess : SimulationModel
|
||||
for (int i = 0; i < loadCount; i++)
|
||||
{
|
||||
GameObject product = null;
|
||||
product = storeModel.GetProduct();
|
||||
product = ProductManager.Instance.SpawnProduct();
|
||||
|
||||
product.transform.parent = productPos;
|
||||
product.transform.localPosition = Vector3.zero;
|
||||
@@ -310,7 +310,7 @@ public class SimulationModelProcess : SimulationModel
|
||||
for (int i = 0; i < loadCount; i++)
|
||||
{
|
||||
GameObject product = null;
|
||||
product = storeModel.GetProduct();
|
||||
product = ProductManager.Instance.SpawnProduct();
|
||||
|
||||
product.transform.parent = productPos;
|
||||
product.transform.localPosition = Vector3.zero;
|
||||
@@ -339,8 +339,9 @@ public class SimulationModelProcess : SimulationModel
|
||||
if (listProducts.Count > 0)
|
||||
{
|
||||
GameObject product = listProducts[0];
|
||||
storeModel.StoreProduct(product);
|
||||
//storeModel.StoreProduct(product);
|
||||
listProducts.Remove(product);
|
||||
Destroy(product);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -360,8 +361,9 @@ public class SimulationModelProcess : SimulationModel
|
||||
if (listProducts.Count > 0)
|
||||
{
|
||||
GameObject product = listProducts[0];
|
||||
storeModel.StoreProduct(product);
|
||||
//storeModel.StoreProduct(product);
|
||||
listProducts.Remove(product);
|
||||
Destroy(product);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -381,8 +383,9 @@ public class SimulationModelProcess : SimulationModel
|
||||
if (listProducts.Count > 0)
|
||||
{
|
||||
GameObject product = listProducts[0];
|
||||
storeModel.StoreProduct(product);
|
||||
//storeModel.StoreProduct(product);
|
||||
listProducts.Remove(product);
|
||||
Destroy(product);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -154,7 +154,7 @@ public class SimulationModelSink : SimulationModel
|
||||
|
||||
while (storeModel.storedProducts.Count > queueCapacity)
|
||||
{
|
||||
Destroy(storeModel.GetProduct());
|
||||
//Destroy(storeModel.GetProduct());
|
||||
totalShipped++;
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class SimulationModelSink : SimulationModel
|
||||
|
||||
while (storeModel.storedProducts.Count > queueCapacity)
|
||||
{
|
||||
Destroy(storeModel.GetProduct());
|
||||
//Destroy(storeModel.GetProduct());
|
||||
totalShipped++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,8 @@ public class SimulationModelSource : SimulationModel
|
||||
SimulationModelStore storeModel = model.GetComponent<SimulationModelStore>();
|
||||
storeModel.maxCapacity = queueCapacity;
|
||||
storeModel.storeType = storeType;
|
||||
storeModel.StoreProduct(product);
|
||||
//storeModel.StoreProduct(product);
|
||||
Destroy(product);
|
||||
}
|
||||
}
|
||||
else if (wrapclass._event.Contains(eventStoreProduct))
|
||||
@@ -127,7 +128,8 @@ public class SimulationModelSource : SimulationModel
|
||||
{
|
||||
SimulationModelStore storeModel = model.GetComponent<SimulationModelStore>();
|
||||
storeModel.maxCapacity = queueCapacity;
|
||||
storeModel.StoreProduct(product);
|
||||
//storeModel.StoreProduct(product);
|
||||
Destroy(product);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,30 @@ using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RTG;
|
||||
using Octopus.Simulator.Networks;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections;
|
||||
|
||||
public class StoreStatusUpdateData
|
||||
{
|
||||
public StoreStatusUpdateDatastatistics statistics;
|
||||
}
|
||||
|
||||
public class StoreStatusUpdateDatastatistics
|
||||
{
|
||||
public int current_length;
|
||||
}
|
||||
|
||||
public class QueueStatusUpdateData
|
||||
{
|
||||
public QueueStatusUpdateDatastatistics statistics;
|
||||
}
|
||||
|
||||
public class QueueStatusUpdateDatastatistics
|
||||
{
|
||||
public int current_length;
|
||||
}
|
||||
|
||||
public class SimulationModelStore : SimulationModel
|
||||
{
|
||||
public List<Transform> storePositions = new List<Transform>();
|
||||
@@ -9,6 +33,11 @@ public class SimulationModelStore : SimulationModel
|
||||
public List<GameObject> storedProducts = new List<GameObject>();
|
||||
public string storeType = "fifo";
|
||||
public List<Transform> transporterPositions = new List<Transform>();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
maxCapacity = storePositions.Count;
|
||||
}
|
||||
public void StoreProduct(GameObject product)
|
||||
{
|
||||
product.transform.parent = transform;
|
||||
@@ -52,8 +81,59 @@ public class SimulationModelStore : SimulationModel
|
||||
return transporterPositions[UnityEngine.Random.Range(0, transporterPositions.Count)];
|
||||
}
|
||||
|
||||
void AdjustStore(StoreStatusUpdateData Store)
|
||||
{
|
||||
Debug.Log(Store.statistics.current_length);
|
||||
storedProducts.Clear();
|
||||
GameObject product = ProductManager.Instance.SpawnProduct();
|
||||
product.transform.parent = transform;
|
||||
for (int i = 0; i < Store.statistics.current_length; i++)
|
||||
{
|
||||
if(i>= storePositions.Count)
|
||||
{
|
||||
break;
|
||||
}
|
||||
Transform storePos = storePositions[i];
|
||||
if (storePos.childCount == 0)
|
||||
{
|
||||
product.transform.parent = storePos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QueueStore(QueueStatusUpdateData Queue)
|
||||
{
|
||||
Debug.Log(Queue.statistics.current_length);
|
||||
storedProducts.Clear();
|
||||
GameObject product = ProductManager.Instance.SpawnProduct();
|
||||
product.transform.parent = transform;
|
||||
for (int i = 0; i < Queue.statistics.current_length; i++)
|
||||
{
|
||||
if (i >= storePositions.Count)
|
||||
{
|
||||
break ;
|
||||
}
|
||||
Transform storePos = storePositions[i];
|
||||
if (storePos.childCount == 0)
|
||||
{
|
||||
product.transform.parent = storePos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetData(string data)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
var wrapclass = JsonConvert.DeserializeObject<SimulationDefaultJson>(data);
|
||||
switch (wrapclass._event)
|
||||
{
|
||||
case "store_status_update":
|
||||
AdjustStore(JsonConvert.DeserializeObject<StoreStatusUpdateData>(wrapclass.data.ToString()));
|
||||
break;
|
||||
case "queue_status_update":
|
||||
QueueStore(JsonConvert.DeserializeObject<QueueStatusUpdateData>(wrapclass.data.ToString()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ namespace Octopus.Simulator.Networks
|
||||
onParameterRecived += FindAnyObjectByType<ProjectDataManager>().RequestInfo;
|
||||
onParameterRecived += FindAnyObjectByType<LogicDataManager>().RequestInfo;
|
||||
#if UNITY_EDITOR
|
||||
config.projectId = "40";
|
||||
config.projectId = "37";
|
||||
//config.simulationId = "15";
|
||||
config.logicId = "45";
|
||||
config.logicId = "42";
|
||||
WebParameters.config = config;
|
||||
onParameterRecived?.Invoke();
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user