Narrative State Popup System - AlexisBliesener/Bewitched GitHub Wiki
Narrative State Popup System
This system controls all the narrative popups that show on the screen during gameplay.
Each popup is connected to a narrative state, and the popup will appear or disappear based on the current state of the game. The system guarantees that if there is more than one message in the list, then every time it will show a unique message.
You can add it to the scene by add the prefab (Prefabs/NarrativeSystem/NarrativeStatePopup.prefab).
How Priority Works
The list priorityStates controls which state should show first if many states happen at the same time.
Example priority list:
- PlayerPossessionDraining (highest priority)
- OgrePossessionAvailable
- NarrativeTrigger
- RoomDoorsOpened (lower priority)
If PlayerPossessionDraining and NarrativeTrigger happen at the same time:
PlayerPossessionDrainingwill show.NarrativeTriggerwill be ignored or queued (based on if it was added tostatesAllowedToQueue)
If OgrePossessionAvailable is showing and RoomDoorsOpened triggers:
- It will not show because
OgrePossessionAvailableis higher in the list.
Queuing Lower Priority States
Some states should wait until the high priority state is finished.
RoomDoorsOpened:
- If
RoomDoorsOpenedtriggers while a higher priority state is active - It will not show immediately
- It will be saved and shown after the high priority state ends
- For example: if you are possessing an enemy and you are taking damage (as eleth), and the door is already open, the message will wait.. after the player leaves the enemy, the
RoomDoorsOpenedmessage will show. - The state will be removed from the queue if it is no longer valid.
Same State Repeat Delay
sameStateRepeatDelay prevents the same state from appearing too fast. For example, PlayerPossessionDraining is called every frame when the player takes damage so this delay works like a cooldown before showing another message...