UnityGameProjectsCode / InTheDarkGame / DeathScreen.cs
DeathScreen.cs
Raw
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class DeathScreen : MonoBehaviour
{
    private string[] deathTips = new string[]
    {
        "Death is bad and should be avoided.",
        "Lights can kill you if you stand in them long enough.",
        "There is no need to rush.",
        "Your stamina will drain faster if you stand within multiple lights.",
        "As long as you have any amount of stamina, you cannot lose health.",
        "Standing under rubble as it falls can lead to instant death.",
        "Lights will drain more of your stamina the closer you are to their source.",
        "The brighter the light, the faster it drains you.",
        "Red lights are able to detect you and alert drones.",
        "Some doors need keys to be opened.",
        "All doors have status lights that let you know if they are opened or closed.",
        "Drones with red highlights are able to detect sound.",
        "Electrified water will drain your health directly.",
        "Rubble will make sound, when dropped, that can be detected by drones.",
        "You can return to the main menu at any point by using the escape menu.",
        "Each time you complete a level, it will be unlocked in the main menu.",
        "Others have tried, what makes you think you can do this?",
        "Each attempt met with the same result, yet you still try?",
        "Have you seen the others?",
        "Have you heard the rumbles?",
        "There is no shame in failure.",
        "Each defeat only lends you more knowledge.",
        "For your sake, I hope there's no light at the end of the tunnel.",
        "Playing the game without losing will lead to victory.",
        "You can regenerate stamina by staying out of lights for a small period.",
        "You can regenerate stamina even while moving.",
        "Moving does not slow down stamina regeneration.",
        "Your health will never regenerate inside of a level.",
        "The barrier tool allows you to nullify the effects of lights.",
        "The barrier tool has a set amount of charge each level.",
        "The barrier tool will not recharge within a level.",
        "Terminals can provide you with important information.",
        "Do you really think you can escape?",
        "Some lights have more range than others.",
        "Drones and search lights will issue an alarm when they have spotted you.",
        "Alarms will call all drones within the level to your last known position.",
        "Drones will disregard an alarm once the last known position has been cleared.",
        "When detected, your last known position will be marked with a red circle.",
        "Darkness is your friend.",
        "Believe you can and you're halfway there",
        "And so, you must be silenced.",
        "Were it so easy...",
        "We all make it sooner or later.",
        "Watching and waiting, waiting and watching.",
        "If you cannot escape your nature, embrace it.",
    };

    private string[] badEndingTips = new string[]
{
        "All this way and you give up just like that?",
        "You are a fool if you think you'll ever escape this place.",
        "What did you expect to happen?",
        "This was only ever an eventuality.",
        "If only you had payed more attention.",
        "The only way forward is backwards.",
        "Just give up, you don't have a chance.",
        "You can keep trying, but the result will always be the same, unless...",
        "It doesn't matter how fast you run.",
        "It's simple, you just don't have the tools for the job.",
        "You did this to yourself.",
        "It was always going to lead up to this.",
        "Did you miss something?",
        "There is still something that can be done.",
        "This is not your end... yet."
    };

    public GameObject tipText;

    private void Start()
    {
        if(SceneManager.GetActiveScene().buildIndex == 21)
            tipText.GetComponent<Text>().text = badEndingTips[Random.Range(0, badEndingTips.Length)];
        else
            tipText.GetComponent<Text>().text = deathTips[Random.Range(0, deathTips.Length)];
    }
}