snozbot / fungus

An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
MIT License
1.59k stars 291 forks source link

Auto skip #1046

Open addie-lombardo opened 2 years ago

addie-lombardo commented 2 years ago

Description

A common quality of life feature in visual novels is the ability to have the dialog continue after a period of time. I've implemented this feature into Fungus.

What is the current behavior?

Currently you are required to click/press a button each time you want to advance the text.

What is the new behavior?

Pressing the Tab key now toggles auto skip on and off. If enabled when a dialog entry ends it will wait the amount of time specified by Writer.AutoSkipWaitLength before continuing to the next command. If auto skip gets enabled after dialog has already finished printing it counts it as an input and continues to the next command. Additionally I've added a new serialized variable in SayDialog named autoSkipGO which takes a GameObject which will be toggle on and off to indicate to the player that auto skip is on (see GIF).

Other information

CleanShot 2022-01-03 at 09 36 25

breadnone commented 2 years ago

Wouldn't it better if it's just a coroutine right after the typing is done? similar to Wait For Click, this way we don't need to check every frame on Update and definitely much more cleaner.

Edit: You don't event need a coroutine for this to work, a regular method would work wonders too, unless you want to put some sort of delays at the end before skipping, then yeah, coroutine is the way to go.

addie-lombardo commented 2 years ago

Wouldn't it better if it's just a coroutine right after the typing is done? similar to Wait For Click, this way we don't need to check every frame on Update and definitely much more cleaner.

Edit: You don't event need a coroutine for this to work, a regular method would work wonders too, unless you want to put some sort of delays at the end before skipping, then yeah, coroutine is the way to go.

Fair enough! The code is actually from my game where we do have some delays/coroutines to yield to at the end hence the coroutine but I can definitely change it.

breadnone commented 2 years ago

oh I see now, the Update just for checking button presses.

Also, don't hardcode the button let users choose it instead?

Arylos07 commented 2 years ago

I was working on a similar feature that worked in a similar way, but allowed voice over correction and click-through. However, life got in the way before I could finish it. When my schedule improves, I'll look into opening a PR and adding it; it was nearly done but needed some thorough testing.

breadnone commented 2 years ago

@Arylos07 Wait until this pr gets merged than work based on the new develop branch, or else.. well... conflicts XD