process, sink 작업

This commit is contained in:
SullyunShin
2025-05-28 10:08:15 +09:00
parent c0826b3854
commit 07fcd25315
13 changed files with 15164 additions and 94 deletions

8
Assets/Effect.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8d6be444d2911b345ba3175dd1f06993
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 16172d8448683934bbabb9137f937e31
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1291,7 +1291,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
modelName: BigShelves01
modelType: Store
modelType: Queue
modelID:
nodeID:
storePositions:

View File

@@ -9,7 +9,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 8916579774980777993}
- component: {fileID: -4247483474795707444}
- component: {fileID: 7603118197445908879}
m_Layer: 0
m_Name: Container
m_TagString: Untagged
@@ -33,7 +33,7 @@ Transform:
- {fileID: 2498475630445903680}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &-4247483474795707444
--- !u!114 &7603118197445908879
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -42,11 +42,13 @@ MonoBehaviour:
m_GameObject: {fileID: 2931528002891540222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c1d14145e7d8b3546a7232d42ee091dc, type: 3}
m_Script: {fileID: 11500000, guid: f9753e37acbb67640a9223a5ff708612, type: 3}
m_Name:
m_EditorClassIdentifier:
modelName: Container
modelType: Sink
modelID:
nodeID:
--- !u!1001 &7399670728975469901
PrefabInstance:
m_ObjectHideFlags: 0

View File

@@ -1,5 +1,36 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8186549463259896341
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8746603792214944495}
m_Layer: 0
m_Name: ProductPos
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8746603792214944495
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8186549463259896341}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -2.27, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7054039277474966850}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8566264167055009908
GameObject:
m_ObjectHideFlags: 0
@@ -9,7 +40,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 7054039277474966850}
- component: {fileID: 7085333453946890859}
- component: {fileID: -3743166843612441236}
m_Layer: 0
m_Name: Machine
m_TagString: Untagged
@@ -31,9 +62,11 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5519468951698607499}
- {fileID: 7280729913929302484}
- {fileID: 8746603792214944495}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7085333453946890859
--- !u!114 &-3743166843612441236
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -42,11 +75,49 @@ MonoBehaviour:
m_GameObject: {fileID: 8566264167055009908}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c1d14145e7d8b3546a7232d42ee091dc, type: 3}
m_Script: {fileID: 11500000, guid: aba16c82c8a325842b4a1397011b269f, type: 3}
m_Name:
m_EditorClassIdentifier:
modelName: Machine
modelType: Process
modelID:
nodeID:
eventUsingQueue: processor_using_queue
eventUsingStore: processor_using_store
eventStartBatch: processor_batch_started
eventOutputQueue: processor_output_queue
listProducts: []
productPos: {fileID: 8746603792214944495}
onProcessStart:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 7280729913929302507}
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_MethodName: SetActive
m_Mode: 6
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
onProcessEnd:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 7280729913929302507}
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_MethodName: SetActive
m_Mode: 6
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1001 &5436764548328971395
PrefabInstance:
m_ObjectHideFlags: 0
@@ -109,3 +180,90 @@ Transform:
m_CorrespondingSourceObject: {fileID: 570359878101422344, guid: 43ec3d3d797c7b8439df719815788d9c, type: 3}
m_PrefabInstance: {fileID: 5436764548328971395}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &8351871319220786738
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 7054039277474966850}
m_Modifications:
- target: {fileID: 1652143759095011289, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_Name
value: CFXR2 Shiny Item (Loop)
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011289, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_LocalPosition.y
value: 1.23
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1652143759095011303, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3827264115780404086, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7831740662026284754, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_Intensity
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8797081065329041583, guid: 16172d8448683934bbabb9137f937e31, type: 3}
propertyPath: m_Materials.Array.size
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 16172d8448683934bbabb9137f937e31, type: 3}
--- !u!4 &7280729913929302484 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1652143759095011302, guid: 16172d8448683934bbabb9137f937e31, type: 3}
m_PrefabInstance: {fileID: 8351871319220786738}
m_PrefabAsset: {fileID: 0}
--- !u!1 &7280729913929302507 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1652143759095011289, guid: 16172d8448683934bbabb9137f937e31, type: 3}
m_PrefabInstance: {fileID: 8351871319220786738}
m_PrefabAsset: {fileID: 0}

View File

