Add dialogue to Boss Thug

This commit is contained in:
kabix09 2022-10-20 23:30:19 +02:00
parent 9b6aa76586
commit 006091c8c3
5 changed files with 60 additions and 42 deletions

View File

@ -13,7 +13,7 @@ GameObject:
- component: {fileID: 482428332992622010} - component: {fileID: 482428332992622010}
- component: {fileID: 482428332992622011} - component: {fileID: 482428332992622011}
- component: {fileID: 482428332992622007} - component: {fileID: 482428332992622007}
- component: {fileID: 482428332992622004} - component: {fileID: 5064228440392526989}
- component: {fileID: 482428332992622006} - component: {fileID: 482428332992622006}
- component: {fileID: 482428332992622001} - component: {fileID: 482428332992622001}
m_Layer: 0 m_Layer: 0
@ -95,10 +95,10 @@ BoxCollider2D:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 482428332992622009} m_GameObject: {fileID: 482428332992622009}
m_Enabled: 0 m_Enabled: 1
m_Density: 1 m_Density: 1
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 1
m_UsedByEffector: 0 m_UsedByEffector: 0
m_UsedByComposite: 0 m_UsedByComposite: 0
m_Offset: {x: 0, y: -0.43323898} m_Offset: {x: 0, y: -0.43323898}
@ -142,7 +142,7 @@ CircleCollider2D:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 482428332992622009} m_GameObject: {fileID: 482428332992622009}
m_Enabled: 0 m_Enabled: 1
m_Density: 1 m_Density: 1
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 1 m_IsTrigger: 1
@ -151,7 +151,7 @@ CircleCollider2D:
m_Offset: {x: 0, y: -0.5} m_Offset: {x: 0, y: -0.5}
serializedVersion: 2 serializedVersion: 2
m_Radius: 1.2 m_Radius: 1.2
--- !u!114 &482428332992622004 --- !u!114 &5064228440392526989
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -160,39 +160,32 @@ MonoBehaviour:
m_GameObject: {fileID: 482428332992622009} m_GameObject: {fileID: 482428332992622009}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81223f4044aba464faed4fa279d6c9b1, type: 3} m_Script: {fileID: 11500000, guid: f5e03e1acc0dd994786778db1f72ce69, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
name: DialogueStepsList:
nameText: {fileID: 0} - WasDisplayed: 0
nameText1: {fileID: 0} ListOfSentences:
nameText2: {fileID: 0} - Sentence: Who are you? How did you get past my guards?!
dialogueText: {fileID: 0} Buttons: []
dialogue: - Sentence: Don't answer, I don't care anyway. You're dead to me.
name: Boss Buttons: []
sentences: Rewards: []
- Random dialogue 1 EndOfDialogueStepAction:
- Even more random dialogue 2 m_PersistentCalls:
dialogueWQuest: m_Calls:
name: - m_Target: {fileID: 482428332992622001}
sentences: [] m_TargetAssemblyTypeName: BossThug, Assembly-CSharp
dialogueAQuest: m_MethodName: ChanegStatusToAttack
name: m_Mode: 1
sentences: [] m_Arguments:
dialoguePolish: m_ObjectArgument: {fileID: 0}
name: m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
sentences: [] m_IntArgument: 0
dialogueWQuestPolish: m_FloatArgument: 0
name: m_StringArgument:
sentences: [] m_BoolArgument: 0
dialogueAQuestPolish: m_CallState: 2
name:
sentences: []
Panel: {fileID: 0}
requiredItem:
QuestPanel: {fileID: 0}
FinishQuestPanel: {fileID: 0}
isQuest: 0
--- !u!114 &482428332992622006 --- !u!114 &482428332992622006
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -205,7 +198,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 88d05133b4682194e90a88b0f3c16b70, type: 3} m_Script: {fileID: 11500000, guid: 88d05133b4682194e90a88b0f3c16b70, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
moveSpeed: 2 moveSpeed: 5
enemyName: BossThug enemyName: BossThug
maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2} maxHealth: {fileID: 11400000, guid: 1a234827b90bfc24da563fbd5ffb412a, type: 2}
health: 0 health: 0
@ -239,4 +232,5 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
npc1: {fileID: 0} npc1: {fileID: 0}
npc2: {fileID: 0} npc2: {fileID: 0}
isAfterConversation: 0
state: 0 state: 0

