|
|
|
|
|
|
[SerializeField] private InventorySO _inventory = default; |
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] private VoidEventChannelSO _playWinningQuest = default; |
|
|
|
[SerializeField] private VoidEventChannelSO _playLosingQuest = default; |
|
|
|
[SerializeField] private VoidEventChannelSO _checkStepValidityEvent = default; |
|
|
|
[SerializeField] private DialogueDataChannelSO _endDialogueEvent = default; |
|
|
|
[FormerlySerializedAs("_checkStepValidityEvent")] |
|
|
|
[SerializeField] private VoidEventChannelSO _continueWithStepEvent = default; |
|
|
|
[SerializeField] private IntEventChannelSO _endDialogueEvent = default; |
|
|
|
[SerializeField] private VoidEventChannelSO _playWinningQuest = default; |
|
|
|
[SerializeField] private VoidEventChannelSO _playLosingQuest = default; |
|
|
|
[SerializeField] private VoidEventChannelSO _completeDialogueEvent = default; |
|
|
|
[SerializeField] private VoidEventChannelSO _incompleteDialogueEvent = default; |
|
|
|
[FormerlySerializedAs("_completeDialogueEvent")] |
|
|
|
[SerializeField] private VoidEventChannelSO _playCompletionDialogueEvent = default; |
|
|
|
[FormerlySerializedAs("_incompleteDialogueEvent")] |
|
|
|
[SerializeField] private VoidEventChannelSO _playIncompleteDialogueEvent = default; |
|
|
|
[SerializeField] private SaveSystem saveSystem = default; |
|
|
|
[SerializeField] private SaveSystem saveSystem = default; |
|
|
|
private QuestSO _currentQuest = null; |
|
|
|
private QuestlineSO _currentQuestline; |
|
|
|
private StepSO _currentStep; |
|
|
|
|
|
|
public void OnDisable() |
|
|
|
{ |
|
|
|
_checkStepValidityEvent.OnEventRaised -= CheckStepValidity; |
|
|
|
_continueWithStepEvent.OnEventRaised -= CheckStepValidity; |
|
|
|
_endDialogueEvent.OnEventRaised -= EndDialogue; |
|
|
|
_playWinningQuest.OnEventRaised -= SetWinningSteps; |
|
|
|
_playLosingQuest.OnEventRaised -= SetLosingSteps; |
|
|
|
|
|
|
//Add code for saved information
|
|
|
|
_checkStepValidityEvent.OnEventRaised += CheckStepValidity; |
|
|
|
_continueWithStepEvent.OnEventRaised += CheckStepValidity; |
|
|
|
_endDialogueEvent.OnEventRaised += EndDialogue; |
|
|
|
|
|
|
|
_playWinningQuest.OnEventRaised += SetWinningSteps; |
|
|
|
|
|
|
{ |
|
|
|
_inventory.Contains(_currentStep.Item); |
|
|
|
//Trigger win dialogue
|
|
|
|
_completeDialogueEvent.RaiseEvent(); |
|
|
|
_playCompletionDialogueEvent.RaiseEvent(); |
|
|
|
_incompleteDialogueEvent.RaiseEvent(); |
|
|
|
_playIncompleteDialogueEvent.RaiseEvent(); |
|
|
|
} |
|
|
|
break; |
|
|
|
case StepType.GiveItem: |
|
|
|
|
|
|
_completeDialogueEvent.RaiseEvent(); |
|
|
|
_playCompletionDialogueEvent.RaiseEvent(); |
|
|
|
_incompleteDialogueEvent.RaiseEvent(); |
|
|
|
_playIncompleteDialogueEvent.RaiseEvent(); |
|
|
|
|
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
if (_currentStep.CompleteDialogue != null) |
|
|
|
{ |
|
|
|
_completeDialogueEvent.RaiseEvent(); |
|
|
|
_playCompletionDialogueEvent.RaiseEvent(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
//dialogue has already been played
|
|
|
|
if (_currentStep.CompleteDialogue != null) |
|
|
|
{ |
|
|
|
_completeDialogueEvent.RaiseEvent(); |
|
|
|
_playCompletionDialogueEvent.RaiseEvent(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
void EndDialogue(DialogueDataSO dialogue) |
|
|
|
void EndDialogue(int dialogueType) |
|
|
|
switch (dialogue.DialogueType) |
|
|
|
switch ((DialogueType)dialogueType) |
|
|
|
{ |
|
|
|
case DialogueType.winDialogue: |
|
|
|
EndStep(); |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
void EndQuest() |
|
|
|