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