#Question re: invoking UI based on game state

1 messages · Page 1 of 1 (latest)

rose sigil
#

https://paste.myst.rs/a616nrdh
title pretty much says it all. this smells like a hack but it works. Essentially when all the enemies die on the map I want to invoke the victory UI

coarse coyote
#

There's a few ways to do it, you can also check state from the monobehaviour, or have a reference to the monobehaviour on a component. Personally we use PersistentVariables, but that's essentially a static solution too. Though I would personally place such a system in LateSimulationSystemGroup so you don't wait a frame before showing the UI.

rose sigil
# coarse coyote There's a few ways to do it, you can also check state from the monobehaviour, or...

good point. I'm new to DOTS so this is my sort of case study project. PersistentVariables sounds fine, i don't mind a static solution, but i would still need a detection mechanism for like "okay scene is loaded, this is a fresh 'game'

eventually i'm going to get to a point where i destroyed all the enemies in a wave, and subsequent waves will spawn, and this will be an insufficient solution for that reason

coarse coyote
#

For fresh "games" we use custom bootstrapper and an OnWorldLoaded event in there that they can subscribe to. Though if you tie new games to new worlds then you can also do it from the OnCreate of a system. Also possible to have a "current wave" or "start game" entity in the scene that you destroy or change after spawning the enemeis.