Skip to content

Commit

Permalink
zone 5 & ending done
Browse files Browse the repository at this point in the history
  • Loading branch information
armaanbadhan committed May 28, 2021
1 parent 15fe6f8 commit a333e30
Show file tree
Hide file tree
Showing 6 changed files with 340 additions and 9 deletions.
49 changes: 49 additions & 0 deletions Ending/DialogueManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.SceneManagement;

public class DialogueManager : MonoBehaviour
{
[SerializeField]
private TextMeshProUGUI _content;

[SerializeField]
private TextMeshProUGUI _thanks;


readonly private string _famousLastWords = "You spend the night sitting there with george,\n" +
"observing the magnificent scenery and taking in\n" +
"the cold air..breathe...it feels good to be alive.";
readonly private string _themksVmro = "thanks for staying with chad";

void Start()
{
StartCoroutine(TypeFamousLastWords());
}


IEnumerator TypeFamousLastWords()
{
yield return new WaitForSeconds(0.5f);
foreach (char letter in _famousLastWords)
{
_content.text += letter;
yield return new WaitForSeconds(0.02f);
}
StartCoroutine(TypeThemksBro());
}


IEnumerator TypeThemksBro()
{
yield return new WaitForSeconds(0.5f);
foreach (char letter in _themksVmro)
{
_thanks.text += letter;
yield return new WaitForSeconds(0.02f);
}
}
}
89 changes: 89 additions & 0 deletions ZoneFive/DialogueZoneFive.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class DialogueZoneFive : MonoBehaviour
{
[SerializeField]
private TextMeshProUGUI _dialogue;

[SerializeField]
private TextMeshProUGUI _continueButton;

[SerializeField]
private TextMeshProUGUI _hairaaHoonMein;

private bool _continueBShow = false;

[SerializeField]
private PlayerZoneFive _player;

[SerializeField]
private string[] _convo;

private int _ind = 0;


private void Start()
{
_player = GameObject.Find("PlayerZ5").GetComponent<PlayerZoneFive>();
}

private void Update()
{
if (_continueBShow && Input.GetKeyDown(KeyCode.Space))
{
ClickContinue();
}
}

public void StartDogConvo()
{
StartCoroutine(TypeConvo(_convo[_ind]));
}


public void ShowExclamation()
{
StartCoroutine(Surprised());
}

IEnumerator Surprised()
{
_hairaaHoonMein.text = "!!!";
yield return new WaitForSeconds(1.5f);
_hairaaHoonMein.text = "";
}


IEnumerator TypeConvo(string whatToType)
{
yield return new WaitForSeconds(0.5f);
foreach (char letter in whatToType)
{
_dialogue.text += letter;
yield return new WaitForSeconds(0.02f);
}
yield return new WaitForSeconds(0.05f);
_continueButton.text = "press space to continue";
_continueBShow = true;
}

public void ClickContinue()
{
_continueButton.text = "";
_continueBShow = false;
_dialogue.text = "";
if (_ind < 2)
{
_ind++;
StartCoroutine(TypeConvo(_convo[_ind]));
}
else
{
_player.LastRites();
}
}
}
72 changes: 72 additions & 0 deletions ZoneFive/PlayerZoneFive.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class PlayerZoneFive : MonoBehaviour
{
[SerializeField]
private Image blackk;
[SerializeField]
private Animator animm;

private Player _player;

private bool _initialDone = false;

[SerializeField]
private DialogueZoneFive _dialogueManager;


// Start is called before the first frame update
void Start()
{
_player = GetComponent<Player>();
_dialogueManager = GameObject.Find("DialogueZ5").GetComponent<DialogueZoneFive>();
}

// Update is called once per frame
void Update()
{
if (!_initialDone && transform.position.y < _player.floorYCord)
{
transform.Translate(Vector3.up * 2.5f * Time.deltaTime);
}
else if (!_initialDone)
{
_initialDone = true;
_dialogueManager.ShowExclamation();
SetMovementTrue();
}
}


private void OnTriggerEnter2D(Collider2D other)
{
if (other.tag is "kutta")
{
_player.playerMovement = false;
_dialogueManager.StartDogConvo();
}
}


public void SetMovementTrue()
{
_player.playerMovement = true;
}

public void LastRites()
{
StartCoroutine(Fading());
}

IEnumerator Fading()
{
yield return new WaitForSeconds(1.5f);
animm.SetBool("Fade", true);
yield return new WaitUntil(() => blackk.color.a == 1);
SceneManager.LoadScene("HappyEnding");
}
}
67 changes: 61 additions & 6 deletions ZoneFour/DialogueZoneFour.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,73 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class DialogueZoneFour : MonoBehaviour
{
// Start is called before the first frame update
void Start()
[SerializeField]
private TextMeshProUGUI _dialogue;

[SerializeField]
private TextMeshProUGUI _continueButton;

private bool _continueBShow = false;

[SerializeField]
private PlayerZoneFour _player;

[SerializeField]
private string[] _convo;

private int _ind = 0;


private void Start()
{
_player = GameObject.Find("PlayerZ4").GetComponent<PlayerZoneFour>();
}

private void Update()
{
if (_continueBShow && Input.GetKeyDown(KeyCode.Space))
{
ClickContinue();
}
}

public void StartDogConvo()
{
StartCoroutine(TypeConvo(_convo[_ind]));
}


IEnumerator TypeConvo(string whatToType)
{

yield return new WaitForSeconds(0.5f);
foreach (char letter in whatToType)
{
_dialogue.text += letter;
yield return new WaitForSeconds(0.02f);
}
yield return new WaitForSeconds(0.05f);
_continueButton.text = "press space to continue";
_continueBShow = true;
}

// Update is called once per frame
void Update()
public void ClickContinue()
{

_continueButton.text = "";
_continueBShow = false;
_dialogue.text = "";
if (_ind < 0)
{
_ind++;
StartCoroutine(TypeConvo(_convo[_ind]));
}
else
{
_player.SetMovementTrue();
}
}
}
70 changes: 68 additions & 2 deletions ZoneFour/PlayerZoneFour.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,84 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class PlayerZoneFour : MonoBehaviour
{
[SerializeField]
private Image blackk;
[SerializeField]
private Animator animm;

private Player _player;

[SerializeField]
private GameObject _dogCollar;

private bool _initialDone = false;
private bool _dogChat = false;

[SerializeField]
private DialogueZoneFour _dialogueManager;


// Start is called before the first frame update
void Start()
{

_player = GetComponent<Player>();
_dialogueManager = GameObject.Find("DialogueZ4").GetComponent<DialogueZoneFour>();
}

// Update is called once per frame
void Update()
{

if (!_initialDone && transform.position.x < -8)
{
transform.Translate(Vector3.right * 2.5f * Time.deltaTime);
}
else if (!_initialDone)
{
_initialDone = true;
SetMovementTrue();
}

// stairs thing
if (transform.position.x > 8.27f)
{
_player.playerMovement = false;
transform.Translate(Vector3.up * 6f * Time.deltaTime);
}
}


private void OnTriggerEnter2D(Collider2D other)
{
if (!_dogChat && other.tag is "hint6")
{
_player.playerMovement = false;
_dogChat = true;
_dogCollar.transform.position = new Vector3(0, 3.95f, 0);
_dogCollar.transform.localScale = new Vector3(5, 5, 0);
_dialogueManager.StartDogConvo();
}

if (other.tag is "nextScene")
{
StartCoroutine(Fading());
}
}


public void SetMovementTrue()
{
_player.playerMovement = true;
}

IEnumerator Fading()
{
animm.SetBool("Fade", true);
yield return new WaitUntil(() => blackk.color.a == 1);
SceneManager.LoadScene("ZoneFive");
}
}
2 changes: 1 addition & 1 deletion ZoneThree/PlayerZoneThree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ IEnumerator Fading()
{
animm.SetBool("Fade", true);
yield return new WaitUntil(() => blackk.color.a == 1);
SceneManager.LoadScene("ZoneThree");
SceneManager.LoadScene("ZoneFour");
}
}

0 comments on commit a333e30

Please sign in to comment.