Pause menu fix
Offing gameplay UI on preview level
clipping of mouse
change some keydown to keyup
This commit is contained in:
Glence 2023-03-05 23:48:25 +08:00
parent e40346513c
commit 8d6ef16625
12 changed files with 154 additions and 140 deletions

View File

@ -2544,7 +2544,7 @@
Collider Component: Collider Component:
Colliders: Colliders:
- Is Trigger: false - Is Trigger: false
Collision Tag: 0 Collision Tag: 1
Type: Box Type: Box
Half Extents: {x: 1.79999995, y: 1, z: 4} Half Extents: {x: 1.79999995, y: 1, z: 4}
Friction: 0.400000006 Friction: 0.400000006
@ -2553,7 +2553,7 @@
Position Offset: {x: 0, y: 0.550000012, z: 0} Position Offset: {x: 0, y: 0.550000012, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false - Is Trigger: false
Collision Tag: 0 Collision Tag: 1
Type: Box Type: Box
Half Extents: {x: 1.79999995, y: 1, z: 2.70000005} Half Extents: {x: 1.79999995, y: 1, z: 2.70000005}
Friction: 0.400000006 Friction: 0.400000006
@ -4865,9 +4865,9 @@
NumberOfChildren: 5 NumberOfChildren: 5
Components: Components:
Transform Component: Transform Component:
Translate: {x: -8, y: 1.142977, z: -4} Translate: {x: -8, y: 0.899999976, z: -4}
Rotate: {x: -0, y: 1.57079649, z: 0} Rotate: {x: -0, y: 1.57079649, z: 0}
Scale: {x: 0.999999881, y: 1, z: 0.999999881} Scale: {x: 0.999965608, y: 1, z: 0.999965608}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 149697411 Mesh: 149697411
@ -4978,7 +4978,7 @@
armLength: 3 armLength: 3
turnSpeedPitch: 0.200000003 turnSpeedPitch: 0.200000003
turnSpeedYaw: 0.400000006 turnSpeedYaw: 0.400000006
inverseXControls: false inverseXControls: true
inverseYControls: false inverseYControls: false
pitchUpperClamp: 45 pitchUpperClamp: 45
pitchLowerClamp: 5 pitchLowerClamp: 5
@ -5097,6 +5097,7 @@
endPoint2: [1, 1.5, -7.5] endPoint2: [1, 1.5, -7.5]
endPoint3: [2.5, 1.5, -3] endPoint3: [2.5, 1.5, -3]
playerCamera: 65730 playerCamera: 65730
gameplayCanvas: 459
duration: 3 duration: 3
- EID: 453 - EID: 453
Name: PreviewLevel1 Name: PreviewLevel1
@ -5193,7 +5194,6 @@
Default Texture: 63979907 Default Texture: 63979907
Hovered Texture: 51379325 Hovered Texture: 51379325
Clicked Texture: 66788278 Clicked Texture: 66788278
current texture: 0
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 458 Canvas ID: 458
@ -5227,7 +5227,6 @@
Default Texture: 61602036 Default Texture: 61602036
Hovered Texture: 58910810 Hovered Texture: 58910810
Clicked Texture: 57786063 Clicked Texture: 57786063
current texture: 0
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 458 Canvas ID: 458
@ -5261,7 +5260,6 @@
Default Texture: 64806384 Default Texture: 64806384
Hovered Texture: 58347825 Hovered Texture: 58347825
Clicked Texture: 63234380 Clicked Texture: 63234380
current texture: 0
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 458 Canvas ID: 458

View File

@ -14082,6 +14082,7 @@
endPoint2: [0, 2, 4.5] endPoint2: [0, 2, 4.5]
endPoint3: [1.14999998, 2.20000005, 2] endPoint3: [1.14999998, 2.20000005, 2]
playerCamera: 4 playerCamera: 4
gameplayCanvas: 199
duration: 3 duration: 3
- EID: 555 - EID: 555
Name: PreviewLevel1 Name: PreviewLevel1

View File

@ -29,7 +29,7 @@
- EID: 449 - EID: 449
Name: Enviroment Name: Enviroment
IsActive: true IsActive: true
NumberOfChildren: 9 NumberOfChildren: 13
Components: ~ Components: ~
Scripts: ~ Scripts: ~
- EID: 78 - EID: 78
@ -5690,6 +5690,98 @@
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 469
Name: Level2FenceCollider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 1.93802273, y: 2.39508605, z: 4.01721716}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 1
Type: Box
Half Extents: {x: 6, y: 0.5, z: 0.150000006}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
- EID: 463
Name: KitchenLargeClosedWindowCollider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 4.01900005, y: 1.10099995, z: 0.147}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 1.96599996, y: 1.49399996, z: -0.966000021}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
- EID: 467
Name: Level2Table
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.11160159, y: 2.4000001, z: 1.2985332}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 1
Type: Box
Half Extents: {x: 2.20000005, y: 0.5, z: 1.29999995}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
- EID: 468
Name: Level2FenceCollider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 4.9960146, y: 2.39508605, z: 2.69112468}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 1
Type: Box
Half Extents: {x: 0.200000003, y: 0.5, z: 2.5}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
- EID: 553 - EID: 553
Name: TweenManager Name: TweenManager
IsActive: true IsActive: true
@ -6439,6 +6531,7 @@
endPoint2: [5, 3.5, 0.5] endPoint2: [5, 3.5, 0.5]
endPoint3: [-0.5, 1.5, 3.5] endPoint3: [-0.5, 1.5, 3.5]
playerCamera: 66063 playerCamera: 66063
gameplayCanvas: 526
duration: 3 duration: 3
- EID: 555 - EID: 555
Name: PreviewLevel1 Name: PreviewLevel1
@ -9090,96 +9183,4 @@
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Scripts: ~
- EID: 469
Name: Level2FenceCollider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 1.93802273, y: 2.39508605, z: 4.01721716}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 1
Type: Box
Half Extents: {x: 6, y: 0.5, z: 0.150000006}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
- EID: 468
Name: Level2FenceCollider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 4.9960146, y: 2.39508605, z: 2.69112468}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 1
Type: Box
Half Extents: {x: 0.200000003, y: 0.5, z: 2.5}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
- EID: 467
Name: Level2Table
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.11160159, y: 2.4000001, z: 1.2985332}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 1
Type: Box
Half Extents: {x: 2.20000005, y: 0.5, z: 1.29999995}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
- EID: 463
Name: KitchenLargeClosedWindowCollider
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 4.01900005, y: 1.10099995, z: 0.147}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 1.96599996, y: 1.49399996, z: -0.966000021}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~ Scripts: ~

