Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question How would you approach a puzzle manager for an adventure game?

Discussion in 'Scripting' started by Martin_Silenus, Aug 13, 2022.

  1. Martin_Silenus

    Martin_Silenus

    Joined:
    Jan 23, 2016
    Posts:
    2
    Hi there folks,

    I'm trying to build a little point and click adventure. But I am not sure how to do this in a clever way.
    My solution so far would be a couple of If-Statements:

    if a==1 && b ==1 open the door
    If c==1 || d==1 do this

    maybe encased in an IEnumerator.

    Does someone has a better idea to translate a dependency chart into code?
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,015
    Think in less of terms of a puzzle 'manager' and just design specific components to accomplish specific puzzles.

    Once you notice a pattern or have repeat mechanics you can start to generalise them.

    No need for coroutines either. You only have to check when the player clicks something interactable.
     
    Martin_Silenus and Kurt-Dekker like this.
  3. Martin_Silenus

    Martin_Silenus

    Joined:
    Jan 23, 2016
    Posts:
    2
    hmm... I think about it :)
    Thank you for your answer