Menu system - death screen?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
chrislow19
Posts: 34
Joined: Mon Dec 30, 2019 4:26 pm

Menu system - death screen?

Post by chrislow19 »

Hi Tony,

I'm wondering if I can use the built in menu system to add sort of a death screen like so:

Player death event triggered, death music plays, screen fades to black, cinemachine zoom onto the player's dead body. Then a restart from last save point option appears. Is the menu system the best way to go about doing this?
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Menu system - death screen?

Post by Tony Li »

I don't think you need the menu system for that part (loading the last save). You can just call PixelCrushers.SaveSystem.LoadFromSlot(#), where # is your saved game slot. If the player can save in multiple slots, you can keep track of the last slot number saved and specify that for #. If you're using the Menu Framework, you can check the PlayerPrefs key "savedgame_lastSlotNum":

Code: Select all

if (PlayerPrefs.HasKey("savedgame_lastSlotNum"))
{
    int slot = PlayerPrefs.GetInt("savedgame_lastSlotNum");
    PixelCrushers.SaveSystem.LoadFromSlot(slot);
}
chrislow19 wrote: Sun Mar 15, 2020 2:16 pmPlayer death event triggered, death music plays, screen fades to black, cinemachine zoom onto the player's dead body.
I'm not clear on the order of events here. If you fade to black, won't the player be unable to see the dead body?
chrislow19
Posts: 34
Joined: Mon Dec 30, 2019 4:26 pm

Re: Menu system - death screen?

Post by chrislow19 »

Hi Tony, thanks! Good point, I have an idea in my head of how I want it to play out but I suppose I can't describe it quite as well. I'll figure that part out.

As far as the menu system goes, I just want to give the option to load from a save slot or quit to main menu once player death does occur, rather than an immediate reload.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Menu system - death screen?

Post by Tony Li »

chrislow19 wrote: Sun Mar 15, 2020 4:50 pmAs far as the menu system goes, I just want to give the option to load from a save slot or quit to main menu once player death does occur, rather than an immediate reload.
In that case, you can make a new panel in the MenuSystem. Maybe start by duplicating the PausePanel. Delete all buttons except for Load Game and Quit To Menu. When the player dies, call this panel's UIPanel.Open() method.
chrislow19
Posts: 34
Joined: Mon Dec 30, 2019 4:26 pm

Re: Menu system - death screen?

Post by chrislow19 »

Hey! Got it working. Thanks! I didn't realize it would be that simple.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Menu system - death screen?

Post by Tony Li »

Awesome! Glad to help.
Post Reply