View File

@ -107,6 +107,7 @@ public partial class LeafSearch : BehaviourTreeNode
SetNodeData("isAlert", false); SetNodeData("isAlert", false);
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
screamOnce = false;
return status; return status;
} }
else else
@ -128,6 +129,7 @@ public partial class LeafSearch : BehaviourTreeNode
//handleChaseStop(); //handleChaseStop();
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
screamOnce = false;
return status; return status;
} }
@ -143,6 +145,7 @@ public partial class LeafSearch : BehaviourTreeNode
//handleChaseStop(); //handleChaseStop();
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
screamOnce = false;
return status; return status;
} }
@ -159,6 +162,7 @@ public partial class LeafSearch : BehaviourTreeNode
//Debug.Log("Failure: Player has no collider"); //Debug.Log("Failure: Player has no collider");
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
screamOnce = false;
return status; return status;
} }
//Ray destination to target the centre of the player's collider instead of transform position //Ray destination to target the centre of the player's collider instead of transform position
@ -176,6 +180,7 @@ public partial class LeafSearch : BehaviourTreeNode
//handleChaseStop(); //handleChaseStop();
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
screamOnce = false;
return status; return status;
} }
else if (sightRayHit.Hit && sightRayHit.Other == player) else if (sightRayHit.Hit && sightRayHit.Other == player)
@ -222,7 +227,6 @@ public partial class LeafSearch : BehaviourTreeNode
if (screamOnce) if (screamOnce)
{ {
screamOnce = false;
AudioHandler.audioClipHandlers["SFXDetectAh"].Play(); AudioHandler.audioClipHandlers["SFXDetectAh"].Play();
} }

View File

