浏览代码

New Quest System with Questlines

/main
uChema 3 年前
当前提交
964f7361
共有 17 个文件被更改,包括 505 次插入373 次删除
  1. 27
      UOP1_Project/Assets/Scenes/Gameplay.unity
  2. 9
      UOP1_Project/Assets/Scenes/TestingGround.unity
  3. 12
      UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/QuestSO.cs
  4. 198
      UOP1_Project/Assets/Scripts/Quests/StepController.cs
  5. 2
      UOP1_Project/Assets/Scripts/Quests/QuestAncorSO.cs.meta
  6. 2
      UOP1_Project/Assets/Scripts/UI/UIDialogueChoiceFiller.cs
  7. 20
      UOP1_Project/Assets/QuestManager.cs
  8. 11
      UOP1_Project/Assets/QuestManager.cs.meta
  9. 17
      UOP1_Project/Assets/ScriptableObjects/Quests/Quest1/Questline.asset
  10. 8
      UOP1_Project/Assets/ScriptableObjects/Quests/Quest1/Questline.asset.meta
  11. 24
      UOP1_Project/Assets/Scripts/Quests/QuestAnchor.asset
  12. 8
      UOP1_Project/Assets/Scripts/Quests/QuestAnchor.asset.meta
  13. 302
      UOP1_Project/Assets/Scripts/Quests/QuestAncorSO.cs
  14. 20
      UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/QuestlineSO.cs
  15. 11
      UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/QuestlineSO.cs.meta
  16. 207
      UOP1_Project/Assets/Scripts/Quests/QuestManager.cs
  17. 0
      /UOP1_Project/Assets/Scripts/Quests/QuestAncorSO.cs.meta

27
UOP1_Project/Assets/Scenes/Gameplay.unity


m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &478505547 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8957403575277752759, guid: 021ad8df909ac4147aa545c01f5ad8db,
type: 3}
m_PrefabInstance: {fileID: 8957403574244887918}
m_PrefabAsset: {fileID: 0}
--- !u!114 &478505548
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 478505547}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d3b99813ebb688d4ea1c24c7ac430cdc, type: 3}
m_Name:
m_EditorClassIdentifier:
_questAnchor: {fileID: 11400000, guid: dacb138678b7c2344b59c68de5dc18db, type: 2}
--- !u!114 &670213351 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 8980297398607076176, guid: ccad748453924ff4092fe3e5b978d8e5,

propertyPath: m_Name
value: QuestManager
objectReference: {fileID: 0}
m_RemovedComponents: []
- target: {fileID: 8957403575277752759, guid: 021ad8df909ac4147aa545c01f5ad8db,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 8957403575277752756, guid: 021ad8df909ac4147aa545c01f5ad8db, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 021ad8df909ac4147aa545c01f5ad8db, type: 3}
--- !u!1001 &8980297399098703799
PrefabInstance:

9
UOP1_Project/Assets/Scenes/TestingGround.unity
文件差异内容过多而无法显示
查看文件

12
UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/QuestSO.cs


using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Quest", menuName = "Quests/Quest", order = 51)]
public class QuestSO : ScriptableObject
[CreateAssetMenu(fileName = "Questline", menuName = "Quests/Questline", order = 51)]
public class QuestlineSO : ScriptableObject
[Tooltip("The collection of Steps composing the Quest")]
[Tooltip("The collection of Quests composing the Questline")]
private List<StepSO> _steps = new List<StepSO>();
private List<QuestSO> _quests = new List<QuestSO>();
public List<StepSO> Steps => _steps;
public List<QuestSO> Quests => _quests;
public void FinishQuest()
public void FinishQuestline()
{
_isDone = true;
}

198
UOP1_Project/Assets/Scripts/Quests/StepController.cs


