Bug fixes for textrenderable and sterilization, added base for game pause #354
|
@ -9563,11 +9563,17 @@
|
|||
timer: 200
|
||||
scoreText: 237
|
||||
timeText: 206
|
||||
gamePauseText: 11
|
||||
multiplierText: 139
|
||||
maxMultiplierDuration: 5
|
||||
maxMultiplierCombo: 10
|
||||
multiplierFont: 60
|
||||
- Type: PauseMenu
|
||||
Enabled: true
|
||||
resumeBtn: 8
|
||||
retryBtn: 461
|
||||
quitBtn: 0
|
||||
gamePauseText: 11
|
||||
canvas: 10
|
||||
- EID: 199
|
||||
Name: =====Text====
|
||||
IsActive: true
|
||||
|
@ -9625,14 +9631,14 @@
|
|||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -145, y: 200, z: 0}
|
||||
Translate: {x: -250, y: 300, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 60, y: 60, z: 60}
|
||||
Scale: {x: 100, y: 100, z: 100}
|
||||
IsActive: true
|
||||
Text Renderer Component:
|
||||
Text: Game Pause
|
||||
Font: 176667660
|
||||
IsActive: true
|
||||
IsActive: false
|
||||
Scripts: ~
|
||||
- EID: 198
|
||||
Name: ====Raccoon====
|
||||
|
@ -9733,8 +9739,8 @@
|
|||
Pitch: 0
|
||||
Yaw: 360
|
||||
Roll: 1.28065994e-06
|
||||
Width: 1055
|
||||
Height: 604
|
||||
Width: 2560
|
||||
Height: 1369
|
||||
Near: 0.00999999978
|
||||
Far: 10000
|
||||
Perspective: true
|
||||
|
@ -10627,7 +10633,7 @@
|
|||
- EID: 10
|
||||
Name: Canvas
|
||||
IsActive: false
|
||||
NumberOfChildren: 1
|
||||
NumberOfChildren: 3
|
||||
Components:
|
||||
Canvas Component:
|
||||
Canvas Width: 1920
|
||||
|
@ -10635,12 +10641,12 @@
|
|||
IsActive: false
|
||||
Scripts: ~
|
||||
- EID: 8
|
||||
Name: Default
|
||||
Name: ResumeButton
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0, z: 0}
|
||||
Translate: {x: 0, y: 100, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 300, y: 200, z: 500}
|
||||
IsActive: true
|
||||
|
@ -10657,3 +10663,49 @@
|
|||
Canvas ID: 10
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 0
|
||||
Name: QuitButton
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: -300, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 300, y: 200, z: 500}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
Button Component:
|
||||
Default Texture: 66477839
|
||||
Hovered Texture: 65045286
|
||||
Clicked Texture: 58607560
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 10
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 461
|
||||
Name: RetryButton
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: -100, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 300, y: 200, z: 500}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
Button Component:
|
||||
Default Texture: 55782622
|
||||
Hovered Texture: 58972174
|
||||
Clicked Texture: 55224464
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 10
|
||||
IsActive: true
|
||||
Scripts: ~
|
|
@ -26,7 +26,6 @@ public class GameManager : Script
|
|||
|
||||
public GameObject scoreText;
|
||||
public GameObject timeText;
|
||||
public GameObject gamePauseText;
|
||||
|
||||
//mulitpler info
|
||||
public GameObject multiplierText;
|
||||
|
@ -80,7 +79,6 @@ public class GameManager : Script
|
|||
currMultiplierCombo = 1;
|
||||
currMultiplierDuration = 0;
|
||||
fontScalar = new Vector3(multiplierFont / maxMultiplierDuration, multiplierFont / maxMultiplierDuration , multiplierFont / maxMultiplierDuration);
|
||||
GamePause = false;
|
||||
|
||||
AudioHandler.audioClipHandlers["BGMWin"] = Audio.CreateAudioClip("event:/Music/stingers/game_win");
|
||||
AudioHandler.audioClipHandlers["BGMLose"] = Audio.CreateAudioClip("event:/Music/stingers/game_lose");
|
||||
|
@ -90,24 +88,9 @@ public class GameManager : Script
|
|||
{
|
||||
if (GamePause)
|
||||
{
|
||||
if (Input.GetKeyDown(Input.KeyCode.Escape) && GamePause)
|
||||
{
|
||||
GamePause = false;
|
||||
AudioHandler.pauseAllSounds(false);
|
||||
gamePauseText.GetComponent<TextRenderable>().Enabled = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//Cheats();
|
||||
|
||||
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GamePause)
|
||||
{
|
||||
GamePause = true;
|
||||
AudioHandler.pauseAllSounds(true);
|
||||
gamePauseText.GetComponent<TextRenderable>().Enabled = true;
|
||||
}
|
||||
|
||||
if (currGameState == GameState.START)
|
||||
{
|
||||
timer -= Time.DeltaTimeF;
|
||||
|
@ -164,15 +147,6 @@ public class GameManager : Script
|
|||
Instance = null;
|
||||
}
|
||||
|
||||
private void Cheats()
|
||||
{
|
||||
if (Input.GetKeyDown(Input.KeyCode.Escape))
|
||||
{
|
||||
Audio.StopAllSounds();
|
||||
SceneManager.ChangeScene(97158628);
|
||||
}
|
||||
}
|
||||
|
||||
public void ItemScored()
|
||||
{
|
||||
totalItemCount -= 1;
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
|
||||
public class PauseMenu : Script
|
||||
{
|
||||
public GameObject resumeBtn;
|
||||
public GameObject retryBtn;
|
||||
public GameObject quitBtn;
|
||||
|
||||
public GameObject gamePauseText;
|
||||
public GameObject canvas;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
GameManager.Instance.GamePause = false;
|
||||
if (gamePauseText)
|
||||
gamePauseText.GetComponent<TextRenderable>().Enabled = false;
|
||||
if (canvas)
|
||||
canvas.SetActive(false);
|
||||
|
||||
if (!resumeBtn)
|
||||
Debug.LogError("Resume Btn missing");
|
||||
|
||||
if (!retryBtn)
|
||||
Debug.LogError("Retry Btn missing");
|
||||
|
||||
if (!quitBtn)
|
||||
Debug.LogError("Quit Btn missing");
|
||||
}
|
||||
protected override void start()
|
||||
{
|
||||
//resume
|
||||
UIElement resume = resumeBtn.GetComponent<UIElement>();
|
||||
if (resume != null)
|
||||
{
|
||||
resume.OnClick.RegisterAction(() =>
|
||||
{
|
||||
if (GameManager.Instance.GamePause)
|
||||
{
|
||||
GameManager.Instance.GamePause = false;
|
||||
AudioHandler.pauseAllSounds(false);
|
||||
if (gamePauseText)
|
||||
gamePauseText.GetComponent<TextRenderable>().Enabled = false;
|
||||
if (canvas)
|
||||
canvas.SetActive(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Failed to register resume button.");
|
||||
}
|
||||
|
||||
//retry
|
||||
UIElement retry = retryBtn.GetComponent<UIElement>();
|
||||
if (retry != null)
|
||||
{
|
||||
retry.OnClick.RegisterAction(() =>
|
||||
{
|
||||
Audio.StopAllSounds();
|
||||
//get curr scene
|
||||
//SceneManager.ChangeScene();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Failed to register retry button.");
|
||||
}
|
||||
|
||||
UIElement quit = quitBtn.GetComponent<UIElement>();
|
||||
if (quit != null)
|
||||
{
|
||||
quit.OnClick.RegisterAction(() =>
|
||||
{
|
||||
Audio.StopAllSounds();
|
||||
//go to main menu
|
||||
SceneManager.ChangeScene(97158628);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Failed to register quit button.");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
if (GameManager.Instance.GamePause)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause)
|
||||
{
|
||||
GameManager.Instance.GamePause = true;
|
||||
AudioHandler.pauseAllSounds(true);
|
||||
if (gamePauseText)
|
||||
gamePauseText.GetComponent<TextRenderable>().Enabled = true;
|
||||
if (canvas)
|
||||
canvas.SetActive(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Name: SC_PauseMenu
|
||||
ID: 151952680
|
||||
Type: 9
|
Loading…
Reference in New Issue