|
|
|
|
|
|
[SerializeField] private ItemEventChannelSO _giveItemEvent = default; |
|
|
|
[SerializeField] private ItemEventChannelSO _rewardItemEvent = default; |
|
|
|
|
|
|
|
private QuestSO _currentQuest=null; |
|
|
|
private QuestSO _currentQuest = null; |
|
|
|
|
|
|
|
public void StartGame() |
|
|
|
|
|
|
|
public void StartGame() |
|
|
|
{//Add code for saved information
|
|
|
|
if (_checkStepValidityEvent != null) |
|
|
|
{ |
|
|
|
|
|
|
} |
|
|
|
void StartQuestline() |
|
|
|
{ |
|
|
|
if (_questlines != null) |
|
|
|
if (_questlines != null) |
|
|
|
{ |
|
|
|
if (_questlines.Exists(o => !o.IsDone)) |
|
|
|
{ |
|
|
|
|
|
|
} |
|
|
|
bool hasStep(ActorSO actorToCheckWith) |
|
|
|
{ |
|
|
|
if(_currentStep!=null) |
|
|
|
if (_currentStep != null) |
|
|
|
if(_currentStep.Actor== actorToCheckWith) |
|
|
|
if (_currentStep.Actor == actorToCheckWith) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
bool CheckQuestlineForQuestWithActor(ActorSO actorToCheckWith) |
|
|
|
|
|
|
if (_currentQuestline != null) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
return _currentQuestline.Quests.Exists(o => !o.IsDone && o.Steps != null && o.Steps[0].Actor == actorToCheckWith); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
public DialogueDataSO InteractWithCharacter(ActorSO actor, bool isCheckValidity, bool isValid) |
|
|
|
{ |
|
|
|
Debug.Log("current quest"+ _currentQuest); |
|
|
|
Debug.Log("current quest" + _currentQuest); |
|
|
|
if (_currentQuest == null) |
|
|
|
{ |
|
|
|
if (CheckQuestlineForQuestWithActor(actor)) |
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return _currentStep.DialogueBeforeStep; |
|
|
|
return _currentStep.DialogueBeforeStep; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
void CheckStepValidity() |
|
|
|
void CheckStepValidity() |
|
|
|
{ |
|
|
|
|
|
|
|
if (_currentStep != null) |
|
|
|
|
|
|
case stepType.checkItem: |
|
|
|
|
|
|
|
|
|
|
|
if (_inventory.Contains(_currentStep.Item)) |
|
|
|
{ |
|
|
|
_inventory.Contains(_currentStep.Item); |
|
|
|
|
|
|
case stepType.rewardItem: |
|
|
|
_rewardItemEvent.RaiseEvent(_currentStep.Item); |
|
|
|
//no dialogue is needed after Reward Item
|
|
|
|
if(_currentStep.CompleteDialogue !=null) |
|
|
|
if (_currentStep.CompleteDialogue != null) |
|
|
|
{ |
|
|
|
_completeDialogueEvent.RaiseEvent(); |
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
void EndStep() |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
_currentStep = null; |
|
|
|
|
|
|
|
if (_currentQuest != null) |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
EndQuest(); |
|
|
|
EndQuest(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|