Prototyped the object production scheduling.

This commit is contained in:
Khauvinkh 2024-08-17 15:12:00 +02:00
parent 4c839e6f98
commit 5a8bab2f41
23 changed files with 726 additions and 0 deletions

8
Assets/Data.meta Normal file
View File

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

View File

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

View File

@ -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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b4bf7d0b0795b3a4989205a8712359e5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 98116939c68dd7245a957cb28df77678
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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

View File

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

View File

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

View File

@ -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:

View File

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

View File

@ -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

View File

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

View File

@ -23,6 +23,8 @@ public class StagingManager: MonoBehaviour
{ {
Instance = this; Instance = this;
} }
SetStage(StageEnum.Level1);
} }
public void OnDestroy() public void OnDestroy()

View File

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ProductReceiver : MonoBehaviour
{
///HashSet<Rigidbody> enteredBodies = new HashSet<Rigidbody>();
public int normalProductCount;
public int defectiveProductCount;
private void OnCollisionEnter(Collision collision)
{
var rb = collision.rigidbody;
if (!rb)
{
return;
}
//enteredBodies.Add(rb);
if (rb.GetComponent<DefectiveProduct>())
{
defectiveProductCount++;
}
else
{
normalProductCount++;
}
Destroy(rb.gameObject);
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6de8f4eed85043df853aee4396834741
timeCreated: 1723897952

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9adc44b5a83c4f599556f32f639d3934
timeCreated: 1723896059

View File

@ -0,0 +1,6 @@
using UnityEngine;
public class DefectiveProduct : MonoBehaviour
{
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 05b73befcbdd4bbfaaee667a8da86b1f
timeCreated: 1723897738

View File

@ -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;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a80c2e8703664de8943062f03eedfe17
timeCreated: 1723896074

View File

@ -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<ProductionPhase> 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);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 13fa2421a3e649448c929ac42745ad65
timeCreated: 1723896826