@@ -356,7 +356,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 4469db8f514d6eb4bb76ac0bf775ef13, type: 3}
m_Sprite: {fileID: 21300000, guid: fa1d4886ec7efa34a99670da2f385da3, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -703,7 +703,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 20c6a2c695178a245a3d5d43224cbab2, type: 3}
m_Sprite: {fileID: 21300000, guid: c0af249f41e419f4d898d8b4daae8e18, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -778,7 +778,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 754e6be56a22e3443b5cb2a65892f1ff, type: 3}
m_Sprite: {fileID: 21300000, guid: 24a6268f4b8258146ac859dd51deca8d, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -853,7 +853,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 3261d6e2175014b479248784343bbab8, type: 3}
m_Sprite: {fileID: 21300000, guid: 8200cb4fbbf29b84e814d545d9a725e3, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -1491,7 +1491,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: f01962e7d297e6843a78b7303c02b291, type: 3}
m_Sprite: {fileID: 21300000, guid: 71be2c520c0165d4f8afdb4a27ef01c3, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -2446,7 +2446,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 70561d2f3c3fab64fa31ef7d6b589c6f, type: 3}
m_Sprite: {fileID: 21300000, guid: a15aaba36a1aa0a4384a0b1d5b9b1695, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -2879,7 +2879,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1aefa1130fbfb234f9df67a167a42e7c, type: 3}
m_Name:
m_EditorClassIdentifier:
inventory: []
inventory:
- {fileID: 7968242786519380463, guid: 5cd8767a0f828a842baff8486670992f, type: 3}
content: {fileID: 0}
text: {fileID: 3914711450231832106}
--- !u!1 &6982182353004908446
@@ -2947,7 +2948,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 6e28d22208215ad4fb4812350e274d03, type: 3}
m_Sprite: {fileID: 21300000, guid: bc547e1e35c280a418fd8a2bca173c5f, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@@ -3244,8 +3245,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1aefa1130fbfb234f9df67a167a42e7c, type: 3}
m_Name:
m_EditorClassIdentifier:
inventory:
- {fileID: 1506487540932372203, guid: e6cbb0c795f36984f9e013dd0b561678, type: 3}
inventory: []
content: {fileID: 0}
text: {fileID: 3180467771691020163}
--- !u!1 &8046129375111497013

View File

