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

View File

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

View File

@ -19,6 +19,8 @@ public class BossThug : MonoBehaviour
private GameObject player;
private GameObject doorway;
public bool isAfterConversation = false; // drop it if you can...
public BossThugEnum state = BossThugEnum.Pending;
// Start is called before the first frame update
@ -61,7 +63,6 @@ public class BossThug : MonoBehaviour
case BossThugEnum.Talking:
{
ActivateDialogueMode(); //later add trigger events etc
state = BossThugEnum.Attacking;
break;
}
}
@ -70,13 +71,31 @@ public class BossThug : MonoBehaviour
private void ActivateKillingMode()
{
gameObject.GetComponent<FollowingEnemy>().enabled=true;
gameObject.GetComponent<FollowingEnemy>().baseAttack=11f;
gameObject.GetComponent<FollowingEnemy>().baseAttack=1000f;
}
private void ActivateDialogueMode()
{
gameObject.GetComponent<CircleCollider2D>().enabled = true;
gameObject.GetComponent<CircleCollider2D>().radius = 1.2f;
gameObject.GetComponent<CircleCollider2D>().radius = 5f;
}
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)
{
Debug.Log("in range...");
if (firstAttack == false)
{
if (timerDmg >= 0.15f)

View File

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