View File

@ -38,7 +38,7 @@ public class NpcDialogueManager : MonoBehaviour
// 1. Find first yet undisplayed for player anbd show // 1. Find first yet undisplayed for player anbd show
foreach(var DialogueStep in DialogueStepsList) foreach(var DialogueStep in DialogueStepsList)
{ {
if(!DialogueStep.WasDisplayed) if(!DialogueStep.WasDisplayed && DialogueStep.DialogueController.listOfDialogue.Count != 0)
{ {
DialogueStep.DialogueController.Show(DialogueStep.DialogueController.listOfDialogue.Dequeue()); DialogueStep.DialogueController.Show(DialogueStep.DialogueController.listOfDialogue.Dequeue());

View File

@ -19,6 +19,8 @@ public class BossThug : MonoBehaviour
private GameObject player; private GameObject player;
private GameObject doorway; private GameObject doorway;
public bool isAfterConversation = false; // drop it if you can...
public BossThugEnum state = BossThugEnum.Pending; public BossThugEnum state = BossThugEnum.Pending;
// Start is called before the first frame update // Start is called before the first frame update
@ -61,7 +63,6 @@ public class BossThug : MonoBehaviour
case BossThugEnum.Talking: case BossThugEnum.Talking:
{ {
ActivateDialogueMode(); //later add trigger events etc ActivateDialogueMode(); //later add trigger events etc
state = BossThugEnum.Attacking;
break; break;
} }
} }
@ -70,13 +71,31 @@ public class BossThug : MonoBehaviour
private void ActivateKillingMode() private void ActivateKillingMode()
{ {
gameObject.GetComponent<FollowingEnemy>().enabled=true; gameObject.GetComponent<FollowingEnemy>().enabled=true;
gameObject.GetComponent<FollowingEnemy>().baseAttack=11f; gameObject.GetComponent<FollowingEnemy>().baseAttack=1000f;
} }
private void ActivateDialogueMode() private void ActivateDialogueMode()
{ {
gameObject.GetComponent<CircleCollider2D>().enabled = true; gameObject.GetComponent<CircleCollider2D>().radius = 5f;
gameObject.GetComponent<CircleCollider2D>().radius = 1.2f;
} }
public void ChanegStatusToAttack()
{
state = BossThugEnum.Attacking;
}
public void OnTriggerStay2D(Collider2D other)
{
//Debug.Log("kill");
if(other.tag == "Player" && state == BossThugEnum.Talking && !isAfterConversation)
{
isAfterConversation = true;
gameObject.GetComponent<CircleCollider2D>().enabled = false;
gameObject.GetComponent<CircleCollider2D>().radius = 2f;
gameObject.GetComponent<NpcDialogueManager>().ShowStep();
}
}
} }

View File

@ -75,6 +75,8 @@ public class FollowingEnemy : Enemy
if (inRange == true) if (inRange == true)
{ {
Debug.Log("in range...");
if (firstAttack == false) if (firstAttack == false)
{ {
if (timerDmg >= 0.15f) if (timerDmg >= 0.15f)

View File

@ -92,6 +92,9 @@ public class Player : MonoBehaviour
private void HandleAttacks() private void HandleAttacks()
{ {
if (!EquipmentManager.Instance._weapon)
return;
if (EquipmentManager.Instance._weapon.Name.Equals("pickaxe_test") && attackSword) if (EquipmentManager.Instance._weapon.Name.Equals("pickaxe_test") && attackSword)
{ {
myAnimator.SetTrigger("pickaxe"); myAnimator.SetTrigger("pickaxe");