@ -36,7 +36,6 @@ public class GameManager : Script
public bool itemScored {get;set;} public bool itemScored {get;set;}
public int currMultiplierCombo { get; set;} public int currMultiplierCombo { get; set;}
public float multiplierFont = 60.0f; public float multiplierFont = 60.0f;
private Vector3 fontScalar;
public static GameManager Instance { get; private set; } public static GameManager Instance { get; private set; }
@ -63,7 +62,6 @@ public class GameManager : Script
itemScored = false; itemScored = false;
currMultiplierCombo = 1; currMultiplierCombo = 1;
currMultiplierDuration = 0; currMultiplierDuration = 0;
fontScalar = new Vector3(multiplierFont / maxMultiplierDuration, multiplierFont / maxMultiplierDuration , multiplierFont / maxMultiplierDuration);
itemShatter = false; itemShatter = false;
GamePause = false; GamePause = false;
stealFoodPopUpDone = false; stealFoodPopUpDone = false;
@ -108,6 +106,8 @@ public class GameManager : Script
return; return;
} }
Cheat();
if (currGameState == GameState.START) if (currGameState == GameState.START)
{ {
timer -= Time.DeltaTimeF; timer -= Time.DeltaTimeF;
@ -128,12 +128,8 @@ public class GameManager : Script
} }
} }
else
{
//multiplierText.GetComponent<Transform>().LocalScale = Vector3.Zero;
}
if (!goingToLose && ((timer > 0 && totalItemCount <= 0 && !itemShatter) || Input.GetKeyDown(Input.KeyCode.F1))) if (!goingToLose && ((timer > 0 && totalItemCount <= 0 && !itemShatter)))
{ {
currGameState = GameState.WIN; currGameState = GameState.WIN;
AudioHandler.StopAllSounds(false); AudioHandler.StopAllSounds(false);
@ -142,7 +138,7 @@ public class GameManager : Script
if (SceneFadeInOut.Instance != null) if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn(); SceneFadeInOut.Instance.CallFadeIn();
} }
else if(!goingToWin && (timer < 0 || Input.GetKeyDown(Input.KeyCode.F2))) else if(!goingToWin && (timer < 0))
{ {
currGameState = GameState.LOSE; currGameState = GameState.LOSE;
AudioHandler.StopAllSounds(false); AudioHandler.StopAllSounds(false);
@ -181,6 +177,27 @@ public class GameManager : Script
} }
} }
private void Cheat()
{
if (Input.GetKeyUp(Input.KeyCode.F1))
{
currGameState = GameState.WIN;
AudioHandler.StopAllSounds(false);
goingToWin = true;
if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn();
}
else if (Input.GetKeyUp(Input.KeyCode.F2))
{
currGameState = GameState.LOSE;
AudioHandler.StopAllSounds(false);
goingToLose = true;
if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn();
}
}
protected override void onDestroy() protected override void onDestroy()
{ {
if (Instance == this) if (Instance == this)

View File

@ -15,6 +15,7 @@ namespace SHADE_Scripting.UI
public Vector3 endPoint3; public Vector3 endPoint3;
public GameObject playerCamera; public GameObject playerCamera;
public GameObject gameplayCanvas;
public float duration = 3.0f; public float duration = 3.0f;
private bool point1Done = false; private bool point1Done = false;
@ -48,6 +49,8 @@ namespace SHADE_Scripting.UI
protected override void start() protected override void start()
{ {
if (gameplayCanvas)
gameplayCanvas.SetActive(false);
listOfCamera[0].SetMainCamera(); listOfCamera[0].SetMainCamera();
} }
@ -77,6 +80,8 @@ namespace SHADE_Scripting.UI
if (skip && SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished()) if (skip && SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished())
{ {
GameManager.Instance.PreviewLevelDone = true; GameManager.Instance.PreviewLevelDone = true;
if (gameplayCanvas)
gameplayCanvas.SetActive(true);
} }
@ -152,6 +157,8 @@ namespace SHADE_Scripting.UI
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point3Done) if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point3Done)
{ {
GameManager.Instance.PreviewLevelDone = true; GameManager.Instance.PreviewLevelDone = true;
if (gameplayCanvas)
gameplayCanvas.SetActive(true);
} }
} }

View File

