Skip to content

Commit

Permalink
zone 4 completed
Browse files Browse the repository at this point in the history
  • Loading branch information
armaanbadhan committed May 28, 2021
1 parent a333e30 commit 9b0f06d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
42 changes: 40 additions & 2 deletions ZoneFour/DialogueZoneFour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

public class DialogueZoneFour : MonoBehaviour
{
readonly private string _notice = "As you are walking over the bridge , you notice something on the ground!";
readonly private string _dog = "IT’S GEORGE’S COLLAR! HE MUST BE AROUND SOMEWHERE";


[SerializeField]
private TextMeshProUGUI _dialogue;

Expand Down Expand Up @@ -36,12 +40,46 @@ private void Update()
}
}

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


public void Notice()
{
StartCoroutine(TypeStuff(_notice));
}

public void StartDogConvo()
{
StartCoroutine(DogConvo(_dog));
}

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

IEnumerator TypeStuff(string whatToType)
{
foreach (char letter in whatToType)
{
_dialogue.text += letter;
yield return new WaitForSeconds(0.02f);
}
yield return new WaitForSeconds(1f);
_dialogue.text = "";
_player.SetMovementTrue();
}


IEnumerator TypeConvo(string whatToType)
{
yield return new WaitForSeconds(0.5f);
Expand All @@ -60,7 +98,7 @@ public void ClickContinue()
_continueButton.text = "";
_continueBShow = false;
_dialogue.text = "";
if (_ind < 0)
if (_ind < 6)
{
_ind++;
StartCoroutine(TypeConvo(_convo[_ind]));
Expand Down
16 changes: 16 additions & 0 deletions ZoneFour/PlayerZoneFour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class PlayerZoneFour : MonoBehaviour

private bool _initialDone = false;
private bool _dogChat = false;
private bool _noticed = false;
private bool _foxConvo = false;

[SerializeField]
private DialogueZoneFour _dialogueManager;
Expand Down Expand Up @@ -63,6 +65,20 @@ private void OnTriggerEnter2D(Collider2D other)
_dialogueManager.StartDogConvo();
}

if(!_foxConvo && other.tag is "fox")
{
_player.playerMovement = false;
_foxConvo = true;
_dialogueManager.StartFoxConvo();
}

if (!_noticed && other.tag is "notice")
{
_noticed = true;
_player.playerMovement = false;
_dialogueManager.Notice();
}

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

0 comments on commit 9b0f06d

Please sign in to comment.