From 5a8bab2f417c2d8c2f69644f21143d7ad6d3ba17 Mon Sep 17 00:00:00 2001 From: Khauvinkh Date: Sat, 17 Aug 2024 15:12:00 +0200 Subject: [PATCH] Prototyped the object production scheduling. --- Assets/Data.meta | 8 + Assets/Data/Products.meta | 8 + Assets/Data/Products/Crates.asset | 19 ++ Assets/Data/Products/Crates.asset.meta | 8 + Assets/Data/Products/Defective Crates.asset | 17 ++ .../Data/Products/Defective Crates.asset.meta | 8 + Assets/Prefabs/Conveyor Segment.prefab | 180 ++++++++++++++++++ Assets/Prefabs/Conveyor Segment.prefab.meta | 7 + Assets/Prefabs/Products.meta | 8 + .../Prefabs/Products/Crate_Defective.prefab | 148 ++++++++++++++ .../Products/Crate_Defective.prefab.meta | 7 + Assets/Prefabs/Products/Crate_Normal.prefab | 135 +++++++++++++ .../Prefabs/Products/Crate_Normal.prefab.meta | 7 + .../Scripts/Game Schedule/StagingManager.cs | 2 + Assets/Scripts/ProductReceiver.cs | 34 ++++ Assets/Scripts/ProductReceiver.cs.meta | 3 + Assets/Scripts/Products.meta | 3 + Assets/Scripts/Products/DefectiveProduct.cs | 6 + .../Scripts/Products/DefectiveProduct.cs.meta | 3 + Assets/Scripts/Products/ProductDescription.cs | 36 ++++ .../Products/ProductDescription.cs.meta | 3 + Assets/Scripts/Products/ProductSpawner.cs | 73 +++++++ .../Scripts/Products/ProductSpawner.cs.meta | 3 + 23 files changed, 726 insertions(+) create mode 100644 Assets/Data.meta create mode 100644 Assets/Data/Products.meta create mode 100644 Assets/Data/Products/Crates.asset create mode 100644 Assets/Data/Products/Crates.asset.meta create mode 100644 Assets/Data/Products/Defective Crates.asset create mode 100644 Assets/Data/Products/Defective Crates.asset.meta create mode 100644 Assets/Prefabs/Conveyor Segment.prefab create mode 100644 Assets/Prefabs/Conveyor Segment.prefab.meta create mode 100644 Assets/Prefabs/Products.meta create mode 100644 Assets/Prefabs/Products/Crate_Defective.prefab create mode 100644 Assets/Prefabs/Products/Crate_Defective.prefab.meta create mode 100644 Assets/Prefabs/Products/Crate_Normal.prefab create mode 100644 Assets/Prefabs/Products/Crate_Normal.prefab.meta create mode 100644 Assets/Scripts/ProductReceiver.cs create mode 100644 Assets/Scripts/ProductReceiver.cs.meta create mode 100644 Assets/Scripts/Products.meta create mode 100644 Assets/Scripts/Products/DefectiveProduct.cs create mode 100644 Assets/Scripts/Products/DefectiveProduct.cs.meta create mode 100644 Assets/Scripts/Products/ProductDescription.cs create mode 100644 Assets/Scripts/Products/ProductDescription.cs.meta create mode 100644 Assets/Scripts/Products/ProductSpawner.cs create mode 100644 Assets/Scripts/Products/ProductSpawner.cs.meta diff --git a/Assets/Data.meta b/Assets/Data.meta new file mode 100644 index 0000000..ca9b48a --- /dev/null +++ b/Assets/Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2a96180b7b582854aafe76f7333ec6da +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Data/Products.meta b/Assets/Data/Products.meta new file mode 100644 index 0000000..051a049 --- /dev/null +++ b/Assets/Data/Products.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 74d4feb17b94d6844a90a8d555e9c666 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Data/Products/Crates.asset b/Assets/Data/Products/Crates.asset new file mode 100644 index 0000000..d29ae62 --- /dev/null +++ b/Assets/Data/Products/Crates.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a80c2e8703664de8943062f03eedfe17, type: 3} + m_Name: Crates + m_EditorClassIdentifier: + Products: + - Prefab: {fileID: 8661871210265028242, guid: ca01f03442732704ba414883790643f7, type: 3} + Probability: 80 + - Prefab: {fileID: 8661871210265028242, guid: c150b9eb048821c47a8d6083804e00e0, type: 3} + Probability: 20 diff --git a/Assets/Data/Products/Crates.asset.meta b/Assets/Data/Products/Crates.asset.meta new file mode 100644 index 0000000..ee457f5 --- /dev/null +++ b/Assets/Data/Products/Crates.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b4bf7d0b0795b3a4989205a8712359e5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Data/Products/Defective Crates.asset b/Assets/Data/Products/Defective Crates.asset new file mode 100644 index 0000000..2df7755 --- /dev/null +++ b/Assets/Data/Products/Defective Crates.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a80c2e8703664de8943062f03eedfe17, type: 3} + m_Name: Defective Crates + m_EditorClassIdentifier: + Products: + - Prefab: {fileID: 8661871210265028242, guid: c150b9eb048821c47a8d6083804e00e0, type: 3} + Probability: 100 diff --git a/Assets/Data/Products/Defective Crates.asset.meta b/Assets/Data/Products/Defective Crates.asset.meta new file mode 100644 index 0000000..79f38bc --- /dev/null +++ b/Assets/Data/Products/Defective Crates.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 98116939c68dd7245a957cb28df77678 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Conveyor Segment.prefab b/Assets/Prefabs/Conveyor Segment.prefab new file mode 100644 index 0000000..7987624 --- /dev/null +++ b/Assets/Prefabs/Conveyor Segment.prefab @@ -0,0 +1,180 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2145288034412905379 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8393158071281731187} + - component: {fileID: 4019203134528671860} + - component: {fileID: 7929793937232939774} + - component: {fileID: 9009222233901790279} + - component: {fileID: 470903534124745041} + - component: {fileID: 3911113332551629849} + - component: {fileID: 5758010343525673458} + m_Layer: 0 + m_Name: Conveyor Segment + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8393158071281731187 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2145288034412905379} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0.5, y: 0.25, z: 0.125} + m_LocalScale: {x: 3.1029825, y: 0.40737152, z: 25} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0} +--- !u!33 &4019203134528671860 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2145288034412905379} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &7929793937232939774 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2145288034412905379} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a5c01c81e392f974bb852e613b09fa1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &9009222233901790279 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2145288034412905379} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!54 &470903534124745041 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2145288034412905379} + serializedVersion: 4 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_CenterOfMass: {x: 0, y: 0, z: 0} + m_InertiaTensor: {x: 1, y: 1, z: 1} + m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ImplicitCom: 1 + m_ImplicitTensor: 1 + m_UseGravity: 1 + m_IsKinematic: 1 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 0 +--- !u!114 &3911113332551629849 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2145288034412905379} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e0f1f2901f5dad644b6199c19a0e8cce, type: 3} + m_Name: + m_EditorClassIdentifier: + speed: 4 + scrollingTextureSpeedMult: -0.3 + scrollingTextureRenderer: {fileID: 7929793937232939774} +--- !u!114 &5758010343525673458 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2145288034412905379} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: af3e57595c24e7b4dbb6f7f44db23525, type: 3} + m_Name: + m_EditorClassIdentifier: + Size: + x: 13 + y: 2 + z: 100 + CenterOffset: + x: 0 + y: 0 + z: 0 + cachedSize: + x: 13 + y: 2 + z: 100 + cachedOffset: + x: 0 + y: 0 + z: 0 diff --git a/Assets/Prefabs/Conveyor Segment.prefab.meta b/Assets/Prefabs/Conveyor Segment.prefab.meta new file mode 100644 index 0000000..a22bc65 --- /dev/null +++ b/Assets/Prefabs/Conveyor Segment.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a69e0fd4aaecbfb46b3d664f44dd1b03 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Products.meta b/Assets/Prefabs/Products.meta new file mode 100644 index 0000000..0b911af --- /dev/null +++ b/Assets/Prefabs/Products.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cfbf3b0add419ce49a03b62e8082774e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Products/Crate_Defective.prefab b/Assets/Prefabs/Products/Crate_Defective.prefab new file mode 100644 index 0000000..07f7ebe --- /dev/null +++ b/Assets/Prefabs/Products/Crate_Defective.prefab @@ -0,0 +1,148 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8661871210265028242 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7217391875016474312} + - component: {fileID: 1328088793206638161} + - component: {fileID: 2547041061673746692} + - component: {fileID: 3271489653354074546} + - component: {fileID: 6230516344177671089} + - component: {fileID: 4025835224586210870} + m_Layer: 0 + m_Name: Crate_Defective + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7217391875016474312 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + serializedVersion: 2 + m_LocalRotation: {x: 0.67568386, y: -0.11777167, z: 0.12495836, w: 0.7169147} + m_LocalPosition: {x: 36.650307, y: 1.1982483, z: -0.14469147} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 86.608, y: 0, z: 19.775} +--- !u!33 &1328088793206638161 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &2547041061673746692 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 54361f89cfee8b94d810c14a6beb11b5, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &3271489653354074546 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!54 &6230516344177671089 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + serializedVersion: 4 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_CenterOfMass: {x: 0, y: 0, z: 0} + m_InertiaTensor: {x: 1, y: 1, z: 1} + m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ImplicitCom: 1 + m_ImplicitTensor: 1 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 1 + m_Constraints: 0 + m_CollisionDetection: 0 +--- !u!114 &4025835224586210870 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 05b73befcbdd4bbfaaee667a8da86b1f, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Prefabs/Products/Crate_Defective.prefab.meta b/Assets/Prefabs/Products/Crate_Defective.prefab.meta new file mode 100644 index 0000000..89e36ed --- /dev/null +++ b/Assets/Prefabs/Products/Crate_Defective.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c150b9eb048821c47a8d6083804e00e0 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Products/Crate_Normal.prefab b/Assets/Prefabs/Products/Crate_Normal.prefab new file mode 100644 index 0000000..17a06cf --- /dev/null +++ b/Assets/Prefabs/Products/Crate_Normal.prefab @@ -0,0 +1,135 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8661871210265028242 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7217391875016474312} + - component: {fileID: 1328088793206638161} + - component: {fileID: 2547041061673746692} + - component: {fileID: 3271489653354074546} + - component: {fileID: 6230516344177671089} + m_Layer: 0 + m_Name: Crate_Normal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7217391875016474312 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + serializedVersion: 2 + m_LocalRotation: {x: 0.67568386, y: -0.11777167, z: 0.12495836, w: 0.7169147} + m_LocalPosition: {x: 36.650307, y: 1.1982483, z: -0.14469147} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 86.608, y: 0, z: 19.775} +--- !u!33 &1328088793206638161 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &2547041061673746692 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: bef232e221fa62047b268fcc0f75629a, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &3271489653354074546 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!54 &6230516344177671089 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8661871210265028242} + serializedVersion: 4 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_CenterOfMass: {x: 0, y: 0, z: 0} + m_InertiaTensor: {x: 1, y: 1, z: 1} + m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ImplicitCom: 1 + m_ImplicitTensor: 1 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 1 + m_Constraints: 0 + m_CollisionDetection: 0 diff --git a/Assets/Prefabs/Products/Crate_Normal.prefab.meta b/Assets/Prefabs/Products/Crate_Normal.prefab.meta new file mode 100644 index 0000000..9ea6136 --- /dev/null +++ b/Assets/Prefabs/Products/Crate_Normal.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ca01f03442732704ba414883790643f7 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Game Schedule/StagingManager.cs b/Assets/Scripts/Game Schedule/StagingManager.cs index 0b71f93..ab1d107 100644 --- a/Assets/Scripts/Game Schedule/StagingManager.cs +++ b/Assets/Scripts/Game Schedule/StagingManager.cs @@ -23,6 +23,8 @@ public class StagingManager: MonoBehaviour { Instance = this; } + + SetStage(StageEnum.Level1); } public void OnDestroy() diff --git a/Assets/Scripts/ProductReceiver.cs b/Assets/Scripts/ProductReceiver.cs new file mode 100644 index 0000000..e8ca1c8 --- /dev/null +++ b/Assets/Scripts/ProductReceiver.cs @@ -0,0 +1,34 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ProductReceiver : MonoBehaviour +{ + ///HashSet enteredBodies = new HashSet(); + + public int normalProductCount; + public int defectiveProductCount; + + private void OnCollisionEnter(Collision collision) + { + var rb = collision.rigidbody; + + if (!rb) + { + return; + } + + //enteredBodies.Add(rb); + + if (rb.GetComponent()) + { + defectiveProductCount++; + } + else + { + normalProductCount++; + } + + Destroy(rb.gameObject); + } +} diff --git a/Assets/Scripts/ProductReceiver.cs.meta b/Assets/Scripts/ProductReceiver.cs.meta new file mode 100644 index 0000000..019fdba --- /dev/null +++ b/Assets/Scripts/ProductReceiver.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6de8f4eed85043df853aee4396834741 +timeCreated: 1723897952 \ No newline at end of file diff --git a/Assets/Scripts/Products.meta b/Assets/Scripts/Products.meta new file mode 100644 index 0000000..ec48612 --- /dev/null +++ b/Assets/Scripts/Products.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9adc44b5a83c4f599556f32f639d3934 +timeCreated: 1723896059 \ No newline at end of file diff --git a/Assets/Scripts/Products/DefectiveProduct.cs b/Assets/Scripts/Products/DefectiveProduct.cs new file mode 100644 index 0000000..bb58c42 --- /dev/null +++ b/Assets/Scripts/Products/DefectiveProduct.cs @@ -0,0 +1,6 @@ +using UnityEngine; + +public class DefectiveProduct : MonoBehaviour +{ + +} \ No newline at end of file diff --git a/Assets/Scripts/Products/DefectiveProduct.cs.meta b/Assets/Scripts/Products/DefectiveProduct.cs.meta new file mode 100644 index 0000000..ae35a0e --- /dev/null +++ b/Assets/Scripts/Products/DefectiveProduct.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 05b73befcbdd4bbfaaee667a8da86b1f +timeCreated: 1723897738 \ No newline at end of file diff --git a/Assets/Scripts/Products/ProductDescription.cs b/Assets/Scripts/Products/ProductDescription.cs new file mode 100644 index 0000000..e8c5ca9 --- /dev/null +++ b/Assets/Scripts/Products/ProductDescription.cs @@ -0,0 +1,36 @@ +using System; +using UnityEngine; +using Random = UnityEngine.Random; + +[CreateAssetMenu(fileName = "New Product Description", menuName = "Data/Product Description", order = 0)] +public class ProductDescription : ScriptableObject +{ + [Serializable] + public struct Product + { + public GameObject Prefab; + [Range(0,100)] + public int Probability; + } + + public Product[] Products; + + public GameObject GetRandomProduct() + { + float randomValue = Random.value; + float sum = 0; + + for (var i = 0; i < Products.Length; i++) + { + var product = Products[i]; + + sum += product.Probability / 100f; + if (randomValue <= sum) + { + return product.Prefab; + } + } + + return null; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Products/ProductDescription.cs.meta b/Assets/Scripts/Products/ProductDescription.cs.meta new file mode 100644 index 0000000..8a4a75f --- /dev/null +++ b/Assets/Scripts/Products/ProductDescription.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a80c2e8703664de8943062f03eedfe17 +timeCreated: 1723896074 \ No newline at end of file diff --git a/Assets/Scripts/Products/ProductSpawner.cs b/Assets/Scripts/Products/ProductSpawner.cs new file mode 100644 index 0000000..72862bf --- /dev/null +++ b/Assets/Scripts/Products/ProductSpawner.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public class ProductSpawner : MonoBehaviour +{ + public enum ProductionPhaseType + { + Pause = 0, + Production = 1, + } + + [Serializable] + public struct ProductionPhase + { + public ProductionPhaseType Type; + public ProductDescription Description; + [Min(1f)] + public float Duration; + [Min(1f)] + public float TotalSpawnCount; + + public float SpawnInterval => Duration / TotalSpawnCount; + } + + public List ProductionPhases; + + public float _remainingDuration; + public float _spawnTimer; + + private void Update() + { + if (ProductionPhases.Count == 0) + { + enabled = false; + return; + } + + var currentPhase = ProductionPhases[0]; + + if (_remainingDuration <= 0) + { + _remainingDuration = currentPhase.Duration; + _spawnTimer = 0f; + } + + _remainingDuration -= Time.deltaTime; + + if (currentPhase.Type != ProductionPhaseType.Pause) + { + _spawnTimer -= Time.deltaTime; + + if (_spawnTimer >= 0f) + { + if (_remainingDuration <= 0) + { + ProductionPhases.RemoveAt(0); + } + + return; + } + + _spawnTimer = currentPhase.SpawnInterval; + + Instantiate(currentPhase.Description.GetRandomProduct(), transform.position, Quaternion.identity); + } + + if (_remainingDuration <= 0) + { + ProductionPhases.RemoveAt(0); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Products/ProductSpawner.cs.meta b/Assets/Scripts/Products/ProductSpawner.cs.meta new file mode 100644 index 0000000..9c6d23d --- /dev/null +++ b/Assets/Scripts/Products/ProductSpawner.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 13fa2421a3e649448c929ac42745ad65 +timeCreated: 1723896826 \ No newline at end of file