Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Xarbrough · Jul 11, 2015 at 05:00 PM · c#classdesign-patternspattern

Class design: puzzles that have to be solved.

I'm stuck at designing the architecture of a student's project game where the player solves puzzle to advance. For easy explanation, I'm simplifying the system.

Things get created:

  1. GameController loads current state.

  2. Current state spawns saved objects and puzzle which needs to be solved.

  3. Puzzle checks when it is solved.

This works fine and I have everything working with ScriptableObjects, SaveGames files etc and it seems to be robust and flexible.

Here is the problem:

How can I best notify my GameController, that the current phase is done and the next should be loaded? How can my puzzle notify the current phase, that the puzzle is solved and therefore, the phase is also solved?

I have been trying:

  1. Puzzle recognizes that its solved and calls the WasSolved delegate event on itself.

  2. Phase has subscribed to said event and recognizes that the puzzle is over.

  3. Phase calls another event on itself.

  4. GameController has subscribed to phase event and so on...

This already is nothing but Lasagna Code moving from one level to the next. However, I can't have the end of the chain call anything on the GameController, because there are or might be other things in between the chain, which all need to be updated. Say, if I want different puzzle aspects contributing to one puzzle and so on.

Any design pattern or advice on how to make this class creation and communication works? Create: GameController > Phase > Puzzle > PuzzleAspects Notify: PuzzleAspect > Puzzle > Phase > GameController > MoveToNextCreate

Thanks a lot!

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.

Follow this Question

Answers Answers and Comments

21 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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How to make classes/structs public to all scripts 0 Answers

I want to assign multiple variables without having to type the class on the side every time. 1 Answer

PropertyDrawer: Enum to select extended class 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