• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by strudi1986 · Feb 28, 2018 at 04:26 PM · listsinheritanceclassespropertiesquests

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 somet$$anonymous$$ng easy to activate somet$$anonymous$$ng with a bool (maybe a door or somet$$anonymous$$ng else). I have tried to do t$$anonymous$$s with a base Quest class. I want to create the Quest, and then store t$$anonymous$$s 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 t$$anonymous$$s correctly how i want it to be. but i t$$anonymous$$nk 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)
         {
             t$$anonymous$$s.QuestName = name;
             t$$anonymous$$s.QuestDescription = description;
             t$$anonymous$$s.Activated = activated;
             t$$anonymous$$s.Completed = completed;
         }
 
         public void Check()
         {
            if (Completed)
            {
               UpdateUI();
            }
         }
 
         public void UpdateUI()
         {
             Debug.Log("Updated");
         }
     }

i dont know if i am doing t$$anonymous$$s right. because not$$anonymous$$ng of these is deriving from Monobehaviour or even if i use t$$anonymous$$s correctly. then i want to add t$$anonymous$$s somehow to a list where it will be stored so that i can show t$$anonymous$$s 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 = t$$anonymous$$s;
         }
         #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 t$$anonymous$$nk im doing t$$anonymous$$s completely wrong. :( my mind is stucked because i t$$anonymous$$nk about the problem and i dont move along. i know how i want it but i dont know how to do t$$anonymous$$s the best way or even right :(

Thanks

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

76 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges