Dialogues - after fix
This commit is contained in:
parent
713b7ffa59
commit
92a1c69685
@ -29,7 +29,7 @@ public class NPCFollowing : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
//isAfterAction = System.Convert.ToBoolean(PlayerPrefs.GetInt(gameObject.GetComponent<NPC>().name + ".FirstDialogue"));
|
||||
isAfterAction = System.Convert.ToBoolean(PlayerPrefs.GetInt(gameObject.GetComponent<NPC>().name + ".FirstDialogue"));
|
||||
|
||||
myRigidbody = GetComponent<Rigidbody2D>();
|
||||
anim = GetComponent<Animator>();
|
||||
@ -84,8 +84,6 @@ public class NPCFollowing : MonoBehaviour
|
||||
//start dialogue here we want uga bunga
|
||||
|
||||
gameObject.GetComponent<NPC>().State = NPCStateEnum.Talking;
|
||||
|
||||
gameObject.GetComponent<NpcDialogueManager>().OpenDialoguePanel();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,6 @@ public class DialogueManager : MonoBehaviour
|
||||
public virtual void Start()
|
||||
{
|
||||
Dialogue = Instantiate(languageDetector.DetectInstanceBasedOnLanguage());
|
||||
Dialogue.SetSpeakerName(SpeakerName);
|
||||
|
||||
Dialogue.Dialogues.ForEach(dial => dial.Value.SetActionAfterDialogueStep(dial.Key, dial.Value.ResetDialogue)); // reset dial
|
||||
}
|
||||
|
||||
@ -47,7 +45,9 @@ public class DialogueManager : MonoBehaviour
|
||||
public void Update()
|
||||
{
|
||||
if (OpenInDefaultWay && Input.GetKeyDown(keyToOpen) && OpenPanelCondition())
|
||||
{
|
||||
OpenDialoguePanel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +76,6 @@ public class DialogueManager : MonoBehaviour
|
||||
|
||||
if (GetCurrentDialoguePanelStatus())
|
||||
{
|
||||
Debug.Log("Close dialog - defaulty way");
|
||||
Dialogue.BreakDialogueStep();
|
||||
}
|
||||
}
|
||||
@ -85,7 +84,12 @@ public class DialogueManager : MonoBehaviour
|
||||
public void OpenDialoguePanel()
|
||||
{
|
||||
if(OpenPanelCondition())
|
||||
{
|
||||
// Update speaker name before every opening
|
||||
Dialogue.SetSpeakerName(SpeakerName);
|
||||
|
||||
gameObject.GetComponent<DialogueManager>().Dialogue.StartDialogue();
|
||||
}
|
||||
}
|
||||
public virtual bool OpenPanelCondition()
|
||||
{
|
||||
@ -101,6 +105,7 @@ public class DialogueManager : MonoBehaviour
|
||||
{
|
||||
return CanBeOpened;
|
||||
}
|
||||
|
||||
protected virtual bool ComponentEnabledCondition()
|
||||
{
|
||||
return !gameObject.GetComponent<DialogueManager>().enabled;
|
||||
@ -120,7 +125,9 @@ public class DialogueManager : MonoBehaviour
|
||||
.Where(dialogue => dialogue.Key == multiDialStatius.Item1)
|
||||
.First()
|
||||
.Value
|
||||
.DialogueSteps[multiDialStatius.Item2].DialogueController.CurrentPanel != null;
|
||||
.DialogueSteps
|
||||
.ElementAtOrDefault(multiDialStatius.Item2)
|
||||
?.DialogueController.CurrentPanel != null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ public class NpcDialogueManager : DialogueManager
|
||||
base.Start();
|
||||
|
||||
CanBeOpened = false;
|
||||
OpenInDefaultWay = false;
|
||||
}
|
||||
public override bool OpenPanelCondition()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user