game: continuing game flow.........
This commit is contained in:
parent
6fded2c20d
commit
9be96a67fb
10 changed files with 727 additions and 5315 deletions
BIN
Game/Assets/Audio/Sweeping.mp3
(Stored with Git LFS)
BIN
Game/Assets/Audio/Sweeping.mp3
(Stored with Git LFS)
Binary file not shown.
|
@ -1,5 +1,33 @@
|
||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &-7971538219786904851
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 3
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
|
||||||
|
m_Name: ColorAdjustments
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
active: 1
|
||||||
|
postExposure:
|
||||||
|
m_OverrideState: 0
|
||||||
|
m_Value: 0
|
||||||
|
contrast:
|
||||||
|
m_OverrideState: 0
|
||||||
|
m_Value: 0
|
||||||
|
colorFilter:
|
||||||
|
m_OverrideState: 0
|
||||||
|
m_Value: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
hueShift:
|
||||||
|
m_OverrideState: 0
|
||||||
|
m_Value: 0
|
||||||
|
saturation:
|
||||||
|
m_OverrideState: 0
|
||||||
|
m_Value: 0
|
||||||
--- !u!114 &-1055684596109920917
|
--- !u!114 &-1055684596109920917
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 3
|
m_ObjectHideFlags: 3
|
||||||
|
@ -21,13 +49,38 @@ MonoBehaviour:
|
||||||
m_Value: {x: 0.5, y: 0.5}
|
m_Value: {x: 0.5, y: 0.5}
|
||||||
intensity:
|
intensity:
|
||||||
m_OverrideState: 1
|
m_OverrideState: 1
|
||||||
m_Value: 0.2
|
m_Value: 0.211
|
||||||
smoothness:
|
smoothness:
|
||||||
m_OverrideState: 1
|
m_OverrideState: 1
|
||||||
m_Value: 1
|
m_Value: 1
|
||||||
rounded:
|
rounded:
|
||||||
m_OverrideState: 1
|
m_OverrideState: 1
|
||||||
m_Value: 0
|
m_Value: 0
|
||||||
|
--- !u!114 &-250395203872362012
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 3
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: ccf1aba9553839d41ae37dd52e9ebcce, type: 3}
|
||||||
|
m_Name: MotionBlur
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
active: 1
|
||||||
|
mode:
|
||||||
|
m_OverrideState: 1
|
||||||
|
m_Value: 0
|
||||||
|
quality:
|
||||||
|
m_OverrideState: 1
|
||||||
|
m_Value: 0
|
||||||
|
intensity:
|
||||||
|
m_OverrideState: 1
|
||||||
|
m_Value: 0
|
||||||
|
clamp:
|
||||||
|
m_OverrideState: 1
|
||||||
|
m_Value: 0.05
|
||||||
--- !u!114 &11400000
|
--- !u!114 &11400000
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -43,6 +96,37 @@ MonoBehaviour:
|
||||||
components:
|
components:
|
||||||
- {fileID: -1055684596109920917}
|
- {fileID: -1055684596109920917}
|
||||||
- {fileID: 7381809258467126695}
|
- {fileID: 7381809258467126695}
|
||||||
|
- {fileID: -250395203872362012}
|
||||||
|
- {fileID: 6251107123337564194}
|
||||||
|
- {fileID: -7971538219786904851}
|
||||||
|
--- !u!114 &6251107123337564194
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 3
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c5e1dc532bcb41949b58bc4f2abfbb7e, type: 3}
|
||||||
|
m_Name: LensDistortion
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
active: 1
|
||||||
|
intensity:
|
||||||
|
m_OverrideState: 1
|
||||||
|
m_Value: 0
|
||||||
|
xMultiplier:
|
||||||
|
m_OverrideState: 1
|
||||||
|
m_Value: 1
|
||||||
|
yMultiplier:
|
||||||
|
m_OverrideState: 1
|
||||||
|
m_Value: 1
|
||||||
|
center:
|
||||||
|
m_OverrideState: 1
|
||||||
|
m_Value: {x: 0.5, y: 0.5}
|
||||||
|
scale:
|
||||||
|
m_OverrideState: 1
|
||||||
|
m_Value: 1
|
||||||
--- !u!114 &7381809258467126695
|
--- !u!114 &7381809258467126695
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 3
|
m_ObjectHideFlags: 3
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -40,7 +40,6 @@ public class BedroomTask : MonoBehaviour
|
||||||
// Defines UI references
|
// Defines UI references
|
||||||
[Header("UI References")]
|
[Header("UI References")]
|
||||||
public GameObject lockedDoorUI;
|
public GameObject lockedDoorUI;
|
||||||
public GameObject unlockedDoorUI;
|
|
||||||
public GameObject storyPanelUI;
|
public GameObject storyPanelUI;
|
||||||
public TMP_Text storyText;
|
public TMP_Text storyText;
|
||||||
|
|
||||||
|
@ -51,12 +50,13 @@ public class BedroomTask : MonoBehaviour
|
||||||
public AudioClip unlockedSound;
|
public AudioClip unlockedSound;
|
||||||
public AudioClip footstepsSound;
|
public AudioClip footstepsSound;
|
||||||
public AudioClip doorSlamSound;
|
public AudioClip doorSlamSound;
|
||||||
|
public AudioClip throwTrashSound;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
// Hide all UI prompts on start
|
// Hide all UI prompts on start
|
||||||
lockedDoorUI.SetActive(false);
|
lockedDoorUI.SetActive(false);
|
||||||
unlockedDoorUI.SetActive(false);
|
//unlockedDoorUI.SetActive(false);
|
||||||
|
|
||||||
// Ensure door is not null
|
// Ensure door is not null
|
||||||
if (door != null)
|
if (door != null)
|
||||||
|
@ -85,7 +85,7 @@ public class BedroomTask : MonoBehaviour
|
||||||
{
|
{
|
||||||
storyPanelUI.SetActive(true);
|
storyPanelUI.SetActive(true);
|
||||||
storyText.text = "My parents are still home... I should clean up first.";
|
storyText.text = "My parents are still home... I should clean up first.";
|
||||||
StartCoroutine(HideMessageAfterSeconds(storyPanelUI, 10f));
|
StartCoroutine(ClearMessageAfterSeconds(7f));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,13 @@ public class BedroomTask : MonoBehaviour
|
||||||
{
|
{
|
||||||
// Add to trash count
|
// Add to trash count
|
||||||
trashCollected++;
|
trashCollected++;
|
||||||
|
|
||||||
|
// Play sound only if no other sound is currently playing
|
||||||
|
if (!audioSource.isPlaying)
|
||||||
|
{
|
||||||
|
audioSource.PlayOneShot(throwTrashSound);
|
||||||
|
}
|
||||||
|
|
||||||
Debug.Log($"Trash collected: {trashCollected}/{trashRequired}");
|
Debug.Log($"Trash collected: {trashCollected}/{trashRequired}");
|
||||||
|
|
||||||
// If player has collected/thrown required amount of trash
|
// If player has collected/thrown required amount of trash
|
||||||
|
@ -162,10 +169,10 @@ public class BedroomTask : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the unlocked door UI
|
// Show the unlocked door UI
|
||||||
unlockedDoorUI.SetActive(true);
|
// unlockedDoorUI.SetActive(true);
|
||||||
|
|
||||||
// Call the function to hide the UI after delay
|
// Call the function to hide the UI after delay
|
||||||
StartCoroutine(HideMessageAfterSeconds(unlockedDoorUI, 5f));
|
//StartCoroutine(HideMessageAfterSeconds(unlockedDoorUI, 5f));
|
||||||
Debug.Log("Room is clean! The door is now unlocked.");
|
Debug.Log("Room is clean! The door is now unlocked.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +192,7 @@ public class BedroomTask : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the function to hide the UI after delay
|
// Call the function to hide the UI after delay
|
||||||
StartCoroutine(HideMessageAfterSeconds(lockedDoorUI, 5f));
|
StartCoroutine(HidePanelAfterSeconds(lockedDoorUI, 5f));
|
||||||
Debug.Log("The door is locked! Clean the room first.");
|
Debug.Log("The door is locked! Clean the room first.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,10 +206,10 @@ public class BedroomTask : MonoBehaviour
|
||||||
|
|
||||||
private IEnumerator PlaySoundSequence()
|
private IEnumerator PlaySoundSequence()
|
||||||
{
|
{
|
||||||
storyText.text = "!!!";
|
PostProcessingManager.Instance.TriggerEffect("Panic");
|
||||||
storyPanelUI.SetActive(true);
|
|
||||||
|
|
||||||
PostProcessingManager.Instance.StartEffect("Panic");
|
storyPanelUI.SetActive(true);
|
||||||
|
storyText.text = "!!!";
|
||||||
|
|
||||||
// Play footsteps of parents walking away
|
// Play footsteps of parents walking away
|
||||||
audioSource.PlayOneShot(footstepsSound);
|
audioSource.PlayOneShot(footstepsSound);
|
||||||
|
@ -212,7 +219,7 @@ public class BedroomTask : MonoBehaviour
|
||||||
audioSource.PlayOneShot(doorSlamSound);
|
audioSource.PlayOneShot(doorSlamSound);
|
||||||
yield return new WaitForSeconds(doorSlamSound.length);
|
yield return new WaitForSeconds(doorSlamSound.length);
|
||||||
|
|
||||||
|
// Stop the panic effect once the door slam sound ends
|
||||||
PostProcessingManager.Instance.StopEffect("Panic");
|
PostProcessingManager.Instance.StopEffect("Panic");
|
||||||
|
|
||||||
// Clear the "!!!"
|
// Clear the "!!!"
|
||||||
|
@ -221,28 +228,22 @@ public class BedroomTask : MonoBehaviour
|
||||||
// Unlocks the door after the clips and update the story
|
// Unlocks the door after the clips and update the story
|
||||||
UnlockDoor();
|
UnlockDoor();
|
||||||
|
|
||||||
// Add a small delay before updating the text to ensure everything shows properly
|
|
||||||
yield return new WaitForSeconds(0.5f);
|
|
||||||
|
|
||||||
storyText.text = "They finally left... just as soon as I finished cleaning. I can leave the room now.";
|
storyText.text = "They finally left... just as soon as I finished cleaning. I can leave the room now.";
|
||||||
StartCoroutine(HideMessageAfterSeconds(storyPanelUI, 10f));
|
StartCoroutine(ClearMessageAfterSeconds(7f));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to hide the UI after a delay
|
// Function to hide the UI after a delay
|
||||||
private IEnumerator HideMessageAfterSeconds(GameObject uiElement, float delay)
|
private IEnumerator ClearMessageAfterSeconds(float delay)
|
||||||
|
{
|
||||||
|
// Waits for delay to end and hides the UI
|
||||||
|
yield return new WaitForSeconds(delay);
|
||||||
|
storyText.text = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator HidePanelAfterSeconds(GameObject uiElement, float delay)
|
||||||
{
|
{
|
||||||
// Waits for delay to end and hides the UI
|
// Waits for delay to end and hides the UI
|
||||||
yield return new WaitForSeconds(delay);
|
yield return new WaitForSeconds(delay);
|
||||||
uiElement.SetActive(false);
|
uiElement.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyHeadacheEffect()
|
|
||||||
{
|
|
||||||
PostProcessingManager.Instance?.TriggerEffect("Headache");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ApplyDizzinessEffect()
|
|
||||||
{
|
|
||||||
PostProcessingManager.Instance?.TriggerEffect("Dizziness");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ public class BroomSweeping : MonoBehaviour
|
||||||
// Defines how much trash is needed to collect in order to unlock the door
|
// Defines how much trash is needed to collect in order to unlock the door
|
||||||
public int dirtRequired = 10;
|
public int dirtRequired = 10;
|
||||||
|
|
||||||
|
private bool taskCompleted = false;
|
||||||
|
|
||||||
// Defines UI references
|
// Defines UI references
|
||||||
[Header("UI References")]
|
[Header("UI References")]
|
||||||
public GameObject storyPanelUI;
|
public GameObject storyPanelUI;
|
||||||
|
@ -33,25 +35,28 @@ public class BroomSweeping : MonoBehaviour
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (dirtSweeped >= dirtRequired)
|
if (dirtSweeped >= dirtRequired && !taskCompleted)
|
||||||
{
|
{
|
||||||
|
taskCompleted = true;
|
||||||
GameManager.Instance.FloorSweepedTaskComplete();
|
GameManager.Instance.FloorSweepedTaskComplete();
|
||||||
|
|
||||||
|
storyPanelUI.SetActive(true);
|
||||||
storyText.text = "I hope the house is clean enough now so I don't get scolded later...";
|
storyText.text = "I hope the house is clean enough now so I don't get scolded later...";
|
||||||
StartCoroutine(HideMessageAfterSeconds(storyPanelUI, 7f));
|
|
||||||
|
StartCoroutine(ClearMessageAfterSeconds(7f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTriggerEnter(Collider other)
|
private void OnTriggerEnter(Collider other)
|
||||||
{
|
{
|
||||||
if (!other.CompareTag("Dirt"))
|
// Now correctly checks for "Dirt" before triggering
|
||||||
|
if (other.CompareTag("Dirt"))
|
||||||
{
|
{
|
||||||
// Add to dirt swept count
|
|
||||||
dirtSweeped++;
|
dirtSweeped++;
|
||||||
|
|
||||||
// Destroy it to prevent extra counting
|
// Destroy it to prevent extra counting
|
||||||
Destroy(other.gameObject);
|
Destroy(other.gameObject);
|
||||||
|
|
||||||
// Play sound only if no other sound is currently playing
|
// Play sound only if no other sound is currently playing
|
||||||
if (!audioSource.isPlaying)
|
if (!audioSource.isPlaying)
|
||||||
{
|
{
|
||||||
|
@ -59,10 +64,11 @@ public class BroomSweeping : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private IEnumerator HideMessageAfterSeconds(GameObject uiElement, float delay)
|
|
||||||
|
private IEnumerator ClearMessageAfterSeconds(float delay)
|
||||||
{
|
{
|
||||||
// Waits for delay to end and hides the UI
|
// Waits for delay to end and hides the UI
|
||||||
yield return new WaitForSeconds(delay);
|
yield return new WaitForSeconds(delay);
|
||||||
uiElement.SetActive(false);
|
storyText.text = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -23,6 +23,8 @@ public class BrushTeeth : MonoBehaviour
|
||||||
private float timer = 0f;
|
private float timer = 0f;
|
||||||
private bool isGrabbing = false;
|
private bool isGrabbing = false;
|
||||||
|
|
||||||
|
private bool taskCompleted = false;
|
||||||
|
|
||||||
// Defines UI references
|
// Defines UI references
|
||||||
[Header("UI References")]
|
[Header("UI References")]
|
||||||
|
|
||||||
|
@ -54,7 +56,7 @@ public class BrushTeeth : MonoBehaviour
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (isGrabbing)
|
if (isGrabbing && !taskCompleted)
|
||||||
{
|
{
|
||||||
timer += Time.deltaTime;
|
timer += Time.deltaTime;
|
||||||
progressBar.value = timer / progressTime;
|
progressBar.value = timer / progressTime;
|
||||||
|
@ -108,6 +110,9 @@ public class BrushTeeth : MonoBehaviour
|
||||||
|
|
||||||
private void CompleteProgress()
|
private void CompleteProgress()
|
||||||
{
|
{
|
||||||
|
if (taskCompleted) return;
|
||||||
|
|
||||||
|
taskCompleted = true;
|
||||||
progressBar.gameObject.SetActive(false);
|
progressBar.gameObject.SetActive(false);
|
||||||
isGrabbing = false;
|
isGrabbing = false;
|
||||||
|
|
||||||
|
@ -119,8 +124,11 @@ public class BrushTeeth : MonoBehaviour
|
||||||
|
|
||||||
GameManager.Instance.BrushTeethTaskComplete();
|
GameManager.Instance.BrushTeethTaskComplete();
|
||||||
|
|
||||||
|
storyPanelUI.SetActive(true);
|
||||||
storyText.text = "I should be fresh enough to go to school now...";
|
storyText.text = "I should be fresh enough to go to school now...";
|
||||||
StartCoroutine(HideMessageAfterSeconds(storyPanelUI, 7f));
|
|
||||||
|
// Clear the text after a delay
|
||||||
|
StartCoroutine(ClearMessageAfterSeconds(7f));
|
||||||
|
|
||||||
Debug.Log("Progress completed!");
|
Debug.Log("Progress completed!");
|
||||||
}
|
}
|
||||||
|
@ -134,10 +142,10 @@ public class BrushTeeth : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator HideMessageAfterSeconds(GameObject uiElement, float delay)
|
private IEnumerator ClearMessageAfterSeconds(float delay)
|
||||||
{
|
{
|
||||||
// Waits for delay to end and hides the UI
|
// Waits for delay to end and hides the UI
|
||||||
yield return new WaitForSeconds(delay);
|
yield return new WaitForSeconds(delay);
|
||||||
uiElement.SetActive(false);
|
storyText.text = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,10 @@ public class GameManager : MonoBehaviour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static GameManager Instance;
|
public static GameManager Instance;
|
||||||
|
|
||||||
|
// Defines UI references
|
||||||
|
[Header("UI References")]
|
||||||
|
public GameObject storyPanelUI;
|
||||||
|
public TMP_Text storyText;
|
||||||
|
|
||||||
// Trackable Task Completions
|
// Trackable Task Completions
|
||||||
private bool bedroomCleaned = false;
|
private bool bedroomCleaned = false;
|
||||||
|
@ -72,23 +76,42 @@ public class GameManager : MonoBehaviour
|
||||||
|
|
||||||
// Future-proofing for Firebase tracking
|
// Future-proofing for Firebase tracking
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AreTasksDone()
|
||||||
|
{
|
||||||
|
if (bedroomCleaned && teethBrushed && floorSweeped)
|
||||||
|
{
|
||||||
|
storyText.text = "I think I did everything... I should go to school now";
|
||||||
|
storyPanelUI.SetActive(true);
|
||||||
|
StartCoroutine(HideMessageAfterSeconds(storyPanelUI, 7f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Tracks if bedroom is cleaned or not
|
// Tracks if bedroom is cleaned or not
|
||||||
public void BedroomTaskComplete()
|
public void BedroomTaskComplete()
|
||||||
{
|
{
|
||||||
bedroomCleaned = true;
|
bedroomCleaned = true;
|
||||||
|
AreTasksDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tracks if teeth is brushed or not
|
// Tracks if teeth is brushed or not
|
||||||
public void BrushTeethTaskComplete()
|
public void BrushTeethTaskComplete()
|
||||||
{
|
{
|
||||||
teethBrushed = true;
|
teethBrushed = true;
|
||||||
|
AreTasksDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tracks if floor is sweeped or not
|
// Tracks if floor is sweeped or not
|
||||||
public void FloorSweepedTaskComplete()
|
public void FloorSweepedTaskComplete()
|
||||||
{
|
{
|
||||||
floorSweeped = true;
|
floorSweeped = true;
|
||||||
|
AreTasksDone();
|
||||||
}
|
}
|
||||||
|
private IEnumerator HideMessageAfterSeconds(GameObject uiElement, float delay)
|
||||||
|
{
|
||||||
|
// Waits for delay to end and hides the UI
|
||||||
|
yield return new WaitForSeconds(delay);
|
||||||
|
uiElement.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,37 +13,40 @@ using UnityEngine.Rendering.Universal;
|
||||||
public class PostProcessingManager : MonoBehaviour
|
public class PostProcessingManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static PostProcessingManager Instance;
|
public static PostProcessingManager Instance;
|
||||||
|
|
||||||
// Defines the Global Volume
|
// Defines the Global Volume
|
||||||
public Volume volume;
|
public Volume volume;
|
||||||
|
|
||||||
// All the effect overrides
|
// All the effect overrides
|
||||||
private Vignette vignette;
|
private Vignette vignette;
|
||||||
private ChromaticAberration chromaticAberration;
|
private ChromaticAberration chromaticAberration;
|
||||||
private MotionBlur motionBlur;
|
private MotionBlur motionBlur;
|
||||||
private LensDistortion lensDistortion;
|
private LensDistortion lensDistortion;
|
||||||
private ColorAdjustments colorAdjustments;
|
private ColorAdjustments colorAdjustments;
|
||||||
|
|
||||||
[Header("Effect Intensities")]
|
[Header("Effect Intensities")]
|
||||||
// Editable override values in inspector
|
// Editable override values in inspector
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
public AnimationCurve vignetteIntensity;
|
public AnimationCurve vignetteIntensity;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField] public AnimationCurve chromaticAberrationIntensity;
|
||||||
public AnimationCurve chromaticAberrationIntensity;
|
|
||||||
|
[SerializeField] public AnimationCurve motionBlurIntensity;
|
||||||
[SerializeField]
|
|
||||||
public AnimationCurve motionBlurIntensity;
|
[SerializeField] public AnimationCurve lensDistortionIntensity;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField] public AnimationCurve colorAdjustmentsIntensity;
|
||||||
public AnimationCurve lensDistortionIntensity;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
public AnimationCurve colorAdjustmentsIntensity;
|
|
||||||
|
|
||||||
// Checks if effect is active or not
|
// Checks if effect is active or not
|
||||||
private bool isEffectActive = false;
|
private bool isEffectActive = false;
|
||||||
|
|
||||||
|
// Defines Audio References
|
||||||
|
[Header("Audio References")] public AudioSource audioSource;
|
||||||
|
public AudioClip heartbeatSound;
|
||||||
|
public AudioClip whisperSound;
|
||||||
|
public AudioClip distortedWhisperSound;
|
||||||
|
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
if (Instance == null)
|
if (Instance == null)
|
||||||
|
@ -55,7 +58,7 @@ public class PostProcessingManager : MonoBehaviour
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -70,9 +73,9 @@ public class PostProcessingManager : MonoBehaviour
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to start effects if there is none currently, and stop current effects to start next ones
|
// Function to start effects if there is none currently, and stop current effects to start next ones
|
||||||
public void TriggerEffect(string effectName)
|
public void TriggerEffect(string effectName)
|
||||||
{
|
{
|
||||||
|
@ -96,77 +99,85 @@ public class PostProcessingManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
// The effect is active
|
// The effect is active
|
||||||
isEffectActive = true;
|
isEffectActive = true;
|
||||||
|
|
||||||
// Calls coroutine to apply the effect
|
// Calls coroutine to apply the effect
|
||||||
StartCoroutine(ApplyEffect(effectName));
|
StartCoroutine(ApplyEffect(effectName));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to stop the effect
|
// Function to stop the effect
|
||||||
public void StopEffect(string effectName)
|
public void StopEffect(string effectName)
|
||||||
{
|
{
|
||||||
// The effect is not active
|
// The effect is not active
|
||||||
isEffectActive = false;
|
isEffectActive = false;
|
||||||
|
|
||||||
// Reset effects to default
|
// Reset effects to default
|
||||||
if (vignette != null) vignette.intensity.Override(0f);
|
if (vignette != null) vignette.intensity.Override(0f);
|
||||||
if (chromaticAberration != null) chromaticAberration.intensity.Override(0f);
|
if (chromaticAberration != null) chromaticAberration.intensity.Override(0f);
|
||||||
if (motionBlur != null) motionBlur.intensity.Override(0f);
|
if (motionBlur != null) motionBlur.intensity.Override(0f);
|
||||||
if (lensDistortion != null) lensDistortion.intensity.Override(0f);
|
if (lensDistortion != null) lensDistortion.intensity.Override(0f);
|
||||||
if (colorAdjustments != null) colorAdjustments.postExposure.Override(0f);
|
if (colorAdjustments != null) colorAdjustments.postExposure.Override(0f);
|
||||||
|
|
||||||
|
// Stop audio
|
||||||
|
if (audioSource != null)
|
||||||
|
{
|
||||||
|
audioSource.Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Applies effects over time based on the type
|
// Applies effects over time based on the type
|
||||||
private IEnumerator ApplyEffect(string effectName)
|
private IEnumerator ApplyEffect(string effectName)
|
||||||
{
|
{
|
||||||
float time = 0f;
|
// Handle the audio for the effect
|
||||||
float duration = 1f;
|
if (effectName == "Panic")
|
||||||
|
|
||||||
while (time < duration)
|
|
||||||
{
|
{
|
||||||
time += Time.deltaTime;
|
audioSource.clip = heartbeatSound;
|
||||||
float t = Mathf.Clamp01(time / duration);
|
audioSource.loop = true;
|
||||||
|
audioSource.Play();
|
||||||
// Values for headache effect
|
}
|
||||||
if (effectName == "Headache")
|
else if (effectName == "Headache")
|
||||||
{
|
{
|
||||||
vignette.intensity.Override(vignetteIntensity.Evaluate(time));
|
audioSource.clip = whisperSound;
|
||||||
chromaticAberration.intensity.Override(chromaticAberrationIntensity.Evaluate(time));
|
audioSource.loop = true;
|
||||||
}
|
audioSource.Play();
|
||||||
|
}
|
||||||
// Values for dizziness effect
|
else if (effectName == "Dizziness")
|
||||||
else if (effectName == "Dizziness")
|
{
|
||||||
{
|
audioSource.clip = distortedWhisperSound;
|
||||||
motionBlur.intensity.Override(motionBlurIntensity.Evaluate(time));
|
audioSource.loop = true;
|
||||||
lensDistortion.intensity.Override(lensDistortionIntensity.Evaluate(time));
|
audioSource.Play();
|
||||||
}
|
|
||||||
|
|
||||||
yield return null;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void ApplyPanicEffect()
|
|
||||||
{
|
|
||||||
StartCoroutine(LoopPanicEffect());
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator LoopPanicEffect()
|
|
||||||
{
|
|
||||||
float time = 0f;
|
|
||||||
float duration = 0.1f;
|
|
||||||
|
|
||||||
|
// Apply effects while the effect is active
|
||||||
while (isEffectActive)
|
while (isEffectActive)
|
||||||
{
|
{
|
||||||
time += Time.deltaTime;
|
// Visual effects for headache
|
||||||
float t = Mathf.PingPong(time / duration, 1f); // Looping the effect
|
if (effectName == "Headache")
|
||||||
|
{
|
||||||
|
vignette.intensity.Override(vignetteIntensity.Evaluate(Time.time));
|
||||||
|
chromaticAberration.intensity.Override(chromaticAberrationIntensity.Evaluate(Time.time));
|
||||||
|
}
|
||||||
|
|
||||||
// Apply intensity for panic effect
|
// Visual effects for dizziness
|
||||||
vignette.intensity.Override(vignetteIntensity.Evaluate(t));
|
if (effectName == "Dizziness")
|
||||||
chromaticAberration.intensity.Override(chromaticAberrationIntensity.Evaluate(t));
|
{
|
||||||
motionBlur.intensity.Override(motionBlurIntensity.Evaluate(t));
|
motionBlur.intensity.Override(motionBlurIntensity.Evaluate(Time.time));
|
||||||
lensDistortion.intensity.Override(lensDistortionIntensity.Evaluate(t));
|
lensDistortion.intensity.Override(lensDistortionIntensity.Evaluate(Time.time));
|
||||||
colorAdjustments.postExposure.Override(colorAdjustmentsIntensity.Evaluate(t));
|
}
|
||||||
|
|
||||||
|
// Visual effects for panic
|
||||||
|
if (effectName == "Panic")
|
||||||
|
{
|
||||||
|
motionBlur.intensity.Override(motionBlurIntensity.Evaluate(Time.time));
|
||||||
|
lensDistortion.intensity.Override(lensDistortionIntensity.Evaluate(Time.time));
|
||||||
|
chromaticAberration.intensity.Override(chromaticAberrationIntensity.Evaluate(Time.time));
|
||||||
|
}
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stop audio when the effect ends
|
||||||
|
if (audioSource != null && audioSource.isPlaying)
|
||||||
|
{
|
||||||
|
audioSource.Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 150
|
||||||
icon: {instanceID: 0}
|
icon: {instanceID: 0}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
|
|
|
@ -159,7 +159,7 @@
|
||||||
{
|
{
|
||||||
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||||
"key": "ShapeBuilder.ActiveShapeIndex",
|
"key": "ShapeBuilder.ActiveShapeIndex",
|
||||||
"value": "{\"m_Value\":6}"
|
"value": "{\"m_Value\":7}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
"type": "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||||
|
@ -184,11 +184,7 @@
|
||||||
{
|
{
|
||||||
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||||
"key": "ShapeBuilder.LastSize",
|
"key": "ShapeBuilder.LastSize",
|
||||||
<<<<<<< HEAD
|
|
||||||
"value": "{\"m_Value\":{\"x\":-0.4071826934814453,\"y\":0.2012939453125,\"z\":-0.5807037353515625}}"
|
"value": "{\"m_Value\":{\"x\":-0.4071826934814453,\"y\":0.2012939453125,\"z\":-0.5807037353515625}}"
|
||||||
=======
|
|
||||||
"value": "{\"m_Value\":{\"x\":0.197540283203125,\"y\":0.015741348266601564,\"z\":0.1954345703125}}"
|
|
||||||
>>>>>>> fb51f41 (calling updates)
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
"type": "UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||||
|
|
Loading…
Add table
Reference in a new issue