Skip to content

Commit

Permalink
Added Dynamic Dialogue Model for Lvl3
Browse files Browse the repository at this point in the history
  • Loading branch information
uchop committed Mar 18, 2023
1 parent f23abfd commit 867bae1
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 24 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified Assets/.DS_Store
Binary file not shown.
87 changes: 80 additions & 7 deletions Assets/NextLevelDialogueScripts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public class NextLevelDialogueScripts : MonoBehaviour
public TMP_Text lvl3_npc_dialogue_1;
public TMP_Text lvl3_npc_dialogue_2;
public TMP_Text lvl3_npc_dialogue_3;
public TMP_Text lvl3_npc_dialogue_4;
private bool doorOpened = false;
public string[] dialogue_options = new string[5];
// Start is called before the first frame update
void Start()
{
Expand All @@ -20,17 +20,90 @@ void Start()
// Update is called once per frame
void Update()
{
/*if (lvl2_door.GetComponent<BoxCollider2D> ().enabled == false && !doorOpened)
if (lvl2_door.GetComponent<BoxCollider2D> ().enabled == false && !doorOpened)
{
Debug.Log("Open Sesame");
int sanityScore = ScoreManager.instance.GetSanityScore();
int reputation = ScoreManager.instance.GetReputationScore();
// if (sanityScore <= -40)
// {
// }
if (sanityScore <= -40)
{
if (reputation <= -40)
{
//scared
lvl3_npc_dialogue_1.text = "Please don't kill us!";
lvl3_npc_dialogue_2.text = "My family is waiting for me once I get out!";
lvl3_npc_dialogue_3.text = "I don't want to die!";
lvl3_npc_dialogue_4.text = "Please let me finish my PhD before I die!";
}
else
{
//mixed
lvl3_npc_dialogue_1.text = "I'm so scared, are we going to die next?";
lvl3_npc_dialogue_2.text = "Maybe he won't kill us like he did with the others?";
lvl3_npc_dialogue_3.text = "I have faith you'll do the right thing!";
lvl3_npc_dialogue_4.text = "Will you spare our lives?";
}
}
else if (sanityScore <= -20)
{
if (reputation <= -20)
{
//mixed
lvl3_npc_dialogue_1.text = "Just because he killed some prisoners doesn't mean he'll kill us.";
lvl3_npc_dialogue_2.text = "Don't anger him too much or we'll be next!";
lvl3_npc_dialogue_3.text = "If we leave him alone maybe we'll be spared.";
lvl3_npc_dialogue_4.text = "Nobody make any sudden movements and he wont come for us.";
}
else
{
//neutral
lvl3_npc_dialogue_1.text = "He won't kill us like he did with the guard.";
lvl3_npc_dialogue_2.text = "I'm just looking forward to getting out of here.";
lvl3_npc_dialogue_3.text = "I wonder what's on the other side of this door?";
lvl3_npc_dialogue_4.text = "Does Arunpreet's have a middle name?";
}
}
else if (sanityScore <= 0)
{
if (reputation < 0)
{
//netural
lvl3_npc_dialogue_1.text = "Just because he killed some prisoners doesn't mean he'll kill us.";
lvl3_npc_dialogue_2.text = "Don't anger him too much or we'll be next!";
lvl3_npc_dialogue_3.text = "If we leave him alone maybe we'll be spared.";
lvl3_npc_dialogue_4.text = "Nobody make any sudden movements and he wont come for us.";
}
else
{
//positive
lvl3_npc_dialogue_1.text = "Plese save us too!";
lvl3_npc_dialogue_2.text = "You could let us out also!";
lvl3_npc_dialogue_3.text = "Do the right thing and break us free!";
lvl3_npc_dialogue_4.text = "Don't let us be locked in here!";

}
}
else
{
if (reputation <= 20)
{
//positive
lvl3_npc_dialogue_1.text = "Help us!";
lvl3_npc_dialogue_2.text = "Break us free!";
lvl3_npc_dialogue_3.text = "If you break us out I'll buy you a beer at 3 Mile!";
lvl3_npc_dialogue_4.text = "You're so close to letting us out!";
}
else
{
//very positive
lvl3_npc_dialogue_1.text = "You're our hero!";
lvl3_npc_dialogue_2.text = "Be the hero we don't deserve, but the hero we need!";
lvl3_npc_dialogue_3.text = "Whooo there's the man of the hour!";
lvl3_npc_dialogue_4.text = "Our savior is here!";
}
}
doorOpened = true;
}*/
}

}
}
3 changes: 3 additions & 0 deletions Assets/PrisonerShot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
public class PrisonerShot : MonoBehaviour
{
public GameObject bullet, blood;
public GameObject lvl3_npc_dialogue;
public bool shotByBullet = false;
public AudioSource audioSource_;

Expand All @@ -22,7 +23,9 @@ void Update()
GameObject bloodIns = Instantiate(blood, transform.position, Quaternion.identity);
audioSource_.Play();
Destroy(gameObject);
Destroy(lvl3_npc_dialogue);
ScoreManager.instance.PrisonerDestroyed();
ScoreManager.instance.AdddPoints(-20, -20);
}
}
void OnTriggerEnter2D(Collider2D other){
Expand Down
46 changes: 30 additions & 16 deletions Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -2854,6 +2854,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
bullet: {fileID: 4281599298627598602, guid: 0178f4643417944c18fe402e234d662b, type: 3}
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 2126885209}
shotByBullet: 0
audioSource_: {fileID: 1637472452}
--- !u!114 &518975276
Expand All @@ -2869,6 +2870,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 2126885209}
audioSource_: {fileID: 1637472452}
--- !u!1 &519420028
GameObject:
Expand Down Expand Up @@ -3218,6 +3220,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
bullet: {fileID: 4281599298627598602, guid: 0178f4643417944c18fe402e234d662b, type: 3}
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 0}
shotByBullet: 0
audioSource_: {fileID: 1637472452}
--- !u!114 &540650403
Expand All @@ -3233,6 +3236,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 0}
audioSource_: {fileID: 1637472452}
--- !u!1 &545445634 stripped
GameObject:
Expand Down Expand Up @@ -3553,6 +3557,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 6644944588469475090, guid: 4be821d0b78ad5043985b57b738e951b,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6644944589867386884, guid: 4be821d0b78ad5043985b57b738e951b,
type: 3}
propertyPath: m_RootOrder
Expand Down Expand Up @@ -4781,6 +4790,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
bullet: {fileID: 4281599298627598602, guid: 0178f4643417944c18fe402e234d662b, type: 3}
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 348081969}
shotByBullet: 0
audioSource_: {fileID: 1637472452}
--- !u!114 &710763206
Expand All @@ -4796,6 +4806,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 348081969}
audioSource_: {fileID: 1637472452}
--- !u!1 &718623735
GameObject:
Expand Down Expand Up @@ -5530,15 +5541,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
lvl2_door: {fileID: 841580779}
lvl3_npc_dialogue_1: {fileID: 0}
lvl3_npc_dialogue_2: {fileID: 0}
lvl3_npc_dialogue_3: {fileID: 0}
dialogue_options:
-
-
-
-
-
lvl3_npc_dialogue_1: {fileID: 167225073}
lvl3_npc_dialogue_2: {fileID: 2042413598}
lvl3_npc_dialogue_3: {fileID: 92404742}
lvl3_npc_dialogue_4: {fileID: 550196121}
--- !u!1 &851870745
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -6452,6 +6458,11 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2055102312182832482, guid: 6a057178eb028e94fb93bf39262ea3e8,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6a057178eb028e94fb93bf39262ea3e8, type: 3}
--- !u!1 &950382660 stripped
Expand Down Expand Up @@ -6846,7 +6857,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1039875326}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4718376c1384a4fa5a78dd9ebea7e224, type: 3}
m_Name:
Expand All @@ -6855,12 +6866,7 @@ MonoBehaviour:
lvl3_npc_dialogue_1: {fileID: 0}
lvl3_npc_dialogue_2: {fileID: 0}
lvl3_npc_dialogue_3: {fileID: 0}
dialogue_options:
-
-
-
-
-
lvl3_npc_dialogue_4: {fileID: 0}
--- !u!1 &1065581853
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -8232,6 +8238,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
bullet: {fileID: 4281599298627598602, guid: 0178f4643417944c18fe402e234d662b, type: 3}
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 0}
shotByBullet: 0
audioSource_: {fileID: 1637472452}
--- !u!114 &1382591884
Expand All @@ -8247,6 +8254,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 0}
audioSource_: {fileID: 1637472452}
--- !u!1 &1385864564
GameObject:
Expand Down Expand Up @@ -19996,6 +20004,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
bullet: {fileID: 4281599298627598602, guid: 0178f4643417944c18fe402e234d662b, type: 3}
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 1935110574}
shotByBullet: 0
audioSource_: {fileID: 1637472452}
--- !u!114 &1746350770
Expand All @@ -20011,6 +20020,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 1935110574}
audioSource_: {fileID: 1637472452}
--- !u!1 &1762698488
GameObject:
Expand Down Expand Up @@ -28788,6 +28798,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
bullet: {fileID: 4281599298627598602, guid: 0178f4643417944c18fe402e234d662b, type: 3}
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 395631837}
shotByBullet: 0
audioSource_: {fileID: 1637472452}
--- !u!114 &2064555822
Expand All @@ -28803,6 +28814,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 395631837}
audioSource_: {fileID: 1637472452}
--- !u!1001 &2065320613
PrefabInstance:
Expand Down Expand Up @@ -28923,6 +28935,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
bullet: {fileID: 4281599298627598602, guid: 0178f4643417944c18fe402e234d662b, type: 3}
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 0}
shotByBullet: 0
audioSource_: {fileID: 1637472452}
--- !u!114 &2065320622
Expand All @@ -28938,6 +28951,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
blood: {fileID: 4758788576945127766, guid: 21240158094624a7f96e26036aa4578b, type: 3}
lvl3_npc_dialogue: {fileID: 0}
audioSource_: {fileID: 1637472452}
--- !u!1 &2076389458
GameObject:
Expand Down
4 changes: 3 additions & 1 deletion Assets/hammerPrisoners.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class hammerPrisoners : MonoBehaviour
private bool pickUpAllowed;
private bool pointsAdded = false;
public GameObject blood;
public GameObject lvl3_npc_dialogue;
public AudioSource audioSource_;

void Update()
Expand All @@ -18,7 +19,8 @@ void Update()
GameObject bloodIns = Instantiate(blood, transform.position, Quaternion.identity);
audioSource_.Play();
Destroy(gameObject);
ScoreManager.instance.AdddPoints(-20, -20);
Destroy(lvl3_npc_dialogue);
ScoreManager.instance.AdddPoints(-10, -10);
pointsAdded = true;
}
}
Expand Down

0 comments on commit 867bae1

Please sign in to comment.