@ -65,14 +65,14 @@ public class CutsceneEnd : Script
Canvas4(); Canvas4();
Canvas5(); Canvas5();
if (Input.GetKeyDown(Input.KeyCode.Space) && !skip && (!cutscene4Done || !cutscene5Done)) if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene4Done || !cutscene5Done))
{ {
skip = true; skip = true;
oldDuration = duration; oldDuration = duration;
duration = skipDuration; duration = skipDuration;
} }
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf) if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf)
{ {
canvas4.SetActive(false); canvas4.SetActive(false);
canvas5.SetActive(true); canvas5.SetActive(true);
@ -80,7 +80,7 @@ public class CutsceneEnd : Script
skip = false; skip = false;
} }
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene5Done && canvas5.IsActiveSelf) if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene5Done && canvas5.IsActiveSelf)
{ {
SceneManager.ChangeScene(nextScene); SceneManager.ChangeScene(nextScene);
} }

View File

@ -95,14 +95,14 @@ public class CutsceneIntro : Script
Canvas2(); Canvas2();
Canvas3(); Canvas3();
if (Input.GetKeyDown(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done)) if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done))
{ {
skip = true; skip = true;
oldDuration = duration; oldDuration = duration;
duration = skipDuration; duration = skipDuration;
} }
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene1Done && canvas1.IsActiveSelf) if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene1Done && canvas1.IsActiveSelf)
{ {
canvas1.SetActive(false); canvas1.SetActive(false);
canvas2.SetActive(true); canvas2.SetActive(true);
@ -110,7 +110,7 @@ public class CutsceneIntro : Script
skip = false; skip = false;
} }
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene2Done && canvas2.IsActiveSelf) if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene2Done && canvas2.IsActiveSelf)
{ {
canvas2.SetActive(false); canvas2.SetActive(false);
canvas3.SetActive(true); canvas3.SetActive(true);
@ -118,7 +118,7 @@ public class CutsceneIntro : Script
skip = false; skip = false;
} }
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene3Done && canvas3.IsActiveSelf) if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene3Done && canvas3.IsActiveSelf)
{ {
SceneManager.ChangeScene(nextScene); SceneManager.ChangeScene(nextScene);
} }

View File

@ -30,26 +30,6 @@ public class MainMenu : Script
} }
protected override void update() protected override void update()
{ {
if (Input.GetKeyDown(Input.KeyCode.Space))
{
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
}
if (Input.GetKeyUp(Input.KeyCode.Space))
{
//Audio.PlaySFXOnce2D("event:/UI/success");
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
SceneManager.ChangeScene(sceneID);
Audio.StopAllSounds();
}
if (Input.GetKeyDown(Input.KeyCode.Escape))
{
Audio.StopAllSounds();
Application.Quit();
}
} }
} }

View File

@ -66,6 +66,9 @@ public class PauseMenu : Script
{ {
Audio.StopAllSounds(); Audio.StopAllSounds();
SceneManager.RestartScene(); SceneManager.RestartScene();
GameManager.Instance.GamePause = false;
GameManager.Instance.stealFoodPopUpDone = false;
GameManager.Instance.PreviewLevelDone = false;
}); });
} }
else else
@ -92,7 +95,7 @@ public class PauseMenu : Script
protected override void update() protected override void update()
{ {
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause && GameManager.Instance.stealFoodPopUpDone) if (Input.GetKeyUp(Input.KeyCode.Escape) && !GameManager.Instance.GamePause && GameManager.Instance.stealFoodPopUpDone)
{ {
GameManager.Instance.GamePause = true; GameManager.Instance.GamePause = true;
Input.SetMouseCentering(false); Input.SetMouseCentering(false);

View File

@ -201,8 +201,6 @@ namespace Sandbox
#ifdef SHEDITOR #ifdef SHEDITOR
if(editor->editorState == SHEditor::State::PLAY) if(editor->editorState == SHEditor::State::PLAY)
#else
window.ClipMouseCursor();
#endif #endif
SHSceneManager::SceneUpdate(0.016f); SHSceneManager::SceneUpdate(0.016f);
#ifdef SHEDITOR #ifdef SHEDITOR

View File

@ -555,6 +555,11 @@ namespace SHADE
// Create buffer for generic data and attach to descriptor set // Create buffer for generic data and attach to descriptor set
graphicsGenericData.Init(device, genericAndTextureDescSet); graphicsGenericData.Init(device, genericAndTextureDescSet);
auto windowDims = window->GetWindowSize();
graphicsGenericData.SetViewportWidth(windowDims.first);
graphicsGenericData.SetViewportHeight(windowDims.second);
} }
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/