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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Presentable Liberty Letter System

Discussion in 'Scripting' started by SaamBell, Aug 20, 2015.

  1. SaamBell

    SaamBell

    Joined:
    Mar 28, 2014
    Posts:
    128
    To anyone who's familiar with the game Presentable Liberty you'll know that the game is very heavily story based and makes the player wait for letters from different people on the outside. Every time a new letter arrives the envelope model slides through a hole in the door and you read it. Then after some time in which you can sit and play mini games the next envelope will arrive which will carry on the story. This happens until it reaches night time and a new day starts. If I wanted to go about creating a similar story based game I was wondering how to create this kind of letter system, would it just be the case of lots of timers/bools being used??
    (Link if you're curious: http://gamejolt.com/games/presentable-liberty/42997)
     
  2. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    Timers and bools could work, provided that you were using an internal counter with deltaTime so that pausing and such wouldn't allow the timer to keep incrementing every frame.

    I would personally prefer a kind of "action points" system where every in-game action you take, including just moving around maybe (a little, at least), would increment "points" onto a counter. At certain point-thresholds, "timed" events could occur. This makes it far more likely that a certain amount of energy has been spent on the game by all of your players, regardless of how "fast/active" they are, and seems like it could be balanced easier than a purely time-based system. Pausing or leaving your character standing around doing nothing would be naturally, rather than explicitly, ineffective in moving the story along as well.
     
  3. SaamBell

    SaamBell

    Joined:
    Mar 28, 2014
    Posts:
    128
    I see where you're coming from but believe it or not the standing around system actually kinda works in that game cause you're confined to a very small prison cell. It is mostly all story driven and keeps the player enticed rather well. So if I wanted to go about making such a action system for things like letters appearing would I simply have a timer continuously counting up, and then have something like

    Code (CSharp):
    1. // x is the time i wanted the event to occur
    2.  
    3. If (timer == x)
    4. {
    5. instantiate(gameObject) //the letter
    6. }
    7.  
    8.  
    The only problem I could see using this is that if the timer is continuing to count whilst the letter hasn't been read then eventually the new letter will spawn and the old one will become void. Is there a way I could pause the timer until the object has been clicked (using Raycast)??
     
  4. SaamBell

    SaamBell

    Joined:
    Mar 28, 2014
    Posts:
    128
    What would be the best way to simply create what you had in mind before I start :)?