Esempio n. 1
0
    void Start()
    {
        text        = GetComponentInChildren <TextMeshProUGUI>();
        save        = FindObjectOfType <GameResultSave>();
        audioSource = GetComponent <AudioSource>();

        if (save != null)
        {
            if (text != null)
            {
                if (save.gameWon)
                {
                    text.text = "You survived!";
                }
                else
                {
                    text.text = "You are dead!";
                }
            }

            if (audioSource != null)
            {
                if (save.gameWon)
                {
                    audioSource.PlayOneShot(WinClip);
                }
                else
                {
                    audioSource.PlayOneShot(LoseClip);
                }
            }
        }
    }
Esempio n. 2
0
    void Start()
    {
        enemy      = FindObjectOfType <Enemy>();
        player     = FindObjectOfType <Player>();
        flashlight = FindObjectOfType <Flashlight>();
        save       = FindObjectOfType <GameResultSave>();
        aData      = FindObjectOfType <ArduinoData>();

        if (save != null)
        {
            save.gameWon = false;
        }
    }