Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pause #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 31 additions & 18 deletions Assets/Scenes/Game.unity
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ LightmapSettings:
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
Expand Down Expand Up @@ -202,6 +203,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -271,6 +273,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -348,6 +351,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.20131718, g: 0.41924864, b: 0.735849, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -385,7 +389,6 @@ GameObject:
- component: {fileID: 183891070}
- component: {fileID: 183891069}
- component: {fileID: 183891068}
- component: {fileID: 183891071}
m_Layer: 5
m_Name: Background
m_TagString: Untagged
Expand Down Expand Up @@ -441,6 +444,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand All @@ -459,20 +463,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 183891066}
m_CullTransparentMesh: 0
--- !u!114 &183891071
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 183891066}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f63c74d23a090e342ba6ca02ff703af1, type: 3}
m_Name:
m_EditorClassIdentifier:
cam: {fileID: 563382494}
planeObject: {fileID: 183891067}
--- !u!1 &203830544
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -525,6 +515,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -752,6 +743,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -925,6 +917,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -1081,6 +1074,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -1214,6 +1208,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -1515,6 +1510,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.3191527, g: 0.3539574, b: 0.41509432, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -1652,6 +1648,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -1747,6 +1744,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -1901,6 +1899,7 @@ MonoBehaviour:
m_Material: {fileID: 2100000, guid: 28e994b1d19a6c140a6cdb4d8471cf48, type: 2}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -2019,6 +2018,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -2236,6 +2236,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -2314,6 +2315,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -2387,6 +2389,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.19625865, g: 0.6202379, b: 0.8088235, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -2523,6 +2526,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -2739,6 +2743,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -2817,6 +2822,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -2863,8 +2869,9 @@ Light:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1464097466}
m_Enabled: 1
serializedVersion: 9
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 2
m_Range: 10
Expand Down Expand Up @@ -3091,6 +3098,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -3311,6 +3319,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0.9245283, g: 0.9245283, b: 0.9245283, a: 0.26666668}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -3396,6 +3405,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -3473,6 +3483,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -3539,7 +3550,7 @@ RectTransform:
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_SizeDelta: {x: 10, y: 10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2079953647
MonoBehaviour:
Expand All @@ -3555,8 +3566,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.15862082, g: 0, b: 1, a: 0.392}
m_Color: {r: 0.15686275, g: 0, b: 1, a: 0.392}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -3631,6 +3643,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
Expand Down
13 changes: 0 additions & 13 deletions Assets/Scripts/Game/GameState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public class GameState : MonoBehaviour
public event GameOverHandler OnGameOver;
public delegate void RoundWonHandler();
public event RoundWonHandler OnRoundWon;
public delegate void PauseHandler();
public event PauseHandler OnPause;
public delegate void RoundStartHandler();
public event RoundStartHandler OnRoundStart;

Expand Down Expand Up @@ -60,17 +58,6 @@ public bool RoundWon {
}
}

private bool paused;
public bool Paused {
get { return paused; }
set {
paused = value;
Time.timeScale = value ? 0f : 1f;
Time.fixedDeltaTime = value ? 0f : 0.02f; //0.02 is Unity's default
if (value && OnPause != null) OnPause();
}
}

private bool roundStarted;
/// <summary>
/// True when the game is in "playable" state after everything
Expand Down
8 changes: 2 additions & 6 deletions Assets/Scripts/Game/UIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ public void Start() {
sfx.clip = pauseSfx;
sfx.volume = 1f;
}
#if DEBUG
else Debug.LogWarning("Pause audio-clip has not been assigned.");
#endif

pauseToMenuButton?.onClick.AddListener(() => {
gameState.Paused = false;
UnityEngine.SceneManagement.SceneManager
.LoadScene(0);
});
Expand All @@ -94,16 +95,11 @@ public void TogglePauseMenu() {
RoundIndex.text = "Round: " + gameState.Level;
uiCanvas.SetActive(false);
pauseCanvas.SetActive(true);
gameState.Paused = true;
}
else {
uiCanvas.SetActive(true);
pauseCanvas.SetActive(false);
gameState.Paused = false;
}
#if DEBUG
Debug.Log("UIMANAGER:: TimeScale: " + Time.timeScale);
#endif
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2019.2.14f1
m_EditorVersionWithRevision: 2019.2.14f1 (49dd4e9fa428)
m_EditorVersion: 2019.4.10f1
m_EditorVersionWithRevision: 2019.4.10f1 (5311b3af6f69)