Page 1 of 1

Menu system - death screen?

Posted: Sun Mar 15, 2020 2:16 pm
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?

Re: Menu system - death screen?

Posted: Sun Mar 15, 2020 3:29 pm
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?

Re: Menu system - death screen?

Posted: Sun Mar 15, 2020 4:50 pm
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.

Re: Menu system - death screen?

Posted: Sun Mar 15, 2020 6:35 pm
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.

Re: Menu system - death screen?

Posted: Tue Mar 17, 2020 11:20 am
by chrislow19
Hey! Got it working. Thanks! I didn't realize it would be that simple.

Re: Menu system - death screen?

Posted: Tue Mar 17, 2020 12:52 pm
by Tony Li
Awesome! Glad to help.