Search Unity

Play different timelines based on player choices

Discussion in 'Animation' started by RubenA715, Aug 14, 2021.

  1. RubenA715

    RubenA715

    Joined:
    Aug 12, 2021
    Posts:
    6
    I am attempting to develop a game similar to a Visual Novel where the player has choices that lead them down different paths, and the player's only way of interaction is through these decision trees. I would like to be able to play different timelines depending on the preceding choice and the 'states' of certain variables.
    An example:
    If a character's strength is at 10, and they choose to fight the monster, the timeline for the character acting out killing the monster plays. If the Character's strength is at 0, and they choose to fight the monster, the timeline for the tragic death of the character plays.
    Is there a way to do this and keep it organized within unity? Ideally, I'd like to be able to create some kind of visual tree that follows each of the potential choices and plays the respective timelines at each choice. At worst, I'd hope it'd be as complex as creating a series of conditional statements that play the timeline(s) with their respective background and scene shifts when needed.

    Note: This is all 2D, everything is done with 2D sprite animations, if relevant.


    Thanks!
     
  2. MathewHI

    MathewHI

    Joined:
    Mar 29, 2016
    Posts:
    349
    You could set this up easily with Cinemachines StateDrivenCamera
     
  3. RubenA715

    RubenA715

    Joined:
    Aug 12, 2021
    Posts:
    6
    Hey Mathew, thanks for responding. Could you elaborate? I'm a little new to unity so I'm not sure what to do with those or where to learn about them.
     
  4. MathewHI

    MathewHI

    Joined:
    Mar 29, 2016
    Posts:
    349
    In the editor go to Window/Package Manager. In Package Manager go to Unity Registry and install Cinemachine. After that you'll have to read the Cinemachine manual or follow some tutorials but with Cinemachine you can do everything your describing and then some. I'm using it for a rail shooter and using the state driven camera to seamlessly switch cameras.
     
  5. RubenA715

    RubenA715

    Joined:
    Aug 12, 2021
    Posts:
    6
    Right. But would this allow me to play timelines depending on state?
     
  6. MathewHI

    MathewHI

    Joined:
    Mar 29, 2016
    Posts:
    349
    Actually I’m not really sure sir, maybe my idea of what a visual novel is is wrong, I’ve never played one or developed one. I’m assuming your going to make all the visual pieces then use conditional statements to display them at the appropriate time.
     
  7. KalOBrien

    KalOBrien

    Unity Technologies

    Joined:
    Apr 20, 2021
    Posts:
    63
  8. RubenA715

    RubenA715

    Joined:
    Aug 12, 2021
    Posts:
    6
    Sadly it seems Fungus is gone....
    But I resolved my issue by using Animator and a custom script attached to each animator state.
     
unityunity