- Home /
Trying to make a simple quest system, but i stuck how to do
Hello! I am trying to make a simple quest system. My thoughts for my first implementation was something easy to activate something with a bool (maybe a door or something else). I have tried to do this with a base Quest class. I want to create the Quest, and then store this quest in a list to show it in a questlog. Each quest should be added to the list with a button to show each questinformation in the questlog if you click on it. but i stuck with my mind. i dont know if i do this correctly how i want it to be. but i think not because i dont know how to get further.
I have the base class:
public class BaseQuest : MonoBehaviour
{
public string QuestName { get; set; }
public string QuestDescription { get; set; }
public bool Activated { get; set; }
public bool Completed { get; set; }
public void Evaluate()
{
if (Activated)
{
Complete();
}
}
public void Complete()
{
Completed = true;
}
}
then i want to set each props to their associated variables!
public class ActivationQuest : BaseQuest
{
public ActivationQuest(string name, string description, bool activated, bool completed)
{
this.QuestName = name;
this.QuestDescription = description;
this.Activated = activated;
this.Completed = completed;
}
public void Check()
{
if (Completed)
{
UpdateUI();
}
}
public void UpdateUI()
{
Debug.Log("Updated");
}
}
i dont know if i am doing this right. because nothing of these is deriving from Monobehaviour or even if i use this correctly. then i want to add this somehow to a list where it will be stored so that i can show this later in the questlog.
public class QuestInventory : MonoBehaviour
{
#region Singleton
public static QuestInventory qInstance;
void Awake()
{
if (qInstance != null)
{
Debug.LogWarning("More than one instance of QuestInventory found!");
return;
}
qInstance = this;
}
#endregion
public ActivationQuest quest;
public List<ActivationQuest> QuestEntry = new List<ActivationQuest>();
//Start just for test to add
private void Start()
{
AddQuest(quest);
}
public void AddQuest(ActivationQuest questEntry)
{
QuestEntry.Add(questEntry);
}
public void RemoveQuest(ActivationQuest questEntry)
{
QuestEntry.Remove(questEntry);
}
}
i think im doing this completely wrong. :( my mind is stucked because i think about the problem and i dont move along. i know how i want it but i dont know how to do this the best way or even right :(
Thanks
Your answer
![](https://koobas.hobune.stream/wayback/20220612153638im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity exports my derived class, but not its base class (C# OOP) - Is there a workaround? 0 Answers
I can't make my sub class inherit from my base class [Mac + MonoDevelop] 1 Answer
override a base property or make a new one for inheritor? 1 Answer
Can I preserve the values in a parent class when I overwrite it with a child class? 1 Answer
Inheritance hierarchy for character class implementation 1 Answer