diff --git a/Assets/Scenes/MainMenuScene.unity b/Assets/Scenes/MainMenuScene.unity index fce2f1f..37467eb 100644 --- a/Assets/Scenes/MainMenuScene.unity +++ b/Assets/Scenes/MainMenuScene.unity @@ -825,6 +825,50 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 904972682} m_CullTransparentMesh: 1 +--- !u!1 &998620165 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 998620167} + - component: {fileID: 998620166} + m_Layer: 0 + m_Name: ResetStaticDataManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &998620166 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 998620165} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e3b5bc96e9f30244e96976fd95441fb1, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &998620167 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 998620165} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1142.8285, y: 520.56396, z: 0.8565953} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1067931458 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Counters/BaseCounter.cs b/Assets/Scripts/Counters/BaseCounter.cs index 28c78c8..3afb640 100644 --- a/Assets/Scripts/Counters/BaseCounter.cs +++ b/Assets/Scripts/Counters/BaseCounter.cs @@ -6,6 +6,11 @@ public class BaseCounter : MonoBehaviour, IKitchenObjectParent { public static event EventHandler OnAnyObjectPlacedHere; + new public static void ResetStaticData() { + OnAnyObjectPlacedHere = null; + } + + [SerializeField] private Transform counterTopPoint; private KitchenObject kitchenObject; diff --git a/Assets/Scripts/Counters/CuttingCounter.cs b/Assets/Scripts/Counters/CuttingCounter.cs index 8bbe836..d5e3e8c 100644 --- a/Assets/Scripts/Counters/CuttingCounter.cs +++ b/Assets/Scripts/Counters/CuttingCounter.cs @@ -5,6 +5,11 @@ public class CuttingCounter : BaseCounter, IHasProgress { public static event EventHandler OnAnyCut; + + new public static void ResetStaticData() { + OnAnyCut = null; + } + public event EventHandler OnProgressChanged; public event EventHandler OnCut; diff --git a/Assets/Scripts/Counters/TrashCounter.cs b/Assets/Scripts/Counters/TrashCounter.cs index 0a6c112..c64c72a 100644 --- a/Assets/Scripts/Counters/TrashCounter.cs +++ b/Assets/Scripts/Counters/TrashCounter.cs @@ -5,6 +5,11 @@ public class TrashCounter : BaseCounter { public static event EventHandler OnAnyObjectTrashed; + + new public static void ResetStaticData() { + OnAnyObjectTrashed = null; + } + public override void Interact(Player player) { if(player.HasKitchenObject()) { player.GetKitchenObject().DestroySelf(); diff --git a/Assets/Scripts/GameInput.cs b/Assets/Scripts/GameInput.cs index 223e541..4e88a69 100644 --- a/Assets/Scripts/GameInput.cs +++ b/Assets/Scripts/GameInput.cs @@ -22,6 +22,14 @@ private void Awake() { playerInputActions.Player.Pause.performed += Pause_performed; } + private void OnDestroy() { + playerInputActions.Player.Interact.performed -= Interact_performed; + playerInputActions.Player.InteractAlternate.performed -= InteractAlternate_performed; + playerInputActions.Player.Pause.performed -= Pause_performed; + + playerInputActions.Dispose(); + } + private void Interact_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj) { OnInteractAction?.Invoke(this, EventArgs.Empty); } diff --git a/Assets/Scripts/ResetStaticDataManager.cs b/Assets/Scripts/ResetStaticDataManager.cs new file mode 100644 index 0000000..df80257 --- /dev/null +++ b/Assets/Scripts/ResetStaticDataManager.cs @@ -0,0 +1,11 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ResetStaticDataManager : MonoBehaviour { + private void Awake() { + BaseCounter.ResetStaticData(); + CuttingCounter.ResetStaticData(); + TrashCounter.ResetStaticData(); + } +} diff --git a/Assets/Scripts/ResetStaticDataManager.cs.meta b/Assets/Scripts/ResetStaticDataManager.cs.meta new file mode 100644 index 0000000..dcbd77b --- /dev/null +++ b/Assets/Scripts/ResetStaticDataManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e3b5bc96e9f30244e96976fd95441fb1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: