Skip to content

Commit

Permalink
Reset Static Data added
Browse files Browse the repository at this point in the history
  • Loading branch information
theMr17 committed Apr 9, 2023
1 parent 42d01f9 commit d1a85c6
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Assets/Scenes/MainMenuScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/Counters/BaseCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/Counters/CuttingCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

public class CuttingCounter : BaseCounter, IHasProgress {
public static event EventHandler OnAnyCut;

new public static void ResetStaticData() {
OnAnyCut = null;
}

public event EventHandler<IHasProgress.OnProgressChangedEventArgs> OnProgressChanged;
public event EventHandler OnCut;

Expand Down
5 changes: 5 additions & 0 deletions Assets/Scripts/Counters/TrashCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/GameInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
11 changes: 11 additions & 0 deletions Assets/Scripts/ResetStaticDataManager.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/ResetStaticDataManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d1a85c6

Please sign in to comment.