[Header("Data")]
[SerializeField] private ActorSO _actor = default;
[SerializeField] private DialogueDataSO _defaultDialogue = default;
[SerializeField] private QuestAncorSO _questAnchor = default;
[SerializeField] private StepChannelSO _startStepEvent = default;
[SerializeField] private DialogueDataChannelSO _endDialogueEvent = default;
//[SerializeField] private StepChannelSO _startStepEvent = default;
//[SerializeField] private DialogueDataChannelSO _endDialogueEvent = default;
//[SerializeField] private DialogueActorChannelSO _PlayDefaultEvent = default;
[SerializeField] private VoidEventChannelSO _continueWithStep = default;
[SerializeField] private VoidEventChannelSO _endStepEvent = default;
//[SerializeField] private VoidEventChannelSO _continueWithStep = default;
//[SerializeField] private VoidEventChannelSO _endStepEvent = default;
[SerializeField] private VoidEventChannelSO _checkStepValidityEvent = default;
//[SerializeField] private VoidEventChannelSO _checkStepValidityEvent = default;
private bool _hasActifStep;
private StepSO _currentStep;
if (_endDialogueEvent != null)
{ _endDialogueEvent.OnEventRaised += EndDialogue; }
if (_startStepEvent != null)
{ _startStepEvent.OnEventRaised += CheckStepInvolvement; }
if (_interactionEvent != null)
{ _interactionEvent.OnEventRaised += InteractWithCharacter; }
if (_endStepEvent != null)
{ _endStepEvent.OnEventRaised += EndStep; }
if (_continueWithStep != null)
{ _continueWithStep.OnEventRaised += ContinueWithStep; }
//play default dialogue if no step
if (_defaultDialogue != null)
{
_currentDialogue = _defaultDialogue;
StartDialogue();
}
if (_defaultDialogue != null)
{
_currentDialogue = _defaultDialogue;
StartDialogue();
}
void CheckStepInvolvement(StepSO step)
{
if (_actor == step.Actor)
{
RegisterStep(step);
}
}
//register a step
void RegisterStep(StepSO step)
{
_currentStep = step;
_hasActifStep = true;
}
void InteractWithCharacter(ActorSO actorToInteractWith)
public void InteractWithCharacter()
if (actorToInteractWith == _actor)
{
if (_hasActifStep)
DialogueDataSO displayDialogue =_questAnchor.InteractWithCharacter(_actor, false, false);
Debug.Log("dialogue " + displayDialogue);
if (displayDialogue !=null)
StartStep();
_currentDialogue = displayDialogue;
StartDialogue();
}
public void InteractWithCharacter()
{
if (_hasActifStep)
{
StartStep();
}
else
{
PlayDefaultDialogue();
}
}
void StartStep()
{
if (_currentStep != null)
if (_currentStep.DialogueBeforeStep != null)
{
_currentDialogue = _currentStep.DialogueBeforeStep;
StartDialogue();
}
else
{
Debug.LogError("step without dialogue registring not implemented.");
}
}
void StartDialogue()
{
if (_startDialogueEvent != null)

if (_currentStep != null)
if (_currentStep.LoseDialogue != null)
if (_questAnchor != null)
{
DialogueDataSO displayDialogue = _questAnchor.InteractWithCharacter(_actor, true, false);
if (displayDialogue != null)
_currentDialogue = _currentStep.LoseDialogue;
_currentDialogue = displayDialogue;
}
if (_currentStep != null)
if (_currentStep.WinDialogue != null)
if (_questAnchor != null)
{
DialogueDataSO displayDialogue = _questAnchor.InteractWithCharacter(_actor, true, true);
if (displayDialogue != null)
_currentDialogue = _currentStep.WinDialogue;
_currentDialogue = displayDialogue;
}
//End dialogue
void EndDialogue(DialogueDataSO dialogue)
{
//depending on the dialogue that ended, do something. The dialogue type can be different from the current dialogue type
switch (dialogue.DialogueType)
{
case DialogueType.startDialogue:
//Check the validity of the step
CheckStepValidity();
break;
case DialogueType.winDialogue:
//After playing the win dialogue close Dialogue and end step
break;
case DialogueType.loseDialogue:
//closeDialogue
//replay start Dialogue if the lose Dialogue ended
if (_currentStep.DialogueBeforeStep != null)
{
_currentDialogue = _currentStep.DialogueBeforeStep;
}
break;
case DialogueType.defaultDialogue:
//close Dialogue
//nothing happens if it's the default dialogue
break;
default:
break;
void ContinueWithStep()
{
CheckStepValidity();
}
void CheckStepValidity()
{
if (_checkStepValidityEvent != null)
{
_checkStepValidityEvent.RaiseEvent();
}
}
void EndStep(StepSO stepToFinish)
{
if (stepToFinish == _currentStep)
UnregisterStep();
else
{
StartStep();
}
}
void EndStep()
{
UnregisterStep();
}
//unregister a step when it ends.
void UnregisterStep()
{
_currentStep = null;
_hasActifStep = false;
_currentDialogue = _defaultDialogue;
}
}

2
UOP1_Project/Assets/Scripts/Quests/QuestAncorSO.cs.meta


fileFormatVersion: 2
guid: 10b246087f2d8d842b859e2b2f88078f
guid: bcc67b9fd1ae89449a1734139485f3b2
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
UOP1_Project/Assets/Scripts/UI/UIDialogueChoiceFiller.cs


}
public void ButtonClicked()
{
{
if (_makeAChoiceEvent != null)
_makeAChoiceEvent.RaiseEvent(currentChoice);
}

20
UOP1_Project/Assets/QuestManager.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class QuestManager : MonoBehaviour
{
[SerializeField] private QuestAncorSO _questAnchor = default;
// Start is called before the first frame update
void Start()
{
_questAnchor.StartGame();
}
// Update is called once per frame
void Update()
{
}
}

11
UOP1_Project/Assets/QuestManager.cs.meta


fileFormatVersion: 2
guid: d3b99813ebb688d4ea1c24c7ac430cdc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

17
UOP1_Project/Assets/ScriptableObjects/Quests/Quest1/Questline.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b4f9c8aa1ce987b4799f7093a99181a9, type: 3}
m_Name: Questline
m_EditorClassIdentifier:
_quests:
- {fileID: 11400000, guid: 4235b642a3ad91341a7cb42c6851293f, type: 2}
_isDone: 0

8
UOP1_Project/Assets/ScriptableObjects/Quests/Quest1/Questline.asset.meta


fileFormatVersion: 2
guid: 8fd63124ea38bb24bb4263fda8d06ab3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

24
UOP1_Project/Assets/Scripts/Quests/QuestAnchor.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bcc67b9fd1ae89449a1734139485f3b2, type: 3}
m_Name: QuestAnchor
m_EditorClassIdentifier:
_questlines:
- {fileID: 11400000, guid: 8fd63124ea38bb24bb4263fda8d06ab3, type: 2}
_inventory: {fileID: 11400000, guid: 59c84467f7726dc4587a8373b0936f03, type: 2}
_checkStepValidityEvent: {fileID: 11400000, guid: 6711182c372e2e94a8bd3fd1868223ec,
type: 2}
_endDialogueEvent: {fileID: 11400000, guid: b8f14d59bc3b10e4f9bdf1e65c3c6280, type: 2}
_winDialogueEvent: {fileID: 11400000, guid: dc2da1754c28ab9499cb6c7d72465e69, type: 2}
_loseDialogueEvent: {fileID: 11400000, guid: fcc99784052e5cc469b8c22c0674b051, type: 2}
_giveItemEvent: {fileID: 11400000, guid: c54b320c4205f1c49b296b878daf2097, type: 2}
_rewardItemEvent: {fileID: 11400000, guid: ceeec59dc461abd4f91dac5b07084d24, type: 2}

