Skip to content

Commit

Permalink
NPCs have unique dialogues on lvl2
Browse files Browse the repository at this point in the history
  • Loading branch information
uchop committed Mar 8, 2023
1 parent cca251e commit 15251c7
Show file tree
Hide file tree
Showing 4 changed files with 388 additions and 52 deletions.
8 changes: 7 additions & 1 deletion Assets/Explosion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ public class Explosion : MonoBehaviour
public GameObject NPC1_cell_door;
public GameObject NPC2_cell_door;
public TMP_Text lvl2_npc_dialogue;
public TMP_Text lvl2_npc_dialogue_2;
public string[] dialogue_options = new string[5];
private string selected_dialogue;
private string selected_dialogue_2;
public bool playerIsClose;
private bool pointsAdded = false;

Expand All @@ -45,8 +47,12 @@ void Update()
NPC2_cell_door.SetActive(false);
NPC1_dialogue_panel.SetActive(false);
NPC2_dialogue_panel.SetActive(false);
selected_dialogue = dialogue_options[Random.Range(0, dialogue_options.Length)];
int index = Random.Range(0, dialogue_options.Length);
int index_2 = (index + 1) % 5;
selected_dialogue = dialogue_options[index];
selected_dialogue_2 = dialogue_options[index_2];
lvl2_npc_dialogue.text = selected_dialogue;
lvl2_npc_dialogue_2.text = selected_dialogue_2;
if (!pointsAdded)
{
ScoreManager.instance.AdddPoints(-40, -40);
Expand Down
8 changes: 7 additions & 1 deletion Assets/KeyToOpemDoor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ public class KeyToOpemDoor : MonoBehaviour
public TMP_Text npc1_dialogue;
public TMP_Text npc2_dialogue;
public TMP_Text lvl2_npc_dialogue;
public TMP_Text lvl2_npc_dialogue_2;
public string[] dialogue_options = new string[5];
private string selected_dialogue;
private string selected_dialogue_2;
public bool playerIsClose;
private bool pointsAdded = false;

Expand All @@ -37,8 +39,12 @@ void Update()
NPC2_cell_door.SetActive(false);
npc1_dialogue.text = "We're Free!";
npc2_dialogue.text = "We're Free!";
selected_dialogue = dialogue_options[Random.Range(0, dialogue_options.Length)];
int index = Random.Range(0, dialogue_options.Length);
int index_2 = (index + 1) % 5;
selected_dialogue = dialogue_options[index];
selected_dialogue_2 = dialogue_options[index_2];
lvl2_npc_dialogue.text = selected_dialogue;
lvl2_npc_dialogue_2.text = selected_dialogue_2;
if (!pointsAdded)
{
ScoreManager.instance.AdddPoints(15, 15);
Expand Down
Loading

0 comments on commit 15251c7

Please sign in to comment.