Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 JeevanjotSingh · Dec 25, 2014 at 06:59 PM · collisiongameobjecttriggerplayerpickup

Mission Objectives

Hi guys , I just need your little help about the logic behind game objectives . I want my player to follow the path and first get some capsule from house and then go to another house and if the player collected the capsule then it can able to get another thing or it cannot . Gui text will pop there and say "Hey! you need capsule first". I can script the Gui text but how i achieve that objectives thing . collect First and if collected first then use in second or can collect second or if not collected then second is also not collected and says ....... .

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by RudyTheDev · Dec 25, 2014 at 08:28 PM

Your question is very generic and open-ended and so my answer is very generic. In your player script:

 private bool lootedCapsule;

Whenever player loots (by whatever means) the capsule:

 lootedCapsule = true;

Whenever player triggers (by whatever means) stuff in the house:

 if (lootedCapsule)
     GetNextThing(); // whatever you need to do here
 else
     ShowCapsuleNeededText(); // whatever you need to do here

This is nowhere near a true objective system and it would highly depend on your specific requirements and expectations. Above example is hardly extendable and I would not really recommend doing it this way for many items.

You could keep a list of things you have looted.

 private List<string> lootedObjects = new List<string>();

Then when you loot something, you add it:

 lootedObjects.Add("capsule");

Then when you check for loot you do:

 if (lootedObjects.Contains("capsule")) ..

This is slightly more extendable, but still not a very good design.

I guess, in a simple scenario all your looting and triggers could be done via OnTriggerEnter().

Comment
Add comment · Show 1 · Share
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
avatar image JeevanjotSingh · Dec 26, 2014 at 08:38 AM 0
Share

Thanks , i will try and yeh you guys are best That is really easy (thanks for telling me this simple logic , easy to understand and use ).

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.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to make a box (or any object) appear on collide? 1 Answer

Collection Script troubles 1 Answer

Checking trigger/collision of another gameobject separate from the one the script is on 1 Answer

2D Platformer - Picking Up Items & Storing Them C# 0 Answers

Trigger help! 0 Answers


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