8
UOP1_Project/Assets/Scripts/Quests/QuestAnchor.asset.meta


fileFormatVersion: 2
guid: dacb138678b7c2344b59c68de5dc18db
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

302
UOP1_Project/Assets/Scripts/Quests/QuestAncorSO.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "QuestAnchor", menuName = "Quests/QuestAnchor", order = 51)]
public class QuestAncorSO : ScriptableObject
{
[Header("Data")]
[SerializeField] private List<QuestlineSO> _questlines = default;
[SerializeField] private Inventory _inventory = default;
[Header("Linstening to channels")]
[SerializeField] private VoidEventChannelSO _checkStepValidityEvent = default;
[SerializeField] private DialogueDataChannelSO _endDialogueEvent = default;
//[SerializeField] private DialogueActorChannelSO _checkForQuest = default;
[Header("Broadcasting on channels")]
//[SerializeField] private StepChannelSO _startStepEvent = default;
//[SerializeField] private VoidEventChannelSO _endStepEvent = default;
[SerializeField] private VoidEventChannelSO _winDialogueEvent = default;
[SerializeField] private VoidEventChannelSO _loseDialogueEvent = default;
[SerializeField] private ItemEventChannelSO _giveItemEvent = default;
[SerializeField] private ItemEventChannelSO _rewardItemEvent = default;
private QuestSO _currentQuest=null;
private QuestlineSO _currentQuestline;
private StepSO _currentStep;
private int _currentQuestIndex = 0;
private int _currentQuestlineIndex = 0;
private int _currentStepIndex = 0;
public void StartGame()
{//Add code for saved information
if (_checkStepValidityEvent != null)
{
_checkStepValidityEvent.OnEventRaised += CheckStepValidity;
}
if (_endDialogueEvent != null)
{
_endDialogueEvent.OnEventRaised += EndDialogue;
}
StartQuestline();
}
void StartQuestline()
{
if (_questlines != null)
{
if (_questlines.Exists(o => !o.IsDone))
{
_currentQuestlineIndex = _questlines.FindIndex(o => !o.IsDone);
if (_currentQuestlineIndex >= 0)
_currentQuestline = _questlines.Find(o => !o.IsDone);
}
}
}
bool hasStep(ActorSO actorToCheckWith)
{
if(_currentStep!=null)
{
if(_currentStep.Actor== actorToCheckWith)
{
return true;
}
}
return false;
}
bool CheckQuestlineForQuestWithActor(ActorSO actorToCheckWith)
{
if (_currentQuest == null)//check if there's a current quest
{
if (_currentQuestline != null)
{
return _currentQuestline.Quests.Exists(o => !o.IsDone && o.Steps != null && o.Steps[0].Actor == actorToCheckWith);
}
}
return false;
}
public DialogueDataSO InteractWithCharacter(ActorSO actor, bool isCheckValidity, bool isValid)
{
if (_currentQuest == null)
{
if (CheckQuestlineForQuestWithActor(actor))
{
StartQuest(actor);
}
}
if (hasStep(actor))
{
if (isCheckValidity)
{
if (isValid)
{
return _currentStep.WinDialogue;
}
else
{
return _currentStep.LoseDialogue;
}
}
else
{
return _currentStep.DialogueBeforeStep;
}
}
return null;
}
//When Interacting with a character, we ask the quest manager if there's a quest that starts with a step with a certain character
void StartQuest(ActorSO actorToCheckWith)
{
if (_currentQuest != null)//check if there's a current quest
{
return;
}
if (_currentQuestline != null)
{
//find quest index
_currentQuestIndex = _currentQuestline.Quests.FindIndex(o => !o.IsDone && o.Steps != null && o.Steps[0].Actor == actorToCheckWith);
if ((_currentQuestline.Quests.Count > _currentQuestIndex) && (_currentQuestIndex >= 0))
{
_currentQuest = _currentQuestline.Quests[_currentQuestIndex];
//start Step
_currentStepIndex = 0;
_currentStepIndex = _currentQuest.Steps.FindIndex(o => o.IsDone == false);
if (_currentStepIndex >= 0)
StartStep();
}
}
}
void StartStep()
{
if (_currentQuest.Steps != null)
if (_currentQuest.Steps.Count > _currentStepIndex)
{
_currentStep = _currentQuest.Steps[_currentStepIndex];
}
}
void CheckStepValidity()
{
Debug.Log("Check step Validity");
if (_currentStep != null)
{
switch (_currentStep.Type)
{
case stepType.checkItem:
if (_inventory.Contains(_currentStep.Item))
{
_inventory.Contains(_currentStep.Item);
//Trigger win dialogue
_winDialogueEvent.RaiseEvent();
}
else
{
//trigger lose dialogue
_loseDialogueEvent.RaiseEvent();
}
break;
case stepType.giveItem:
Debug.Log("Check Item ");
if (_inventory.Contains(_currentStep.Item))
{
Debug.Log("Item exists");
_giveItemEvent.RaiseEvent(_currentStep.Item);
_winDialogueEvent.RaiseEvent();
}
else
{
//trigger lose dialogue
_loseDialogueEvent.RaiseEvent();
}
break;
case stepType.rewardItem:
_rewardItemEvent.RaiseEvent(_currentStep.Item);
//no dialogue is needed after Reward Item
EndStep();
break;
case stepType.dialogue:
//dialogue has already been played
EndStep();
break;
}
}
}
void EndDialogue(DialogueDataSO dialogue)
{
//depending on the dialogue that ended, do something
switch (dialogue.DialogueType)
{
case DialogueType.winDialogue:
EndStep();
break;
case DialogueType.startDialogue:
CheckStepValidity();
break;
default:
break;
}
}
void EndStep()
{
_currentStep = null;
if (_currentQuest != null)
if (_currentQuest.Steps.Count > _currentStepIndex)
{
_currentQuest.Steps[_currentStepIndex].FinishStep();
if (_currentQuest.Steps.Count > _currentStepIndex + 1)
{
_currentStepIndex++;
StartStep();
}
else
{
EndQuest();
}
}
}
void EndQuest()
{
if (_currentQuest != null)
_currentQuest.FinishQuest();
_currentQuest = null;
_currentQuestIndex = -1;
if (_currentQuestline != null)
{
if (!_currentQuestline.Quests.Exists(o => !o.IsDone))
{
EndQuestline();
}
}
}
void EndQuestline()
{
if (_questlines != null)
{
if (_currentQuestline != null)
{
_currentQuestline.FinishQuestline();
}
if (_questlines.Exists(o => o.IsDone))
{
StartQuestline();
}
}
}
}

20
UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/QuestlineSO.cs


using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "Quest", menuName = "Quests/Quest", order = 51)]
public class QuestSO : ScriptableObject
{
[Tooltip("The collection of Steps composing the Quest")]
[SerializeField]
private List<StepSO> _steps = new List<StepSO>();
[SerializeField]
bool _isDone = false;
public List<StepSO> Steps => _steps;
public bool IsDone => _isDone;
public void FinishQuest()
{
_isDone = true;
}
}

11
UOP1_Project/Assets/Scripts/Quests/ScriptableObjects/QuestlineSO.cs.meta


fileFormatVersion: 2
guid: b4f9c8aa1ce987b4799f7093a99181a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

207
UOP1_Project/Assets/Scripts/Quests/QuestManager.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class QuestManager : MonoBehaviour
{
[Header("Data")]
[SerializeField] private List<QuestSO> _quests = default;
[SerializeField] private Inventory _inventory = default;
[Header("Linstening to channels")]
[SerializeField] private VoidEventChannelSO _checkStepValidityEvent = default;
[SerializeField] private DialogueDataChannelSO _endDialogueEvent = default;
[Header("Broadcasting on channels")]
[SerializeField] private StepChannelSO _startStepEvent = default;
[SerializeField] private VoidEventChannelSO _endStepEvent = default;
[SerializeField] private VoidEventChannelSO _winDialogueEvent = default;
[SerializeField] private VoidEventChannelSO _loseDialogueEvent = default;
[SerializeField] private ItemEventChannelSO _giveItemEvent = default;
[SerializeField] private ItemEventChannelSO _rewardItemEvent = default;
private QuestSO _currentQuest;
private StepSO _currentStep;
private int _currentQuestIndex = 0;
private int _currentStepIndex = 0;
private void Start()
{
if (_checkStepValidityEvent != null)
{
_checkStepValidityEvent.OnEventRaised += CheckStepValidity;
}
if (_endDialogueEvent != null)
{
_endDialogueEvent.OnEventRaised += EndDialogue;
}
StartGame();
}
void StartGame()
{//Add code for saved information
_currentQuestIndex = 0;
if (_quests != null)
{
_currentQuestIndex = _quests.FindIndex(o => o.IsDone == false);
if (_currentQuestIndex >= 0)
StartQuest();
}
}
void StartQuest()
{
if (_quests != null)
if (_quests.Count > _currentQuestIndex)
{
_currentQuest = _quests[_currentQuestIndex];
_currentStepIndex = 0;
_currentStepIndex = _currentQuest.Steps.FindIndex(o => o.IsDone == false);
if (_currentStepIndex >= 0)
StartStep();
}
}
void StartStep()
{
if (_currentQuest.Steps != null)
if (_currentQuest.Steps.Count > _currentStepIndex)
{
_currentStep = _currentQuest.Steps[_currentStepIndex];
_startStepEvent.RaiseEvent(_currentStep);
}
}
void CheckStepValidity()
{
if (_currentQuest != null)
if (_currentQuest.Steps != null)
if (_currentQuest.Steps.Count > _currentStepIndex)
{
_currentStep = _currentQuest.Steps[_currentStepIndex];
switch (_currentStep.Type)
{
case stepType.checkItem:
if (_inventory.Contains(_currentStep.Item))
{
_inventory.Contains(_currentStep.Item);
//Trigger win dialogue
if (_winDialogueEvent != null)
{
_winDialogueEvent.OnEventRaised();
}
}
else
{
//trigger lose dialogue
if (_loseDialogueEvent != null)
{
_loseDialogueEvent.OnEventRaised();
}
}
break;
case stepType.giveItem:
if (_inventory.Contains(_currentStep.Item))
{
_giveItemEvent.RaiseEvent(_currentStep.Item);
//trigger win dialogue
if (_winDialogueEvent != null)
{
_winDialogueEvent.OnEventRaised();
}
}
else
{
//trigger lose dialogue
if (_loseDialogueEvent != null)
{
_loseDialogueEvent.OnEventRaised();
}
}
break;
case stepType.rewardItem:
_rewardItemEvent.RaiseEvent(_currentStep.Item);
//no dialogue is needed after Reward Item
EndStep();
break;
case stepType.dialogue:
//dialogue has already been played
EndStep();
break;
}
}
}
void EndDialogue(DialogueDataSO dialogue)
{
//depending on the dialogue that ended, do something
switch (dialogue.DialogueType)
{
case DialogueType.winDialogue:
EndStep();
break;
default:
break;
}
}
void EndStep()
{
_currentStep = null;
if (_quests != null)
if (_quests.Count > _currentQuestIndex)
if (_quests[_currentQuestIndex].Steps != null)
if (_quests[_currentQuestIndex].Steps.Count > _currentStepIndex)
{
if (_endStepEvent != null)
_endStepEvent.RaiseEvent();
_quests[_currentQuestIndex].Steps[_currentStepIndex].FinishStep();
if (_quests[_currentQuestIndex].Steps.Count > _currentStepIndex + 1)
{
_currentStepIndex++;
StartStep();
}
else
{
EndQuest();
}
}
}
void EndQuest()
{
if (_quests != null)
if (_quests.Count > _currentQuestIndex)
{
_quests[_currentQuestIndex].FinishQuest();
if (_quests.Count < _currentQuestIndex + 1)
{
_currentQuestIndex++;
StartQuest();
}
}
}
}

/UOP1_Project/Assets/Scripts/Quests/QuestManager.cs.meta → /UOP1_Project/Assets/Scripts/Quests/QuestAncorSO.cs.meta

正在加载...
取消
保存