public override bool CheckCompletion(CiscoTesting player) { foreach (RequiredItem requiredItem in questData.requiredItems) { Item item = requiredItem.item.GetComponent <Item>(); if (item != null && player.items.ContainsKey(item)) { //If the item is an inventory item and the name of the gameobject //matches that of the required item for the quest if (item.Type == ItemType.Inventory && item.Name == requiredItem.item.Name) { //If one of the items doesnt meet the requirement then the //quest is not completed if (player.items[requiredItem.item] < requiredItem.requiredAmount) { questData.questState = QuestState.inProgress; return(false); } } } else { return(false); } } //It went through all and were greater than or equal to the amount //required to set to complete and return true questData.questState = QuestState.completed; return(true); }
public bool CheckDependentQuests(CiscoTesting player, Quest quest, int index) { foreach (var dependentQuest in quest.DependentQuests) { if (dependentQuest.questData.questState != QuestState.done) { return(false); } } return(true); }
public void GiveQuest(CiscoTesting player, int index) { //give quest to player and set the SO to in progress Quest quest = player.GetComponent <PlayerQuestSystem>().GetQuestByID(giveableQuests[index].questID); if (!CheckDependentQuests(player, quest, index) || quest.questData.questState >= QuestState.completed) { return; } //We have done them all player.GetComponent <PlayerQuestSystem>().SetQuestStatus(quest.questID, QuestState.inProgress); player.UpdateCompletionStatus(); questsGiven++; gaveQuest = true; hasTalked = true; }
public abstract bool CheckCompletion(CiscoTesting player);
// Use this for initialization void Start() { Player = GameObject.FindGameObjectWithTag("Player").GetComponent <CiscoTesting>(); }
void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <CiscoTesting>(); descriptionText.gameObject.SetActive(false); }
public void Consume(CiscoTesting player) { player.GetComponent <HealthSystem>().heal(potionPower); }