@@ -5361,6 +5361,30 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 1916153470}
m_Modifications:
- target: {fileID: 1431522413430459930, guid: 2c9478a9db38d9e43955f5e518e0f860, type: 3}
propertyPath: content
value:
objectReference: {fileID: 8413769712500345998}
- target: {fileID: 2484588977064667418, guid: 2c9478a9db38d9e43955f5e518e0f860, type: 3}
propertyPath: content
value:
objectReference: {fileID: 8413769712500345998}
- target: {fileID: 2516755401795187921, guid: 2c9478a9db38d9e43955f5e518e0f860, type: 3}
propertyPath: content
value:
objectReference: {fileID: 8413769712500345998}
- target: {fileID: 2725894703401018449, guid: 2c9478a9db38d9e43955f5e518e0f860, type: 3}
propertyPath: content
value:
objectReference: {fileID: 8413769712500345998}
- target: {fileID: 4513414337717465626, guid: 2c9478a9db38d9e43955f5e518e0f860, type: 3}
propertyPath: content
value:
objectReference: {fileID: 8413769712500345998}
- target: {fileID: 6331681032754426235, guid: 2c9478a9db38d9e43955f5e518e0f860, type: 3}
propertyPath: content
value:
objectReference: {fileID: 8413769712500345998}
- target: {fileID: 7628280530353347633, guid: 2c9478a9db38d9e43955f5e518e0f860, type: 3}
propertyPath: m_Pivot.x
value: 0.5
@@ -5441,6 +5465,14 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8179489441993505069, guid: 2c9478a9db38d9e43955f5e518e0f860, type: 3}
propertyPath: content
value:
objectReference: {fileID: 8413769712500345998}
- target: {fileID: 8428412304579997239, guid: 2c9478a9db38d9e43955f5e518e0f860, type: 3}
propertyPath: content
value:
objectReference: {fileID: 8413769712500345998}
- target: {fileID: 8677907592028259944, guid: 2c9478a9db38d9e43955f5e518e0f860, type: 3}
propertyPath: m_Name
value: ObjectLibraryTabs
@@ -6822,10 +6854,6 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1890893551334623099, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: rectTransform
value:
objectReference: {fileID: 241851429}
- target: {fileID: 2002596603948465480, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_AnchorMax.x
value: 0
@@ -6846,50 +6874,10 @@ PrefabInstance:
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2307873482672832875, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2307873482672832875, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3164975517789104253, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3164975517789104253, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3164975517789104253, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3164975517789104253, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3324831048293651607, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: rectTransform
value:
objectReference: {fileID: 241851429}
- target: {fileID: 3512657831314021627, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3594501674010776567, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 21300000, guid: bdfc1eda7f14b4f2b83a817a4b75aa14, type: 3}
- target: {fileID: 4517021029456539587, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: rectTransform
value:
objectReference: {fileID: 241851429}
- target: {fileID: 5620823465423076539, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: rectTransform
value:
objectReference: {fileID: 241851429}
- target: {fileID: 7094217425313152132, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@@ -6906,26 +6894,10 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7535439185313654537, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: rectTransform
value:
objectReference: {fileID: 241851429}
- target: {fileID: 7770922069808366893, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7770922069808366893, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7884294797245305317, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_Name
value: ObjectLibrary
objectReference: {fileID: 0}
- target: {fileID: 8820716611448193880, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: rectTransform
value:
objectReference: {fileID: 241851429}
- target: {fileID: 9003163838006525450, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@@ -6942,14 +6914,6 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9036531163062767203, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: rectTransform
value:
objectReference: {fileID: 241851429}
- target: {fileID: 9130130549658584589, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
propertyPath: rectTransform
value:
objectReference: {fileID: 241851429}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@@ -6960,6 +6924,11 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 1142040368317778097, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
m_PrefabInstance: {fileID: 8413769712500345996}
m_PrefabAsset: {fileID: 0}
--- !u!224 &8413769712500345998 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3512657831314021627, guid: bc16ce627450b4a46a0bfdbe5fd69f94, type: 3}
m_PrefabInstance: {fileID: 8413769712500345996}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &9032098431777052662
PrefabInstance:
m_ObjectHideFlags: 0

View File

@@ -7,7 +7,7 @@ public class DataManager : UnitySingleton<DataManager>
public bool isPlaying = false;
List<SimulationModel> models = new List<SimulationModel>();
public event Action onModelsUpdated;
public event Action<List<SimulationModel>> onModelsUpdated;
public void AddModel(SimulationModel model)
{
if (models.Any(x => x == model))
@@ -15,14 +15,14 @@ public class DataManager : UnitySingleton<DataManager>
int objCount = models.FindAll(x => x.modelName.Contains(model.modelName)).Count;
model.modelName = model.modelName + "_" + objCount.ToString();
models.Add(model);
onModelsUpdated?.Invoke();
onModelsUpdated?.Invoke(models);
}
public void RemoveModel(SimulationModel model)
{
if (models.Any(x => x == model))
return;
models.Remove(model);
onModelsUpdated?.Invoke();
onModelsUpdated?.Invoke(models);
}
public List<SimulationModel> GetModels()

View File

@@ -4,6 +4,7 @@ using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine.Events;
public class SimulationModelMove : SimulationModel
{
public string eventLoading = "transporter_loading";
@@ -14,6 +15,8 @@ public class SimulationModelMove : SimulationModel
public List<GameObject> listProducts = new List<GameObject>();
public Transform productPos;
public Vector3 productDistance = new Vector3(0, 0.321f, 0);
public UnityEvent onMove;
public UnityEvent onWait;
ConcurrentQueue<JObject> dataQueue;
int productCount = 0;
Transform origin = null;

View File

@@ -1,7 +1,24 @@
using Newtonsoft.Json.Linq;
using UnityEngine;
public class SimulationModelProcess : MonoBehaviour
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using UnityEngine.Events;
public class SimulationModelProcess : SimulationModel
{
public string eventUsingQueue = "processor_using_queue";
public string eventUsingStore = "processor_using_store";
public string eventStartBatch = "processor_batch_started";
public string eventOutputQueue = "processor_output_queue";
public List<GameObject> listProducts = new List<GameObject>();
public Transform productPos;
public UnityEvent onProcessStart;
public UnityEvent onProcessEnd;
int productCount = 0;
float processTime = 0;
float elapsedTime = 0;
ConcurrentQueue<JObject> dataQueue;
bool startBatch = false;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
@@ -11,6 +28,116 @@ public class SimulationModelProcess : MonoBehaviour
// Update is called once per frame
void Update()
{
if (!startBatch) return;
elapsedTime += Time.deltaTime;
if (elapsedTime > processTime)
{
onProcessEnd?.Invoke();
startBatch = false;
}
}
protected override IEnumerator RunSimulationCoroutine()
{
yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID));
while (dataQueue == null)
{
dataQueue = MQTTDataBase.Instance.GetDataQueue(nodeID);
if (dataQueue == null)
yield return null;
else
break;
}
while (true)
{
if (dataQueue.IsEmpty)
{
yield return null;
continue;
}
if (dataQueue.TryDequeue(out JObject currentData))
{
string eventKey = "_event";
if (currentData.ContainsKey(eventKey))
{
string value = currentData[eventKey].ToString();
if (value.Contains(eventUsingQueue))
{
string[] queueIDKey = { "data", "queue_name" };
string[] loadCountKey = { "data", "required_items" };
string queueID = GetJsonValue(currentData, queueIDKey)?.ToString();
int loadCount = GetJsonIntValue(currentData, loadCountKey);
SimulationModel model = DataManager.I.GetModel(queueID);
SimulationModelStore storeModel = (SimulationModelStore)model;
for (int i = 0; i < loadCount; i++)
{
GameObject product = null;
yield return new WaitUntil(() => {
product = storeModel.GetProduct();
return product != null;
});
product.transform.parent = productPos;
product.transform.localPosition = Vector3.zero;
product.transform.localRotation = Quaternion.identity;
listProducts.Add(product);
}
}
else if (value.Contains(eventUsingStore))
{
string[] queueIDKey = { "data", "store_name" };
string[] loadCountKey = { "data", "required_items" };
string queueID = GetJsonValue(currentData, queueIDKey)?.ToString();
int loadCount = GetJsonIntValue(currentData, loadCountKey);
SimulationModel model = DataManager.I.GetModel(queueID);
SimulationModelStore storeModel = (SimulationModelStore)model;
for (int i = 0; i < loadCount; i++)
{
GameObject product = null;
yield return new WaitUntil(() => {
product = storeModel.GetProduct();
return product != null;
});
product.transform.parent = productPos;
product.transform.localPosition = Vector3.zero;
product.transform.localRotation = Quaternion.identity;
listProducts.Add(product);
}
}
else if (value.Contains(eventStartBatch))
{
string[] productCountKey = { "data", "product_count" };
string[] processTimeKey = { "data", "processing_time" };
int productCount = GetJsonIntValue(currentData, productCountKey);
processTime = GetJsonFloatValue(currentData, processTimeKey);
elapsedTime = 0;
startBatch = true;
onProcessStart?.Invoke();
}
else if (value.Contains(eventOutputQueue))
{
string[] outputQueueKey = { "data", "queue_name" };
string[] productCountKey = { "data", "products_to_add" };
string queueID = GetJsonValue(currentData, outputQueueKey)?.ToString();
int productCount = GetJsonIntValue(currentData, productCountKey);
SimulationModel model = DataManager.I.GetModel(queueID);
SimulationModelStore storeModel = (SimulationModelStore)model;
for (int i = 0; i < productCount; i++)
{
if (listProducts.Count > 0)
{
GameObject product = listProducts[0];
storeModel.StoreProduct(product);
listProducts.Remove(product);
}
else
{
Debug.LogWarning("Trying to unload from empty transporter : " + nodeID);
}
}
}
}
}
yield return null;
}
yield return null;
}
}

View File

@@ -1,7 +1,14 @@
using Newtonsoft.Json.Linq;
using System.Collections.Concurrent;
using UnityEngine;
using System.Collections;
public class SimulationModelSink : MonoBehaviour
public class SimulationModelSink : SimulationModel
{
public string eventShipItem = "items_shipped_successfully";
public string eventRemoveItem = "product_defective";
public int totalShipped = 0;
ConcurrentQueue<JObject> dataQueue;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
@@ -11,6 +18,54 @@ public class SimulationModelSink : MonoBehaviour
// Update is called once per frame
void Update()
{
}
protected override IEnumerator RunSimulationCoroutine()
{
yield return new WaitUntil(() => !string.IsNullOrEmpty(nodeID));
while (dataQueue == null)
{
dataQueue = MQTTDataBase.Instance.GetDataQueue(nodeID);
if (dataQueue == null)
yield return null;
else
break;
}
while (true)
{
if (dataQueue.IsEmpty)
{
yield return null;
continue;
}
if (dataQueue.TryDequeue(out JObject currentData))
{
string eventKey = "_event";
if (currentData.ContainsKey(eventKey))
{
string value = currentData[eventKey].ToString();
if (value.Contains(eventShipItem))
{
}
else if (value.Contains(eventRemoveItem))
{
string[] queueIDKey = { "data", "queue_name" };
string[] queueRemainKey = { "data", "remaining_queue_length" };
string queueID = GetJsonValue(currentData, queueIDKey)?.ToString();
int queueCapacity = GetJsonIntValue(currentData, queueRemainKey);
SimulationModel model = DataManager.I.GetModel(queueID);
SimulationModelStore storeModel = (SimulationModelStore)model;
while (storeModel.storedProducts.Count > queueCapacity)
{
Destroy(storeModel.GetProduct());
totalShipped++;
}
}
}
}
yield return null;
}
yield return null;
}
}

View File

@@ -23,7 +23,7 @@ namespace Octopus.Simulator
void Awake()
{
rect = GetComponent<RectTransform>();
DataManager.I.onModelsUpdated += SetDropdown;
DataManager.I.onModelsUpdated += (value)=>SetDropdown();
}
public void SetDropdown(string mappingKey)