diff --git a/Assets/Resources/Prefabs/UI/Factory.meta b/Assets/Resources/Prefabs/UI/Factory.meta
new file mode 100644
index 00000000..7a82a968
--- /dev/null
+++ b/Assets/Resources/Prefabs/UI/Factory.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 89c2e61af66edfc418938381caf7673f
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Resources/Prefabs/SampleProject/Factory/AGV.prefab b/Assets/Resources/Prefabs/UI/Factory/AGV.prefab
similarity index 100%
rename from Assets/Resources/Prefabs/SampleProject/Factory/AGV.prefab
rename to Assets/Resources/Prefabs/UI/Factory/AGV.prefab
diff --git a/Assets/Resources/Prefabs/SampleProject/Factory/AGV.prefab.meta b/Assets/Resources/Prefabs/UI/Factory/AGV.prefab.meta
similarity index 100%
rename from Assets/Resources/Prefabs/SampleProject/Factory/AGV.prefab.meta
rename to Assets/Resources/Prefabs/UI/Factory/AGV.prefab.meta
diff --git a/Assets/Resources/Prefabs/SampleProject/Factory/Alarm.prefab b/Assets/Resources/Prefabs/UI/Factory/Alarm.prefab
similarity index 58%
rename from Assets/Resources/Prefabs/SampleProject/Factory/Alarm.prefab
rename to Assets/Resources/Prefabs/UI/Factory/Alarm.prefab
index 88ac3a83..bd80de08 100644
--- a/Assets/Resources/Prefabs/SampleProject/Factory/Alarm.prefab
+++ b/Assets/Resources/Prefabs/UI/Factory/Alarm.prefab
@@ -92,8 +92,8 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
- m_fontSize: 36
- m_fontSizeBase: 36
+ m_fontSize: 12
+ m_fontSizeBase: 12
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
@@ -163,13 +163,16 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
- m_Children: []
+ m_Children:
+ - {fileID: 7131291007070285513}
+ - {fileID: 5271924166542973796}
+ - {fileID: 3646766325915033839}
m_Father: {fileID: 2463437008278947656}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
- m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: -20}
+ m_SizeDelta: {x: 20, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1828762385695490929
GameObject:
@@ -226,6 +229,292 @@ MonoBehaviour:
alarmCountText: {fileID: 8650239058674280921}
expandedView: {fileID: 952545100964675415}
singleAlarmIconPrefab: {fileID: 7314511769243682470, guid: e9acc8c9a93a2b5409fc01661660b217, type: 3}
+--- !u!1 &1960784422133791095
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 3646766325915033839}
+ - component: {fileID: 4629718865595954553}
+ - component: {fileID: 353088631153534614}
+ m_Layer: 5
+ m_Name: Text (TMP) (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &3646766325915033839
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1960784422133791095}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 8574585598928791195}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: -20, y: -20}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &4629718865595954553
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1960784422133791095}
+ m_CullTransparentMesh: 1
+--- !u!114 &353088631153534614
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1960784422133791095}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
+ m_Maskable: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_text:
+ m_isRightToLeft: 0
+ m_fontAsset: {fileID: 11400000, guid: 08cebd004d97ca742ac80400f37f4eed, type: 2}
+ m_sharedMaterial: {fileID: 4860575619018115804, guid: 08cebd004d97ca742ac80400f37f4eed, type: 2}
+ m_fontSharedMaterials: []
+ m_fontMaterial: {fileID: 0}
+ m_fontMaterials: []
+ m_fontColor32:
+ serializedVersion: 2
+ rgba: 4278190080
+ m_fontColor: {r: 0, g: 0, b: 0, a: 1}
+ m_enableVertexGradient: 0
+ m_colorMode: 3
+ m_fontColorGradient:
+ topLeft: {r: 1, g: 1, b: 1, a: 1}
+ topRight: {r: 1, g: 1, b: 1, a: 1}
+ bottomLeft: {r: 1, g: 1, b: 1, a: 1}
+ bottomRight: {r: 1, g: 1, b: 1, a: 1}
+ m_fontColorGradientPreset: {fileID: 0}
+ m_spriteAsset: {fileID: 0}
+ m_tintAllSprites: 0
+ m_StyleSheet: {fileID: 0}
+ m_TextStyleHashCode: -1183493901
+ m_overrideHtmlColors: 0
+ m_faceColor:
+ serializedVersion: 2
+ rgba: 4294967295
+ m_fontSize: 12
+ m_fontSizeBase: 12
+ m_fontWeight: 400
+ m_enableAutoSizing: 0
+ m_fontSizeMin: 18
+ m_fontSizeMax: 72
+ m_fontStyle: 0
+ m_HorizontalAlignment: 1
+ m_VerticalAlignment: 256
+ m_textAlignment: 65535
+ m_characterSpacing: 0
+ m_wordSpacing: 0
+ m_lineSpacing: 0
+ m_lineSpacingMax: 0
+ m_paragraphSpacing: 0
+ m_charWidthMaxAdj: 0
+ m_TextWrappingMode: 1
+ m_wordWrappingRatios: 0.4
+ m_overflowMode: 0
+ m_linkedTextComponent: {fileID: 0}
+ parentLinkedComponent: {fileID: 0}
+ m_enableKerning: 0
+ m_ActiveFontFeatures: 6e72656b
+ m_enableExtraPadding: 0
+ checkPaddingRequired: 0
+ m_isRichText: 1
+ m_EmojiFallbackSupport: 1
+ m_parseCtrlCharacters: 1
+ m_isOrthographic: 1
+ m_isCullingEnabled: 0
+ m_horizontalMapping: 0
+ m_verticalMapping: 0
+ m_uvLineOffset: 0
+ m_geometrySortingOrder: 0
+ m_IsTextObjectScaleStatic: 0
+ m_VertexBufferAutoSizeReduction: 0
+ m_useMaxVisibleDescender: 1
+ m_pageToDisplay: 1
+ m_margin: {x: 0, y: 0, z: 0, w: 0}
+ m_isUsingLegacyAnimationComponent: 0
+ m_isVolumetricText: 0
+ m_hasFontAssetChanged: 0
+ m_baseMaterial: {fileID: 0}
+ m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
+--- !u!1 &3143968334505601971
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 7131291007070285513}
+ - component: {fileID: 7326861565818029875}
+ - component: {fileID: 927238525312826162}
+ m_Layer: 5
+ m_Name: shadow
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &7131291007070285513
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 3143968334505601971}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 8574585598928791195}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 5, y: -5}
+ m_SizeDelta: {x: 10, y: 10}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &7326861565818029875
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 3143968334505601971}
+ m_CullTransparentMesh: 1
+--- !u!114 &927238525312826162
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 3143968334505601971}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 0, g: 0, b: 0, a: 1}
+ m_RaycastTarget: 1
+ m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
+ m_Maskable: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 887145076, guid: 4cf3568ca3f55f64cb11447d139d7a3d, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+ m_PixelsPerUnitMultiplier: 1
+--- !u!1 &4577807398885837071
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 5271924166542973796}
+ - component: {fileID: 9155506323335068705}
+ - component: {fileID: 4147791058937629139}
+ m_Layer: 5
+ m_Name: bg
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &5271924166542973796
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4577807398885837071}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 8574585598928791195}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &9155506323335068705
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4577807398885837071}
+ m_CullTransparentMesh: 1
+--- !u!114 &4147791058937629139
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4577807398885837071}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 0.5235849, b: 0.5235849, a: 1}
+ m_RaycastTarget: 1
+ m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
+ m_Maskable: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: -895992892, guid: 73d757b5d1b754245969af12daf01e78, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 1
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+ m_PixelsPerUnitMultiplier: 1
--- !u!1 &4918696741701580718
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Resources/Prefabs/SampleProject/Factory/Alarm.prefab.meta b/Assets/Resources/Prefabs/UI/Factory/Alarm.prefab.meta
similarity index 100%
rename from Assets/Resources/Prefabs/SampleProject/Factory/Alarm.prefab.meta
rename to Assets/Resources/Prefabs/UI/Factory/Alarm.prefab.meta
diff --git a/Assets/Resources/Prefabs/SampleProject/Factory/AlarmIcon.prefab b/Assets/Resources/Prefabs/UI/Factory/AlarmIcon.prefab
similarity index 95%
rename from Assets/Resources/Prefabs/SampleProject/Factory/AlarmIcon.prefab
rename to Assets/Resources/Prefabs/UI/Factory/AlarmIcon.prefab
index d2d29662..e8d9fac3 100644
--- a/Assets/Resources/Prefabs/SampleProject/Factory/AlarmIcon.prefab
+++ b/Assets/Resources/Prefabs/UI/Factory/AlarmIcon.prefab
@@ -35,7 +35,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: -20, y: -20}
+ m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5770335694761070239
CanvasRenderer:
@@ -67,8 +67,8 @@ MonoBehaviour:
m_Calls: []
m_text: TR
m_isRightToLeft: 0
- m_fontAsset: {fileID: 11400000, guid: 08cebd004d97ca742ac80400f37f4eed, type: 2}
- m_sharedMaterial: {fileID: 4860575619018115804, guid: 08cebd004d97ca742ac80400f37f4eed, type: 2}
+ m_fontAsset: {fileID: 11400000, guid: 2c77cc500db5adc499bfa50030f7e8c2, type: 2}
+ m_sharedMaterial: {fileID: -8159279640617175905, guid: 2c77cc500db5adc499bfa50030f7e8c2, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
@@ -92,17 +92,17 @@ MonoBehaviour:
m_faceColor:
serializedVersion: 2
rgba: 4294967295
- m_fontSize: 12
- m_fontSizeBase: 12
+ m_fontSize: 9
+ m_fontSizeBase: 9
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
- m_fontStyle: 0
- m_HorizontalAlignment: 1
- m_VerticalAlignment: 256
+ m_fontStyle: 1
+ m_HorizontalAlignment: 2
+ m_VerticalAlignment: 512
m_textAlignment: 65535
- m_characterSpacing: 0
+ m_characterSpacing: -15
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
@@ -170,8 +170,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
- m_AnchoredPosition: {x: 5, y: -5}
- m_SizeDelta: {x: 10, y: 10}
+ m_AnchoredPosition: {x: 2.5, y: -2.5}
+ m_SizeDelta: {x: 5, y: 5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2825211744860677609
CanvasRenderer:
@@ -248,7 +248,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
- m_SizeDelta: {x: 100, y: 150}
+ m_SizeDelta: {x: 20, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &5545478218830425297
MonoBehaviour:
diff --git a/Assets/Resources/Prefabs/SampleProject/Factory/AlarmIcon.prefab.meta b/Assets/Resources/Prefabs/UI/Factory/AlarmIcon.prefab.meta
similarity index 100%
rename from Assets/Resources/Prefabs/SampleProject/Factory/AlarmIcon.prefab.meta
rename to Assets/Resources/Prefabs/UI/Factory/AlarmIcon.prefab.meta
diff --git a/Assets/Resources/Prefabs/SampleProject/UI/InfoWindow.prefab b/Assets/Resources/Prefabs/UI/Factory/InfoWindow.prefab
similarity index 100%
rename from Assets/Resources/Prefabs/SampleProject/UI/InfoWindow.prefab
rename to Assets/Resources/Prefabs/UI/Factory/InfoWindow.prefab
diff --git a/Assets/Resources/Prefabs/SampleProject/UI/InfoWindow.prefab.meta b/Assets/Resources/Prefabs/UI/Factory/InfoWindow.prefab.meta
similarity index 100%
rename from Assets/Resources/Prefabs/SampleProject/UI/InfoWindow.prefab.meta
rename to Assets/Resources/Prefabs/UI/Factory/InfoWindow.prefab.meta
diff --git a/Assets/Scenes/SampleProject.unity b/Assets/Scenes/SampleProject.unity
index 53174c5d..038e71cc 100644
--- a/Assets/Scenes/SampleProject.unity
+++ b/Assets/Scenes/SampleProject.unity
@@ -277,11 +277,11 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 330585546}
+ - component: {fileID: 330585549}
- component: {fileID: 330585545}
- component: {fileID: 330585544}
- component: {fileID: 330585547}
- component: {fileID: 330585548}
- - component: {fileID: 330585549}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@@ -435,10 +435,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 61deddb674c074049a9b43fd58f1b355, type: 3}
m_Name:
m_EditorClassIdentifier:
- panSpeed: 20
+ lowAltitudePanSpeed: 0.5
+ highAltitudePanSpeed: 10
rotationSpeed: 300
zoomSpeed: 10
maxPanDelta: 50
+ minCameraY: 2
+ maxCameraY: 50
--- !u!1 &410087039
GameObject:
m_ObjectHideFlags: 0
@@ -926,51 +929,6 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3}
m_PrefabInstance: {fileID: 769109585}
m_PrefabAsset: {fileID: 0}
---- !u!1 &784978156
-GameObject:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- serializedVersion: 6
- m_Component:
- - component: {fileID: 784978157}
- - component: {fileID: 784978158}
- m_Layer: 0
- m_Name: AlarmManager
- m_TagString: Untagged
- m_Icon: {fileID: 0}
- m_NavMeshLayer: 0
- m_StaticEditorFlags: 0
- m_IsActive: 1
---- !u!4 &784978157
-Transform:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_GameObject: {fileID: 784978156}
- serializedVersion: 2
- m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
- m_LocalPosition: {x: 429.2735, y: 488.27496, z: 49.768143}
- m_LocalScale: {x: 1, y: 1, z: 1}
- m_ConstrainProportionsScale: 0
- m_Children: []
- m_Father: {fileID: 0}
- m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!114 &784978158
-MonoBehaviour:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_GameObject: {fileID: 784978156}
- m_Enabled: 1
- m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: 6765c5d969530e44cbe4fc91d5e52ca1, type: 3}
- m_Name:
- m_EditorClassIdentifier:
- alarmUIPrefab: {fileID: 1828762385695490929, guid: e8b88e69e607ee448806427e91440a8e, type: 3}
--- !u!1 &832575517
GameObject:
m_ObjectHideFlags: 0
@@ -1025,6 +983,121 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 5064510836022735693, guid: 27ddee6261f49584c8634ba7c5f4ae46, type: 3}
m_PrefabInstance: {fileID: 8261569461642068635}
m_PrefabAsset: {fileID: 0}
+--- !u!1 &1087949228
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1087949233}
+ - component: {fileID: 1087949232}
+ - component: {fileID: 1087949231}
+ - component: {fileID: 1087949230}
+ - component: {fileID: 1087949229}
+ m_Layer: 5
+ m_Name: AlarmManager
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &1087949229
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1087949228}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 6765c5d969530e44cbe4fc91d5e52ca1, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ alarmUIPrefab: {fileID: 1828762385695490929, guid: e8b88e69e607ee448806427e91440a8e, type: 3}
+--- !u!114 &1087949230
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1087949228}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreReversedGraphics: 1
+ m_BlockingObjects: 0
+ m_BlockingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+--- !u!114 &1087949231
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1087949228}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_UiScaleMode: 0
+ m_ReferencePixelsPerUnit: 100
+ m_ScaleFactor: 1
+ m_ReferenceResolution: {x: 800, y: 600}
+ m_ScreenMatchMode: 0
+ m_MatchWidthOrHeight: 0
+ m_PhysicalUnit: 3
+ m_FallbackScreenDPI: 96
+ m_DefaultSpriteDPI: 96
+ m_DynamicPixelsPerUnit: 1
+ m_PresetInfoIsWorld: 0
+--- !u!223 &1087949232
+Canvas:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1087949228}
+ m_Enabled: 1
+ serializedVersion: 3
+ m_RenderMode: 0
+ m_Camera: {fileID: 330585545}
+ m_PlaneDistance: 100
+ m_PixelPerfect: 1
+ m_ReceivesEvents: 1
+ m_OverrideSorting: 0
+ m_OverridePixelPerfect: 0
+ m_SortingBucketNormalizedSize: 0
+ m_VertexColorAlwaysGammaSpace: 0
+ m_AdditionalShaderChannelsFlag: 0
+ m_UpdateRectTransformForStandalone: 0
+ m_SortingLayerID: 0
+ m_SortingOrder: 0
+ m_TargetDisplay: 0
+--- !u!224 &1087949233
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1087949228}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 0, y: 0, z: 0}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0, y: 0}
--- !u!1 &1091201604
GameObject:
m_ObjectHideFlags: 0
@@ -2223,7 +2296,7 @@ SceneRoots:
- {fileID: 832575519}
- {fileID: 632541407}
- {fileID: 27812499}
- - {fileID: 784978157}
+ - {fileID: 1087949233}
- {fileID: 2030316712}
- {fileID: 483439351}
- {fileID: 495653798}
diff --git a/Assets/Scripts/SampleProject/AppMain.cs b/Assets/Scripts/SampleProject/AppMain.cs
index cc59f3e0..35aa9cf2 100644
--- a/Assets/Scripts/SampleProject/AppMain.cs
+++ b/Assets/Scripts/SampleProject/AppMain.cs
@@ -52,7 +52,7 @@ namespace SampleProject
mqttPipeLine = new MQTTPipeLine("localhost", 1883);
mqttPipeLine.AddTopic("AGV");
- //mqttPipeLine.AddTopic("ALARM");
+ mqttPipeLine.AddTopic("ALARM");
mqttPipeLine.Execute();
//10รส ศฤ มคม๖
diff --git a/Assets/Scripts/UVC/Data/DataArray.cs b/Assets/Scripts/UVC/Data/DataArray.cs
index ebdd62f9..44082a07 100644
--- a/Assets/Scripts/UVC/Data/DataArray.cs
+++ b/Assets/Scripts/UVC/Data/DataArray.cs
@@ -278,13 +278,20 @@ namespace UVC.Data
///
- /// ์
๋ฐ์ดํธ ๋ ๊ฐ์ฒด๋ฅผ ๋ฐํํฉ๋๋ค.
- ///
- ///
- public IDataObject GetUpdatedObject()
+ /// ํ์ฌ ๋ฐ์ดํฐ ๊ฐ์ฒด์ ์
๋ฐ์ดํธ๋ ๋ฒ์ ์ ์์ฑํ๊ณ ๋ฐํํฉ๋๋ค. ์ ํ์ ์ผ๋ก ๋ฉ๋ชจ๋ฆฌ ํ ๋น ์ต์ ํ๋ฅผ ์ํด ํ์ ์ฌ์ฉํฉ๋๋ค.
+ //
+ /// ์ด ๋ฉ์๋๋ ํ์ฌ ๋ฐ์ดํฐ ๊ฐ์ฒด์ ๊ด๋ จ ์์์ ๊น์ ๋ณต์ฌ๋ฅผ ์ํํฉ๋๋ค.
+ /// ์ด ์ด๋ฉด ๋ฉ์๋๋ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ์ ์ต์ ํํ๊ธฐ ์ํด ๊ฐ์ฒด ํ์์ ์ ์ธ์คํด์ค๋ฅผ ๊ฒ์ํฉ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ์ ์ธ์คํด์ค๊ฐ ์ง์ ์์ฑ๋ฉ๋๋ค. ๋ฐํ๋
+ /// ๊ฐ์ฒด๋ ์ถ๊ฐ, ์ ๊ฑฐ ๋ฐ ์์ ์ ํฌํจํ์ฌ ํ์ฌ ๊ฐ์ฒด์ ์ํ์ ๋ํ ์
๋ฐ์ดํธ๋ฅผ ๋ฐ์ํฉ๋๋ค.
+ /// ๋ณ๊ฒฝ ์ฌํญ์ ์ถ์ ๋์ด ์
๋ฐ์ดํธ๋ ๊ฐ์ฒด์ ํด๋น ๋ชฉ๋ก์ ์ ์ฉ๋ฉ๋๋ค.
+ /// ๊ฐ์ฒด ํ์์ ์ ์ธ์คํด์ค๋ฅผ ๊ฒ์ํ ์ง ์ฌ๋ถ๋ฅผ ๋ํ๋ด๋ ๋ถ์ธ ๊ฐ์
๋๋ค.
+ /// ๊ฐ์ฒด ํ์ ์ฌ์ฉํฉ๋๋ค. ๋ฅผ ์ฌ์ฉํ์ฌ ์ ์ธ์คํด์ค๋ฅผ ์ง์ ์์ฑํฉ๋๋ค.
+ /// ์ถ๊ฐ, ์ ๊ฑฐ ๋๋ ์์ ๋ ๋ชฉ๋ก์์ ์ถ์ ๋ ๋ชจ๋ ๋ณ๊ฒฝ ์ฌํญ์ ํฌํจํ์ฌ ํ์ฌ ๊ฐ์ฒด ๋ฐ์ดํฐ์ ๊น์ ๋ณต์ฌ๋ณธ์ ํฌํจํ๋ ์
๋ฐ์ดํธ๋ ์ธ์คํด์ค์
๋๋ค.
+ ///
+ public IDataObject GetUpdatedObject(bool fromPool = true)
{
// ํ์์ ์ DataArray ์ธ์คํด์ค๋ฅผ ๊ฐ์ ธ์ต๋๋ค.
- var clone = DataArrayPool.Get();
+ var clone = fromPool ? DataArrayPool.Get() : new DataArray();
clone.FromCapacity(this.Count);
// ๋ฐฐ์ด์ ๋ชจ๋ DataObject๋ฅผ ์ํํ๋ฉฐ ๊ฐ๊ฐ์ ๋ณต์ ํฉ๋๋ค.
@@ -292,7 +299,7 @@ namespace UVC.Data
{
// DataObject์ Clone ๋ฉ์๋๋ฅผ ํธ์ถํ์ฌ ๊น์ ๋ณต์ฌ๋ฅผ ์ํํ๊ณ ,
// base.Add๋ฅผ ์ฌ์ฉํด ์ถ์ ๋ก์ง ์์ด ์ง์ ์ถ๊ฐํฉ๋๋ค.
- if (item.GetUpdatedObject() is DataObject updatedObject)
+ if (item.GetUpdatedObject(fromPool) is DataObject updatedObject)
{
clone.Add(updatedObject);
if (addedList.Contains(item))
diff --git a/Assets/Scripts/UVC/Data/DataObject.cs b/Assets/Scripts/UVC/Data/DataObject.cs
index 0507e629..4cfd606c 100644
--- a/Assets/Scripts/UVC/Data/DataObject.cs
+++ b/Assets/Scripts/UVC/Data/DataObject.cs
@@ -807,17 +807,37 @@ namespace UVC.Data
}
///
- /// ์
๋ฐ์ดํธ๋ ์์ฑ๋ง ํฌํจํ๋ ์๋ก์ด DataObject๋ฅผ ๋ฐํํฉ๋๋ค.
+ /// ํ์ฌ ๊ฐ์ฒด์ ์ํ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ์
๋ฐ์ดํธ๋ ์ธ์คํด์ค๋ฅผ ์์ฑํ๊ณ ๋ฐํํฉ๋๋ค.
///
- /// ์
๋ฐ์ดํธ ๋ ํญ๋ชฉ๋ง ๊ฐ์ง๊ณ ์๋ DataObject
- public IDataObject GetUpdatedObject()
+ /// ์ด ๋ฉ์๋๋ ๋ฐ ์ ํ์ ์์ฑ์ ๊น์ด ๋ณต์ฌ๋๊ณ , ๋ค๋ฅธ ์ ํ์ ์์ฑ์ ์ง์ ๋ณต์ฌ๋๋๋ก ํฉ๋๋ค. IdKey๊ฐ ์์ผ๋ฉด
+ /// ํ์ฌ ๊ฐ์ฒด์ ์ฒซ ๋ฒ์งธ ํค-๊ฐ ์์ด ์
๋ฐ์ดํธ๋ ๊ฐ์ฒด์ ํฌํจ๋ฉ๋๋ค.
+ ///
+ /// ์
๋ฐ์ดํธ๋ ๊ฐ์ฒด๋ฅผ ํ์์ ๊ฒ์ํด์ผ ํ๋์ง ์ฌ๋ถ๋ฅผ ๋ํ๋ด๋ ๊ฐ์
๋๋ค. ์ธ ๊ฒฝ์ฐ
+ /// ์์ ๊ฐ์ฒด๋ฅผ ๊ฐ์ ธ์ต๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ์
+ /// ์ธ์คํด์ค๊ฐ ์์ฑ๋ฉ๋๋ค.
+ /// ํ์ฌ ๊ฐ์ฒด์์ ๋ณต์ฌ๋ ์์ฑ๊ณผ ๊ฐ์ ํฌํจํ๋ ์
๋ฐ์ดํธ๋ ์ธ์คํด์ค์
๋๋ค.
+ /// ๋ฐํ๋ ๊ฐ์ฒด์๋ ๋ณ๊ฒฝ๋ ๋ชจ๋ ์์ฑ, IdKey ๋ฐ Name์ด ํฌํจ๋ฉ๋๋ค.
+ /// IdKey๊ฐ ํ์ฌ ๊ฐ์ฒด์ ์๋ ๊ฒฝ์ฐ ํด๋น ๊ฐ๋ ์
๋ฐ์ดํธ๋ ๊ฐ์ฒด์ ํฌํจ๋ฉ๋๋ค.
+ public IDataObject GetUpdatedObject(bool fromPool = true)
{
- DataObject updated = DataObjectPool.Get();
+ DataObject updated = fromPool ? DataObjectPool.Get() : new DataObject();
foreach (var key in changedProperies)
{
if (this.ContainsKey(key))
{
- updated[key] = this[key];
+ if(this[key] is DataObject dataObject)
+ {
+ updated[key] = dataObject.Copy(fromPool); // DataObject๋ ๋ณต์ฌํฉ๋๋ค.
+ }
+ else if (this[key] is DataArray dataArray)
+ {
+ updated[key] = dataArray.Copy(fromPool); // DataArray๋ ๋ณต์ฌํฉ๋๋ค.
+ }
+ else
+ {
+ updated[key] = this[key]; // ๊ทธ ์ธ์ ๊ฐ์ ๊ทธ๋๋ก ๋ณต์ฌํฉ๋๋ค.
+ }
}
}
updated.IdKey = IdKey; // ID ํค๋ฅผ ๋ณต์ฌํฉ๋๋ค.
diff --git a/Assets/Scripts/UVC/Data/DataObjectPool.cs b/Assets/Scripts/UVC/Data/DataObjectPool.cs
index 62341663..6419ca0a 100644
--- a/Assets/Scripts/UVC/Data/DataObjectPool.cs
+++ b/Assets/Scripts/UVC/Data/DataObjectPool.cs
@@ -38,7 +38,7 @@ namespace UVC.Data
///
/// ํ์ ์ต๋ ํฌ๊ธฐ์
๋๋ค. ์ด ํฌ๊ธฐ๋ฅผ ์ด๊ณผํ๋ ๊ฐ์ฒด๋ ํ์ ์ ์ฅ๋์ง ์์ต๋๋ค.
///
- private static int maxPoolSize = 4000;
+ private static int maxPoolSize = 2000;
// --- ํต๊ณ์ฉ ํ๋ ---
private static int _inUseCount = 0; // ํ์ฌ ์ฌ์ฉ ์ค์ธ DataObject ์ธ์คํด์ค์ ์
diff --git a/Assets/Scripts/UVC/Data/DataRepository.cs b/Assets/Scripts/UVC/Data/DataRepository.cs
index 1f9f9f10..e999ec5d 100644
--- a/Assets/Scripts/UVC/Data/DataRepository.cs
+++ b/Assets/Scripts/UVC/Data/DataRepository.cs
@@ -69,7 +69,7 @@ namespace UVC.Data
{
if (!dataObjects.ContainsKey(key))
{
- var newData = dataObject.Clone(false);
+ var newData = dataObject.Clone(fromPool: false);
dataObjects.Add(key, newData);
dataObject.MarkAllAsUpdated();
@@ -83,7 +83,7 @@ namespace UVC.Data
IDataObject newDataObject;
if (updatedDataOnly)
{
- newDataObject = obj.GetUpdatedObject();
+ newDataObject = obj.GetUpdatedObject(fromPool: false);
}
else
{
diff --git a/Assets/Scripts/UVC/Data/HttpPipeLine.cs b/Assets/Scripts/UVC/Data/HttpPipeLine.cs
index a684b51b..aa2f0c3e 100644
--- a/Assets/Scripts/UVC/Data/HttpPipeLine.cs
+++ b/Assets/Scripts/UVC/Data/HttpPipeLine.cs
@@ -431,7 +431,7 @@ namespace UVC.Data
if (mappedObject != null)
{
repoObject = DataRepository.Instance.AddData(key, mappedObject, info.UpdatedDataOnly);
- if (repoObject == mappedObject) repoObject = mappedObject.Clone();
+ if (repoObject == mappedObject) repoObject = mappedObject.Clone(fromPool: false);
}
diff --git a/Assets/Scripts/UVC/Data/IDataObject.cs b/Assets/Scripts/UVC/Data/IDataObject.cs
index 80ed6238..b7ee4b96 100644
--- a/Assets/Scripts/UVC/Data/IDataObject.cs
+++ b/Assets/Scripts/UVC/Data/IDataObject.cs
@@ -26,8 +26,9 @@
///
/// ์
๋ฐ์ดํธ๋ ์์ฑ๋ง ํฌํจํ๋ ์๋ก์ด DataObject๋ฅผ ๋ฐํํฉ๋๋ค.
///
+ /// ๊ฐ์ฒด ํ์์ ๋ณต์ ํ ์ง ์ฌ๋ถ๋ฅผ ์ง์ ํฉ๋๋ค. ๊ธฐ๋ณธ๊ฐ์ true์
๋๋ค.
/// ์
๋ฐ์ดํธ ๋ ํญ๋ชฉ๋ง ๊ฐ์ง๊ณ ์๋ DataObject
- public IDataObject GetUpdatedObject();
+ public IDataObject GetUpdatedObject(bool fromPool = true);
///
/// ///
diff --git a/Assets/Scripts/UVC/Data/MQTTPipeLine.cs b/Assets/Scripts/UVC/Data/MQTTPipeLine.cs
index b6dcc377..5291e0b6 100644
--- a/Assets/Scripts/UVC/Data/MQTTPipeLine.cs
+++ b/Assets/Scripts/UVC/Data/MQTTPipeLine.cs
@@ -245,7 +245,7 @@ namespace UVC.Data
if (mappedObject == null) return;
// DataRepository๋ ๋ด๋ถ์ ์ผ๋ก ๋ฐ์ดํฐ๋ฅผ ๋ณต์ฌ/์
๋ฐ์ดํธํ๋ฏ๋ก, mappedObject๋ ์ฌ๊ธฐ์ ์์ ๊ฐ์ฒด๊ฐ ๋ฉ๋๋ค.
var repoObject = DataRepository.Instance.AddData(topic, mappedObject, info.UpdatedDataOnly);
- if(repoObject == mappedObject) repoObject = mappedObject.Clone();
+ if(repoObject == mappedObject) repoObject = mappedObject.Clone(fromPool: false);
// ํธ๋ค๋ฌ ํธ์ถ์ด ํ์ํ์ง ํ์ธ
bool shouldInvoke = !info.UpdatedDataOnly || (repoObject != null && repoObject.UpdatedCount > 0);
if (shouldInvoke)
diff --git a/Assets/Scripts/UVC/Factory/Alarm/AlarmManager.cs b/Assets/Scripts/UVC/Factory/Alarm/AlarmManager.cs
index 1c924d2f..8f233fd2 100644
--- a/Assets/Scripts/UVC/Factory/Alarm/AlarmManager.cs
+++ b/Assets/Scripts/UVC/Factory/Alarm/AlarmManager.cs
@@ -9,18 +9,24 @@ using UVC.Core;
using UVC.Data;
using UVC.Extention;
using UVC.Factory.Component;
+using UVC.Util;
namespace UVC.Factory.Alarm
{
public class AlarmManager : SingletonScene
{
[Tooltip("์๋ UI ํ๋ฆฌํน์
๋๋ค. ์ด ํ๋ฆฌํน์ ์๋ ์ ๋ณด๋ฅผ ํ์ํ๋ UI ์์๋ฅผ ํฌํจํด์ผ ํฉ๋๋ค.")]
- public GameObject alarmUIPrefab; // ์๋ UI ํ๋ฆฌํน (์๋์์ ์ค๋ช
)
+ [SerializeField]
+ protected GameObject alarmUIPrefab; // ์๋ UI ํ๋ฆฌํน (์๋์์ ์ค๋ช
)
private Dictionary activeAlarmUIs = new Dictionary();
+ private List agvNames = new List();
+ private Dictionary alarmAgvNames = new Dictionary();
+
// FactoryDataManager์์ ์ฐพ์ ์ ์๋๋ก ์ฐธ์กฐ๋ฅผ ์ ์ฅ
private FactoryObjectManager? dataManager;
+
///
/// AlarmManager์ ์ด๊ธฐํ ๋ฉ์๋์
๋๋ค.
/// Awake ๋ฉ์๋์์ ํธ์ถ๋๋ฉฐ, MonoBehaviour๊ฐ ์์ฑ๋ ๋ ํ ๋ฒ๋ง ์คํ๋ฉ๋๋ค.
@@ -33,8 +39,17 @@ namespace UVC.Factory.Alarm
private void OnSceneInitialized()
{
dataManager = FactoryObjectManager.Instance;
+
+ //test code
+ //์๋ ๋ฐ์ดํฐ๊ฐ AGV์ ๊ด๋ จ ์๋๊ฒ์ด ๋ง์์, AGV ์ด๋ฆ์ ๋ฏธ๋ฆฌ ์ ์ํฉ๋๋ค.
+ for (int i = 1; i <= 115; i++)
+ {
+ agvNames.Add($"HFF09CNA8{i.ToString("D3")}");
+ }
}
+
+
///
/// Alarm ๋ฐ์ดํฐ๋ฅผ ์์ ํ๊ธฐ ์ํ MQTT ํ์ดํ๋ผ์ธ์ ์ค์ ํฉ๋๋ค.
///
@@ -58,6 +73,7 @@ namespace UVC.Factory.Alarm
dataMask["TRANSPORT_UNIT_NAME"] = "";
dataMask["TRANSPORT_EQP_ID"] = "";
dataMask["TRANSPORT_UNIT_ID"] = "";
+ dataMask["CLEAR_TIME"] = DateTime.Now;
dataMask["SET_TIME"] = DateTime.Now;
dataMask["UPDATE_TIME"] = DateTime.Now;
dataMask["TIMESTAMP"] = DateTime.Now;
@@ -78,6 +94,9 @@ namespace UVC.Factory.Alarm
// ์์ฑํ ํ์ดํ๋ผ์ธ ์ ๋ณด๋ฅผ ์ ์ญ MQTT ํ์ดํ๋ผ์ธ์ ์ถ๊ฐํฉ๋๋ค.
AppMain.Instance.MQTTPipeLine.Add(pipelineInfo);
}
+
+ int agvIdx = 50;
+
///
/// ๋ฐ์ดํฐ ์์ ์ ํธ์ถ๋๋ ๊ณต๊ฐ ํธ๋ค๋ฌ์
๋๋ค.
/// ์์ ๋ ALARM ๋ฐ์ดํฐ ๋ฐฐ์ด์ ๋น๋๊ธฐ์ ์ผ๋ก ์ฒ๋ฆฌํ์ฌ ์ฌ์ ๋ฐ์ํฉ๋๋ค.
@@ -86,43 +105,67 @@ namespace UVC.Factory.Alarm
/// ์์ ๋ ๋ฐ์ดํฐ ๊ฐ์ฒด (DataArray ํํ)
public void OnUpdateData(IDataObject? data)
{
-
if (data == null) return;
DataArray? arr = data as DataArray;
- if (arr == null) return;
- if (arr.Count == 0)
- {
- arr.ReturnToPool();
- return;
- }
+ if (arr == null || arr.Count == 0) return;
// ๋ฐ์ดํฐ ๋ฐฐ์ด์์ ์ถ๊ฐ, ์ ๊ฑฐ, ์์ ๋ ํญ๋ชฉ ๋ฆฌ์คํธ๋ฅผ ๊ฐ์ ธ์ต๋๋ค.
var AddedItems = arr.AddedItems;
- var RemovedItems = arr.RemovedItems;
+ var RemovedItems = new List(arr.RemovedItems);
var ModifiedList = arr.ModifiedList;
Debug.Log($"AlarmManager OnUpdateData: Added={AddedItems.Count}, Removed={RemovedItems.Count}, Modified={ModifiedList.Count}");
+ // clear_time์ด ์๋ ํญ๋ชฉ๋ง ์ ๊ฑฐ ๋ฆฌ์คํธ์ ์ถ๊ฐํฉ๋๋ค.
+ foreach (var item in AddedItems.ToList())
+ {
+ if (item.GetDateTime("CLEAR_TIME") != null)
+ {
+ if (RemovedItems.FindIndex((i) => i.Id == item.Id) == -1) RemovedItems.Add(item);
+ }
+ }
+
+ foreach (var item in ModifiedList.ToList())
+ {
+ if (item.GetDateTime("CLEAR_TIME") != null)
+ {
+ if (RemovedItems.FindIndex((i) => i.Id == item.Id) == -1) RemovedItems.Add(item);
+ }
+ }
+
// ์๋ก ์ถ๊ฐ๋ ALARM ์ฒ๋ฆฌ
foreach (var item in AddedItems.ToList())
{
- HandleNewAlarm(item.Copy());
- }
-
- // ์ ๊ฑฐ๋ ALARM ์ฒ๋ฆฌ
- foreach (var item in RemovedItems.ToList())
- {
- HandleClearedAlarm(item.Copy());
+ if (item.GetDateTime("CLEAR_TIME") == null && !item.Id.IsNullOrEmpty())
+ {
+ item["TRANSPORT_EQP_ID"] = agvNames[agvIdx]; // AGV ์ด๋ฆ์ TRANSPORT_EQP_ID์ ์ค์
+ alarmAgvNames.Add(item.Id!, agvNames[agvIdx]);
+ HandleNewAlarm(item);
+ agvIdx++;
+ if(agvIdx >= agvNames.Count) agvIdx = 0; // AGV ์ด๋ฆ์ด ๋ถ์กฑํ ๊ฒฝ์ฐ ์ํ
+ }
}
// ์ ๋ณด๊ฐ ์์ ๋ ALARM ์ฒ๋ฆฌ
foreach (var item in ModifiedList.ToList())
{
- HandleModifyAlarm(item.Copy());
+ if (item.GetDateTime("CLEAR_TIME") == null && !item.Id.IsNullOrEmpty() && alarmAgvNames.ContainsKey(item.Id!))
+ {
+ item["TRANSPORT_EQP_ID"] = alarmAgvNames[item.Id!]; // ๊ธฐ์กด AGV ์ด๋ฆ ์ ์ง
+ HandleModifyAlarm(item);
+ }
}
- arr.ReturnToPool();
+ // ์ ๊ฑฐ๋ ALARM ์ฒ๋ฆฌ
+ foreach (var item in RemovedItems.ToList())
+ {
+ if (!item.Id.IsNullOrEmpty() && alarmAgvNames.ContainsKey(item.Id!))
+ {
+ item["TRANSPORT_EQP_ID"] = alarmAgvNames[item.Id!]; // ๊ธฐ์กด AGV ์ด๋ฆ ์ ์ง
+ HandleClearedAlarm(item);
+ }
+ }
}
///
@@ -140,12 +183,12 @@ namespace UVC.Factory.Alarm
if (data.Id == null)
{
Debug.LogError($"New Alarm Received No data. {data}");
- data.ReturnToPool();
return;
}
// ์์ผ๋ฉด ์๋ก ์์ฑ
- FactoryObject? targetObject = dataManager!.FindById(data.GetString("MACHINENAME")!);
+ FactoryObject? targetObject = dataManager!.FindByName(data.GetString("TRANSPORT_EQP_ID")!);
+ Debug.Log($"AlarmManager {targetObject==null} {data.Id}, {data.GetString("TRANSPORT_EQP_ID")}");
if (targetObject != null)
{
GameObject newUIObject = Instantiate(alarmUIPrefab, transform); // ๋งค๋์ ํ์์ ์์ฑ
@@ -162,7 +205,6 @@ namespace UVC.Factory.Alarm
if (data.Id == null)
{
Debug.LogError($"Modify Alarm Received No data. {data}");
- data.ReturnToPool();
return;
}
// ์ด๋ฏธ ํด๋น ์ค๋น์ ์๋ UI๊ฐ ๋ ์๋์ง ํ์ธ
@@ -178,7 +220,6 @@ namespace UVC.Factory.Alarm
if (data.Id.IsNullOrEmpty())
{
Debug.LogError($"Clear Alarm Received No data. {data}");
- data.ReturnToPool();
return;
}
if (activeAlarmUIs.TryGetValue(data.Id!, out AlarmUIController uiController))
@@ -189,7 +230,6 @@ namespace UVC.Factory.Alarm
activeAlarmUIs.Remove(data.Id!);
Destroy(uiController.gameObject);
}
- data.ReturnToPool();
}
}
}
diff --git a/Assets/Scripts/UVC/Factory/Alarm/AlarmUIController.cs b/Assets/Scripts/UVC/Factory/Alarm/AlarmUIController.cs
index 2b7ce080..c98a8d1f 100644
--- a/Assets/Scripts/UVC/Factory/Alarm/AlarmUIController.cs
+++ b/Assets/Scripts/UVC/Factory/Alarm/AlarmUIController.cs
@@ -1,4 +1,5 @@
-๏ปฟusing System.Collections.Generic;
+๏ปฟusing DG.Tweening;
+using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
@@ -22,6 +23,21 @@ namespace UVC.Factory.Alarm
private Transform targetObject;
private List alarms = new List();
private bool isExpanded = false;
+ private SingleAlarmIcon singleAlarmIcon1 = null;
+
+ private RectTransform rectTransform;
+ private Canvas mainCanvas;
+
+ private float uiSpacing = 20f; // ๊ฐ๊ฒฉ
+ private Tweener uiSpacingTweener;
+
+ private bool isZoomIn = false; // ์ค ์ธ ์ํ๋ฅผ ์ถ์ ํ๊ธฐ ์ํ ๋ณ์
+
+ private void Awake()
+ {
+ rectTransform = GetComponent();
+ mainCanvas = GetComponentInParent
public class CameraController : SingletonScene
{
- [Tooltip("์นด๋ฉ๋ผ ํํ ์ด๋ ์๋")]
- public float panSpeed = 20f;
+ [Header("Panning Speed")]
+ [Tooltip("์นด๋ฉ๋ผ ๋์ด๊ฐ ์๊ณ๊ฐ๋ณด๋ค ๋ฎ์ ๋์ ํํ ์ด๋ ์๋")]
+ public float lowAltitudePanSpeed = 0.5f;
+
+ [Tooltip("์นด๋ฉ๋ผ ๋์ด๊ฐ ์๊ณ๊ฐ๋ณด๋ค ๋์ ๋์ ํํ ์ด๋ ์๋")]
+ public float highAltitudePanSpeed = 10f;
[Tooltip("์นด๋ฉ๋ผ ํ์ ์๋")]
public float rotationSpeed = 300f;
@@ -26,16 +31,167 @@ namespace UVC.Util
[Tooltip("ํจ๋ ์ ๋ง์ฐ์ค ์ด๋๋์ ์ต๋๊ฐ์ ์ ํํ์ฌ, ํ๋ ์ ๋๋ ์ ์นด๋ฉ๋ผ๊ฐ ๊ธ๊ฒฉํ๊ฒ ํ๋ ํ์์ ๋ฐฉ์งํฉ๋๋ค.")]
public float maxPanDelta = 50f;
+ [Header("Camera")]
+ [Tooltip("์นด๋ฉ๋ผ ์ต์ ๋์ด")]
+ public float minCameraY = 2f;
+
+ [Tooltip("์นด๋ฉ๋ผ ์ต๋ ๋์ด")]
+ public float maxCameraY = 50f;
+
+ [Tooltip("์นด๋ฉ๋ผ์ ์ต์ ์์ง ํ์ ๊ฐ๋ (X์ถ)")]
+ public float minPitch = 20f;
+
+ [Tooltip("์นด๋ฉ๋ผ์ ์ต๋ ์์ง ํ์ ๊ฐ๋ (X์ถ)")]
+ public float maxPitch = 85f;
+
+ [Tooltip("์นด๋ฉ๋ผ์ ์ต์ ์ํ ํ์ ๊ฐ๋ (y์ถ)")]
+ public float minYaw = -45f;
+
+ [Tooltip("์นด๋ฉ๋ผ์ ์ต๋ ์ํ ํ์ ๊ฐ๋ (y์ถ)")]
+ public float maxYaw = 45f;
+
+ ///
+ /// ์นด๋ฉ๋ผ์ ๋ณํ์ด ๋ณ๊ฒฝ๋ ๋ ๋ฐ์ํฉ๋๋ค.
+ ///
+ /// ์ด ์ด๋ฒคํธ๋ ์นด๋ฉ๋ผ์ ๋ณํ์ด ์
๋ฐ์ดํธ๋ ๋๋ง๋ค ํธ๋ฆฌ๊ฑฐ๋๋ฉฐ,
+ /// ๊ตฌ๋
์๋ ์์น, ํ์ ๋๋ ํฌ๊ธฐ ๋ณ๊ฒฝ์ ์๋ตํ ์ ์์ต๋๋ค. ์ด ์ด๋ฒคํธ๋ฅผ ์ฌ์ฉํ์ฌ
+ /// UI ์์ ์
๋ฐ์ดํธ ๋๋ ์ข
์ ๊ฐ ์ฌ๊ณ์ฐ๊ณผ ๊ฐ์ ์์
์ ์ํํ ์ ์์ต๋๋ค.
+ public event Action OnCameraChanged;
+
+ ///
+ /// ์นด๋ฉ๋ผ ์์น๊ฐ ๋ณ๊ฒฝ๋ ๋ ๋ฐ์ํฉ๋๋ค.
+ ///
+ /// ์ด ์ด๋ฒคํธ๋ ์นด๋ฉ๋ผ ์์น๊ฐ ์
๋ฐ์ดํธ๋ ๋๋ง๋ค ํธ๋ฆฌ๊ฑฐ๋ฉ๋๋ค. ๊ตฌ๋
์๋
+ /// ์ด ์ด๋ฒคํธ๋ฅผ ์ฌ์ฉํ์ฌ UI ์์๋ฅผ ์
๋ฐ์ดํธํ๊ฑฐ๋ ์ ์์น๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๊ณ์ฐ์ ์ํํ๋ ๋ฑ ์นด๋ฉ๋ผ ์์น ๋ณ๊ฒฝ์ ๋์ํ ์ ์์ต๋๋ค.
+ ///
+ public event Action OnCameraPositionChanged;
+
+ ///
+ /// ์นด๋ฉ๋ผ์ ํ์ ์ด ๋ณ๊ฒฝ๋ ๋ ๋ฐ์ํฉ๋๋ค.
+ ///
+ /// ์ด ์ด๋ฒคํธ๋ ์นด๋ฉ๋ผ์ ํ์ ์ด ์
๋ฐ์ดํธ๋ ๋๋ง๋ค ํธ๋ฆฌ๊ฑฐ๋ฉ๋๋ค. ๊ตฌ๋
์๋
+ /// ์ด ์ด๋ฒคํธ๋ฅผ ์ฌ์ฉํ์ฌ ์นด๋ฉ๋ผ ๋ฐฉํฅ์ ๋ณ๊ฒฝ์ ์๋ตํ ์ ์์ต๋๋ค.
+ public event Action OnCameraRotionChanged;
+
+ ///
+ /// ์ ์๋ ๋ฒ์ ๋ด์์ ์นด๋ฉ๋ผ์ ์ ๊ทํ๋ ์์ง ์์น๋ฅผ ๊ฐ์ ธ์ต๋๋ค.
+ ///
+ /// ๊ฐ์ ์นด๋ฉ๋ผ์ ํ์ฌ ์์ง ์์น๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๊ณ์ฐ๋๋ฉฐ
+ /// [0, 1] ๋ฒ์๋ก ๊ณ ์ ๋ฉ๋๋ค.
+ public float CameraYRate
+ {
+ get
+ {
+ // ์นด๋ฉ๋ผ ๋์ด์ ๋ฐ๋ผ 0~1 ์ฌ์ด์ ๊ฐ์ ๋ฐํํฉ๋๋ค.
+ return Mathf.Clamp01((transform.position.y - minCameraY) / (maxCameraY - minCameraY));
+ }
+ }
+
+ private Transform prevTransform; // ์ด์ ์นด๋ฉ๋ผ ๊ฑฐ๋ฆฌ
+
private Vector3 lastPanPosition;
private Vector3 rotationPivot;
private bool isRotating = false;
+ private Coroutine focusCoroutine; // ํ์ฌ ์คํ ์ค์ธ ํฌ์ปค์ฑ ์ฝ๋ฃจํด์ ์ ์ฅํ ๋ณ์
+
void Start()
{
// ์คํฌ๋ฆฝํธ ์์ ์, ํ์ ์ ๊ธฐ์ค์ด ๋๋ ์ค์ฌ์ ์ ์นด๋ฉ๋ผ ์์ชฝ์ผ๋ก ์ด๊ธฐํํฉ๋๋ค.
rotationPivot = transform.position + transform.forward * 10f;
+ this.prevTransform = transform; // ์ด๊ธฐ ์นด๋ฉ๋ผ ์์น ์ ์ฅ
}
+ private void StopFocusCoroutine()
+ {
+ if (focusCoroutine != null)
+ {
+ StopCoroutine(focusCoroutine);
+ focusCoroutine = null;
+ }
+ }
+
+ private void DispatchEvnet()
+ {
+ if (prevTransform != null && (prevTransform.position != transform.position || prevTransform.rotation != transform.rotation))
+ {
+ OnCameraChanged?.Invoke(transform);
+ if(prevTransform.position != transform.position)
+ {
+ OnCameraPositionChanged?.Invoke(transform.position);
+ }
+ if(prevTransform.rotation != transform.rotation)
+ {
+ OnCameraRotionChanged?.Invoke(transform.rotation);
+ }
+ }
+ prevTransform = transform; // ํ์ฌ ์นด๋ฉ๋ผ ์์น ์ ์ฅ
+ }
+
+ private void ValidateCameraTransform()
+ {
+ // ์นด๋ฉ๋ผ์ ์์น๊ฐ ์ต์/์ต๋ ๋์ด ๋ฒ์๋ฅผ ๋ฒ์ด๋์ง ์๋๋ก ํฉ๋๋ค.
+ Vector3 currentPosition = transform.position;
+ currentPosition.y = Mathf.Clamp(currentPosition.y, minCameraY, maxCameraY);
+ transform.position = currentPosition;
+ ValidateCameraRotation();
+
+ // ์นด๋ฉ๋ผ์ ์์น๊ฐ ๋๋ฌด ๋ฉ๋ฆฌ ๋จ์ด์ง์ง ์๋๋ก ํฉ๋๋ค.
+ //float distance = Vector3.Distance(transform.position, rotationPivot);
+ //if (distance > 100f) // ์์๋ก 100f๋ฅผ ์ต๋ ๊ฑฐ๋ฆฌ๋ก ์ค์
+ //{
+ // transform.position = rotationPivot + (transform.position - rotationPivot).normalized * 100f;
+ //}
+ }
+
+ private void ValidateCameraRotation()
+ {
+ // ํ์ฌ ํ์ ๊ฐ์ ์ค์ผ๋ฌ ๊ฐ์ผ๋ก ๊ฐ์ ธ์ต๋๋ค.
+ Vector3 eulerAngles = transform.eulerAngles;
+ // ์ค์ผ๋ฌ ๊ฐ์ X์ถ(Pitch) ๊ฐ์ ์ ๊ทํํ๊ณ ์ ํํฉ๋๋ค.
+ // ๊ฐ๋๊ฐ 180๋๋ฅผ ๋์ด๊ฐ๋ฉด ์์ ๊ฐ์ผ๋ก ๋ณํํ์ฌ ์ฒ๋ฆฌํฉ๋๋ค. (์: 350๋ -> -10๋)
+ float angleX = eulerAngles.x;
+ if (angleX > 180f) angleX -= 360f;
+ angleX = Mathf.Clamp(angleX, minPitch, maxPitch);
+ eulerAngles.x = angleX;
+
+ float angleY = eulerAngles.y;
+ if (angleY > 180f) angleY -= 360f;
+ angleY = Mathf.Clamp(angleY, minYaw, maxYaw);
+ eulerAngles.y = angleY;
+
+ // Z์ถ ํ์ (๋กค)์ 0์ผ๋ก ์ค์ ํ์ฌ ์นด๋ฉ๋ผ๊ฐ ์์ผ๋ก ๊ธฐ์ธ์ด์ง๋ ๊ฒ์ ๋ฐฉ์งํฉ๋๋ค.
+ eulerAngles.z = 0f;
+
+ // ์์ ๋ ์ค์ผ๋ฌ ๊ฐ์ ๋ค์ ์ฟผํฐ๋์ธ์ผ๋ก ๋ณํํ์ฌ ์ ์ฉํฉ๋๋ค.
+ transform.rotation = Quaternion.Euler(eulerAngles);
+ }
+
+ private Quaternion ValidateRotation(Quaternion rotation)
+ {
+ // ํ์ฌ ํ์ ๊ฐ์ ์ค์ผ๋ฌ ๊ฐ์ผ๋ก ๊ฐ์ ธ์ต๋๋ค.
+ Vector3 eulerAngles = rotation.eulerAngles;
+ // ์ค์ผ๋ฌ ๊ฐ์ X์ถ(Pitch) ๊ฐ์ ์ ๊ทํํ๊ณ ์ ํํฉ๋๋ค.
+ // ๊ฐ๋๊ฐ 180๋๋ฅผ ๋์ด๊ฐ๋ฉด ์์ ๊ฐ์ผ๋ก ๋ณํํ์ฌ ์ฒ๋ฆฌํฉ๋๋ค. (์: 350๋ -> -10๋)
+ float angleX = eulerAngles.x;
+ if (angleX > 180f) angleX -= 360f;
+ angleX = Mathf.Clamp(angleX, minPitch, maxPitch);
+ eulerAngles.x = angleX;
+
+ float angleY = eulerAngles.y;
+ if (angleY > 180f) angleY -= 360f;
+ angleY = Mathf.Clamp(angleY, minYaw, maxYaw);
+ eulerAngles.y = angleY;
+
+ // Z์ถ ํ์ (๋กค)์ 0์ผ๋ก ์ค์ ํ์ฌ ์นด๋ฉ๋ผ๊ฐ ์์ผ๋ก ๊ธฐ์ธ์ด์ง๋ ๊ฒ์ ๋ฐฉ์งํฉ๋๋ค.
+ eulerAngles.z = 0f;
+
+ // ์์ ๋ ์ค์ผ๋ฌ ๊ฐ์ ๋ค์ ์ฟผํฐ๋์ธ์ผ๋ก ๋ณํํ์ฌ ์ ์ฉํฉ๋๋ค.
+ return Quaternion.Euler(eulerAngles);
+ }
+
+
+
// Update ๋์ LateUpdate๋ฅผ ์ฌ์ฉํ์ฌ ์นด๋ฉ๋ผ ์์ง์์ด ๋ค๋ฅธ ๋ชจ๋ ์
๋ฐ์ดํธ ์ดํ์ ์ฒ๋ฆฌ๋๋๋ก ํฉ๋๋ค.
// ์ด๋ฅผ ํตํด ์นด๋ฉ๋ผ์ ๋จ๋ฆผ์ด๋ ๋๊น ํ์์ ์ค์ผ ์ ์์ต๋๋ค.
void LateUpdate()
@@ -53,6 +209,7 @@ namespace UVC.Util
{
if (Input.GetMouseButtonDown(2))
{
+ StopFocusCoroutine();
lastPanPosition = Input.mousePosition;
}
@@ -66,11 +223,16 @@ namespace UVC.Util
delta = delta.normalized * maxPanDelta;
}
+ // ๋์ด์ ๋ฐ๋ผ ๋์ ์ผ๋ก ํจ๋ ์๋ ๊ฒฐ์ .
+ float currentPanSpeed = Mathf.Lerp(lowAltitudePanSpeed, highAltitudePanSpeed, CameraYRate); // ํ์ฌ ์นด๋ฉ๋ผ ๋์ด์ ๋ฐ๋ผ ํจ๋ ์๋๋ฅผ ๋ณด๊ฐํฉ๋๋ค.
// ์นด๋ฉ๋ผ์ ๋ก์ปฌ ์ขํ๊ณ๋ฅผ ๊ธฐ์ค์ผ๋ก ์ด๋๋์ ๋ณํํ์ฌ ์๋ ์ขํ๊ณ์์ ์ด๋์ํต๋๋ค.
- transform.Translate(transform.right * -delta.x * panSpeed * Time.deltaTime, Space.World);
- transform.Translate(transform.up * -delta.y * panSpeed * Time.deltaTime, Space.World);
+ transform.Translate(transform.right * -delta.x * currentPanSpeed * Time.deltaTime, Space.World);
+ transform.Translate(transform.up * -delta.y * currentPanSpeed * Time.deltaTime, Space.World);
+
+ ValidateCameraTransform();
lastPanPosition = Input.mousePosition;
+ DispatchEvnet();
}
}
@@ -82,6 +244,7 @@ namespace UVC.Util
{
if (Input.GetMouseButtonDown(1))
{
+ StopFocusCoroutine();
isRotating = true;
// ๋ง์ฐ์ค ํด๋ฆญ ์ง์ ์ผ๋ก Ray๋ฅผ ์ด์ ํ์ ์ ์ค์ฌ์ (pivot)์ ์ค์ ํฉ๋๋ค.
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
@@ -106,6 +269,21 @@ namespace UVC.Util
float mouseX = Input.GetAxis("Mouse X") * rotationSpeed * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y") * rotationSpeed * Time.deltaTime;
+ // ํ์ฌ X์ถ ํ์ ๊ฐ๋๋ฅผ ๊ฐ์ ธ์์ -180 ~ 180 ๋ฒ์๋ก ์ ๊ทํํฉ๋๋ค.
+ float currentPitch = transform.eulerAngles.x;
+ if (currentPitch > 180f) currentPitch -= 360f;
+
+ // ํ์ฌ Y์ถ ํ์ ๊ฐ๋๋ฅผ ๊ฐ์ ธ์์ -180 ~ 180 ๋ฒ์๋ก ์ ๊ทํํฉ๋๋ค.
+ float currentYaw = transform.eulerAngles.y;
+ if (currentYaw > 180f) currentYaw -= 360f;
+
+ // ๋ง์ฐ์ค ์
๋ ฅ์ผ๋ก ์ธํด Pitch ๋๋ Yaw ๊ฐ๋๊ฐ ํ๊ณ๋ฅผ ๋ฒ์ด๋๋์ง ํ์ธํฉ๋๋ค.
+ if ((mouseY > 0 && currentPitch >= maxPitch) || (mouseY < 0 && currentPitch <= minPitch)
+ || (mouseX < 0 && currentYaw >= maxYaw) || (mouseX > 0 && currentYaw <= minYaw))
+ {
+ return; // ํ๊ณ๋ฅผ ๋์ด์๋ ํ์ ์ ๋ง์ต๋๋ค.
+ }
+
// ์ํ ํ์ ์ผ๋ก ์ธํด ์์ง ํ์ ์ถ(transform.right)์ด ๋ณ์ง๋๋ ๊ฒ์ ๋ฐฉ์งํ๊ธฐ ์ํด
// ํ์ ์ ์ right ๋ฒกํฐ๋ฅผ ๋ฏธ๋ฆฌ ์ ์ฅํด ๋ก๋๋ค.
Vector3 verticalRotationAxis = transform.right;
@@ -115,6 +293,10 @@ namespace UVC.Util
transform.RotateAround(rotationPivot, Vector3.up, -mouseX);
// 2. ์์ง ํ์ (๋ฏธ๋ฆฌ ์ ์ฅํด ๋ ์นด๋ฉ๋ผ์ ์ค๋ฅธ์ชฝ ์ถ ๊ธฐ์ค)
transform.RotateAround(rotationPivot, verticalRotationAxis, mouseY);
+
+ ValidateCameraTransform();
+
+ DispatchEvnet();
}
}
@@ -126,6 +308,11 @@ namespace UVC.Util
float scroll = Input.GetAxis("Mouse ScrollWheel");
if (scroll != 0f)
{
+ // ํ์ฌ X์ถ ํ์ ๊ฐ๋๋ฅผ ํ์ธํ์ฌ ํ๊ณ ๋ฒ์ ๋ฐ์ด๋ฉด ์ค์ ๋ง์ต๋๋ค.
+ float currentPitch = transform.eulerAngles.x;
+ if (currentPitch > 180f) currentPitch -= 360f;
+ if (currentPitch < minPitch || currentPitch > maxPitch) return;
+
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Vector3 zoomTarget;
@@ -139,9 +326,22 @@ namespace UVC.Util
}
Vector3 direction = zoomTarget - transform.position;
+ Vector3 moveVector = direction.normalized * scroll * zoomSpeed;
+
+ // ์นด๋ฉ๋ผ๊ฐ ์๋๋ก ์์ง์ด๋ ค ํ๊ณ (moveVector.y < 0), ์ด๋ฏธ ์ต์ ๋์ด์ ๋๋ฌํ๋ค๋ฉด ์ค๋จํฉ๋๋ค.
+ if (moveVector.y < 0 && transform.position.y <= minCameraY) return;
+
+ // ์นด๋ฉ๋ผ๊ฐ ์๋ก ์์ง์ด๋ ค ํ๊ณ (moveVector.y > 0), ์ด๋ฏธ ์ต๋ ๋์ด์ ๋๋ฌํ๋ค๋ฉด ์ค๋จํฉ๋๋ค.
+ if (moveVector.y > 0 && transform.position.y >= maxCameraY) return;
+
+ StopFocusCoroutine();
// ์ค ์คํ
transform.position += direction.normalized * scroll * zoomSpeed;
+
+ ValidateCameraTransform();
+
+ DispatchEvnet();
}
}
@@ -149,15 +349,25 @@ namespace UVC.Util
///
/// ์ง์ ๋ Transform์ ์ค์ฌ์ผ๋ก ์นด๋ฉ๋ผ๋ฅผ ํฌ์ปค์ฑํฉ๋๋ค.
///
- /// ํฌ์ปค์คํ ๋์์ Transform
+ /// ํฌ์ปค์คํ ๋์์ Transform
/// ๋์๊ณผ์ ๊ฑฐ๋ฆฌ
- public void FocusOnTargetFast(Transform equipmentTransform, float distance)
+ public void FocusOnTargetFast(Vector3 equipmentPosition, float distance)
{
- if (equipmentTransform == null)
- return;
+ if (equipmentPosition == null) return;
+
+ Vector3 position = equipmentPosition;
+ if (position.y < minCameraY)
+ {
+ position.y = minCameraY; // ์ต์ ๋์ด ์ ํ
+ }
+ else if (position.y > maxCameraY)
+ {
+ position.y = maxCameraY; // ์ต๋ ๋์ด ์ ํ
+ }
+
// ์นด๋ฉ๋ผ๊ฐ ๋ฐ๋ผ๋ณผ ๋์์ ์ค์ฌ์
- Vector3 targetPosition = equipmentTransform.position;
+ Vector3 targetPosition = equipmentPosition;
// ํ์ฌ ์นด๋ฉ๋ผ์ ํ์ ๊ฐ์ ์ ์งํ๋ฉด์ ํ๊ฒ์ ๋ฐ๋ผ๋ณด๋ ๋ฐฉํฅ ์ค์
Vector3 directionToTarget = (targetPosition - transform.position).normalized;
@@ -171,30 +381,67 @@ namespace UVC.Util
// ํ์ ํผ๋ด ํฌ์ธํธ ์
๋ฐ์ดํธ
rotationPivot = targetPosition;
+
+ ValidateCameraTransform();
+
+ DispatchEvnet();
}
///
/// ์ง์ ๋ Transform์ ์ค์ฌ์ผ๋ก ์นด๋ฉ๋ผ๋ฅผ ํฌ์ปค์ฑํฉ๋๋ค.
///
- /// ํฌ์ปค์คํ ๋์์ Transform
+ /// ํฌ์ปค์คํ ๋์์ Transform
/// ๋์๊ณผ์ ๊ฑฐ๋ฆฌ
/// ์ด๋์ ๊ฑธ๋ฆฌ๋ ์๊ฐ(์ด), ๊ธฐ๋ณธ๊ฐ 1์ด
- public void FocusOnTarget(Transform equipmentTransform, float distance, float duration = 1.0f)
+ public void FocusOnTarget(Vector3 equipmentPosition, float distance, float duration = 1.0f)
{
- if (equipmentTransform == null)
- return;
-
+ if (equipmentPosition == null) return;
+
+ StopFocusCoroutine();
+
+ Vector3 position = equipmentPosition;
+ if(position.y < minCameraY)
+ {
+ position.y = minCameraY; // ์ต์ ๋์ด ์ ํ
+ }
+ else if(position.y > maxCameraY)
+ {
+ position.y = maxCameraY; // ์ต๋ ๋์ด ์ ํ
+ }
+
// ์ฝ๋ฃจํด์ ์ฌ์ฉํ์ฌ ๋ถ๋๋ฌ์ด ์ด๋ ๊ตฌํ
- StartCoroutine(SmoothFocusOnTarget(equipmentTransform, distance, duration));
+ focusCoroutine = StartCoroutine(SmoothFocusOnTarget(position, distance, duration));
}
-
+
+ ///
+ /// ์นด๋ฉ๋ผ๋ฅผ ์์ชฝ ๋ฐฉํฅ์ผ๋ก ์ง์ ๋ ๊ฑฐ๋ฆฌ๋งํผ ๋ฐ๊นฅ์ชฝ์ผ๋ก ๋ถ๋๋ฝ๊ฒ ์ด๋ํฉ๋๋ค.
+ ///
+ /// ์ด ๋ฉ์๋๋ ์ฝ๋ฃจํด์ ์ฌ์ฉํ์ฌ ์นด๋ฉ๋ผ์ ์์น๋ฅผ โโ์์ชฝ ๋ฐฉํฅ์ผ๋ก ๋ฐ๊นฅ์ชฝ์ผ๋ก ๋ถ๋๋ฝ๊ฒ ์ ํํฉ๋๋ค.
+ /// ์ ํ์ ์ง์ ๋ ์๊ฐ ๋์ ์ํ๋๋ฏ๋ก
+ /// ์๊ฐ์ ์ผ๋ก ๋ถ๋๋ฌ์ด ์์ง์์ ๊ตฌํํ ์ ์์ต๋๋ค.
+ /// ์นด๋ฉ๋ผ๋ฅผ ํ์ฌ ์์น์์ ๋ฐ๊นฅ์ชฝ์ผ๋ก ์ด๋ํ ๊ฑฐ๋ฆฌ(๋จ์)์
๋๋ค.
+ /// ์นด๋ฉ๋ผ ์ ํ์ด ๋ฐ์ํ๋ ์๊ฐ(์ด)์
๋๋ค. ๊ธฐ๋ณธ๊ฐ์ 1.0์ด์
๋๋ค.
+ public void FocusOut(float distance, float duration = 1.0f)
+ {
+
+ StopFocusCoroutine();
+
+ // ํ์ฌ ์นด๋ฉ๋ผ ์์น์ ํ์ ๊ฐ์ ์ ์ฅ
+ Vector3 startPosition = transform.position;
+ Quaternion startRotation = transform.rotation;
+ // ์นด๋ฉ๋ผ๊ฐ ๋ฐ๋ผ๋ณด๋ ๋ฐฉํฅ์ผ๋ก ์ง์ ๋ ๊ฑฐ๋ฆฌ๋งํผ ์ด๋
+ Vector3 targetPosition = transform.position + transform.forward * distance;
+ // ์ฝ๋ฃจํด์ ์ฌ์ฉํ์ฌ ๋ถ๋๋ฌ์ด ์ด๋ ๊ตฌํ
+ focusCoroutine = StartCoroutine(SmoothFocusOnTarget(targetPosition, distance, duration));
+ }
+
///
/// ๋ถ๋๋ฝ๊ฒ ํ๊ฒ๊น์ง ์ด๋ํ๋ ์ฝ๋ฃจํด
///
- private IEnumerator SmoothFocusOnTarget(Transform targetTransform, float distance, float duration)
+ private IEnumerator SmoothFocusOnTarget(Vector3 targetTransform, float distance, float duration)
{
// ์นด๋ฉ๋ผ๊ฐ ๋ฐ๋ผ๋ณผ ๋์์ ์ค์ฌ์
- Vector3 targetPosition = targetTransform.position;
+ Vector3 targetPosition = targetTransform;
// ์์ ์์น์ ํ์ ์ ์ฅ
Vector3 startPosition = transform.position;
@@ -206,7 +453,8 @@ namespace UVC.Util
// ์ต์ข
ํ์ ๊ฐ ๊ณ์ฐ
Quaternion endRotation = Quaternion.LookRotation(targetPosition - endPosition);
-
+ endRotation = ValidateRotation(endRotation); // ํ์ ๊ฐ ๊ฒ์ฆ ๋ฐ ์์
+
// ์ด๋ ์๊ฐ ๊ณ์ฐ์ ์ํ ๋ณ์
float elapsedTime = 0f;
@@ -221,7 +469,9 @@ namespace UVC.Util
// ์์น์ ํ์ ๋ณด๊ฐ
transform.position = Vector3.Lerp(startPosition, endPosition, smoothT);
transform.rotation = Quaternion.Slerp(startRotation, endRotation, smoothT);
-
+
+ ValidateCameraTransform();
+
yield return null;
}
@@ -231,6 +481,11 @@ namespace UVC.Util
// ํ์ ํผ๋ด ํฌ์ธํธ ์
๋ฐ์ดํธ
rotationPivot = targetPosition;
+
+ ValidateCameraTransform();
+
+ DispatchEvnet();
+ focusCoroutine = null; // ์ฝ๋ฃจํด ์๋ฃ ํ ์ฐธ์กฐ๋ฅผ null๋ก ์ค์
}
///
@@ -240,5 +495,9 @@ namespace UVC.Util
{
return t < 0.5f ? 4f * t * t * t : 1f - Mathf.Pow(-2f * t + 2f, 3f) / 2f;
}
+
+
+
+
}
}