Skip to content

Commit

Permalink
Fixed EndGameTrigger
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxSensation committed May 6, 2020
1 parent 1222b15 commit 821c584
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Assets/Audio/EventSound.meta

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

Binary file added Assets/Audio/EventSound/EndGame.wav
Binary file not shown.
22 changes: 22 additions & 0 deletions Assets/Audio/EventSound/EndGame.wav.meta

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

98 changes: 98 additions & 0 deletions Assets/Scenes/Levels/Level3.unity
Original file line number Diff line number Diff line change
Expand Up @@ -88755,6 +88755,7 @@ GameObject:
- component: {fileID: 1746053424}
- component: {fileID: 1746053425}
- component: {fileID: 1746053426}
- component: {fileID: 1746053427}
m_Layer: 0
m_Name: EndGameTrigger
m_TagString: Untagged
Expand Down Expand Up @@ -88804,6 +88805,7 @@ MonoBehaviour:
textAnimation: {fileID: 1959528442}
imageAnimation: {fileID: 2014965103}
endGameDelay: 15
_audioSource: {fileID: 1746053427}
--- !u!54 &1746053426
Rigidbody:
m_ObjectHideFlags: 0
Expand All @@ -88820,6 +88822,102 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 126
m_CollisionDetection: 0
--- !u!82 &1746053427
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1746053422}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: b50fdf426d2aea54a81f015bcf8509e8, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1001 &1747563559
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down
13 changes: 13 additions & 0 deletions Assets/Scripts/Interactables/Triggers/EndGameTrigger.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using System.Collections;
using UnityEngine;
using UnityEngine.InputSystem;

public class EndGameTrigger : MonoBehaviour
{

[SerializeField] private Animator textAnimation;
[SerializeField] private Animator imageAnimation;
[SerializeField] private float endGameDelay;
[SerializeField] private AudioSource _audioSource;
private WaitForSeconds _endGameDelay;
private bool triggerd;

private void Awake()
{
Expand All @@ -28,8 +31,18 @@ private IEnumerator EndGameTimer()

private void EndGame()
{
triggerd = true;
_audioSource.Play();
StartCoroutine("EndGameTimer");
textAnimation.SetBool("ReachedEnd", true);
imageAnimation.SetBool("ReachedEnd", true);
}

private void HandleInput(InputAction.CallbackContext context)
{
if (triggerd && context.performed)
{
Application.Quit();
}
}
}

0 comments on commit 821c584

Please sign in to comment.