TO SQUASH: Code formatting changes.
This commit is contained in:
@@ -124,6 +124,6 @@ public class Player : MonoBehaviour
|
|||||||
musicManager.pauseMusic();
|
musicManager.pauseMusic();
|
||||||
audioSource.PlayOneShot(defeat);
|
audioSource.PlayOneShot(defeat);
|
||||||
yield return new WaitForSeconds(1.3f);
|
yield return new WaitForSeconds(1.3f);
|
||||||
fader.resetFader();
|
fader.ResetFader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,33 +21,39 @@ public class ScoreChecker : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetFader()
|
public void ResetFader()
|
||||||
{
|
{
|
||||||
Invoke(nameof(checkScore), 0.5f);
|
Invoke(nameof(CheckScore), 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator PlayAudioThenActivateGameObject(AudioSource audio, bool showGui)
|
private IEnumerator PlayAudioThenActivateGameObject(AudioSource audio, bool showGui)
|
||||||
{
|
{
|
||||||
audio.Play();
|
audio.Play();
|
||||||
|
|
||||||
if (showGui) {
|
if (showGui)
|
||||||
|
{
|
||||||
// Activate your GUI here
|
// Activate your GUI here
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
yield return new WaitUntil(() => audio.time >= audio.clip.length);
|
yield return new WaitUntil(() => audio.time >= audio.clip.length);
|
||||||
fadeOut.resetFader();
|
fadeOut.ResetFader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkScore()
|
void CheckScore()
|
||||||
{
|
{
|
||||||
int currentScore = PlayerPrefs.GetInt("CurrentScore");
|
int currentScore = PlayerPrefs.GetInt("CurrentScore");
|
||||||
AudioSource audio = null;
|
AudioSource audio = null;
|
||||||
bool showGui = false;
|
bool showGui = false;
|
||||||
|
|
||||||
if (GameSetup.IsHighScore(currentScore)) {
|
if (GameSetup.IsHighScore(currentScore))
|
||||||
|
{
|
||||||
audio = winSound;
|
audio = winSound;
|
||||||
showGui = true;
|
showGui = true;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
audio = loseSound;
|
audio = loseSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class Intro : FadeCallback
|
|||||||
|
|
||||||
public override void OnFadeComplete() { }
|
public override void OnFadeComplete() { }
|
||||||
|
|
||||||
public void forceStopAudioCoroutine()
|
public void ForceStopAudioCoroutine()
|
||||||
{
|
{
|
||||||
if (playAudioCoroutine != null)
|
if (playAudioCoroutine != null)
|
||||||
{
|
{
|
||||||
@@ -35,13 +35,13 @@ public class Intro : FadeCallback
|
|||||||
}
|
}
|
||||||
|
|
||||||
music.Stop();
|
music.Stop();
|
||||||
faderScript.Invoke("resetFader", 0.0f);
|
faderScript.Invoke("ResetFader", 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator PlayAudioThenActivateGameObject()
|
private IEnumerator PlayAudioThenActivateGameObject()
|
||||||
{
|
{
|
||||||
music.Play();
|
music.Play();
|
||||||
yield return new WaitUntil(() => music.time >= music.clip.length);
|
yield return new WaitUntil(() => music.time >= music.clip.length);
|
||||||
faderScript.Invoke("resetFader", 0.0f);
|
faderScript.Invoke("ResetFader", 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ public class IntroSkipper : MonoBehaviour
|
|||||||
||
|
||
|
||||||
mouse != null && mouse.leftButton.wasPressedThisFrame)
|
mouse != null && mouse.leftButton.wasPressedThisFrame)
|
||||||
{
|
{
|
||||||
fadeIn.forceStopAudioCoroutine();
|
fadeIn.ForceStopAudioCoroutine();
|
||||||
if (fadeOut != null) {
|
if (fadeOut != null) {
|
||||||
fadeOut.resetFader();
|
fadeOut.ResetFader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class Fader : MonoBehaviour
|
|||||||
sprite = GetComponent<SpriteRenderer>();
|
sprite = GetComponent<SpriteRenderer>();
|
||||||
if (fadeOnStart)
|
if (fadeOnStart)
|
||||||
{
|
{
|
||||||
resetFader();
|
ResetFader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,17 +66,17 @@ public class Fader : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFadingIn()
|
public void SetFadingIn()
|
||||||
{
|
{
|
||||||
isFadingIn = true;
|
isFadingIn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFadingOut()
|
public void SetFadingOut()
|
||||||
{
|
{
|
||||||
isFadingIn = false;
|
isFadingIn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetFader()
|
public void ResetFader()
|
||||||
{
|
{
|
||||||
startFading = true;
|
startFading = true;
|
||||||
timer = 0.0f;
|
timer = 0.0f;
|
||||||
|
|||||||
Reference in New Issue
Block a user