Пример #1
0
    private void Update()
    {
        if (!_soundPlayer.GetAudioSources()[0].isPlaying || Input.GetKeyDown(KeyCode.Escape) || ((GameController.player.transform.position - transform.position).magnitude > 4.9999f && _playerObjective <= 7))
        {
            if (GameController.uiCanvas != null)
            {
                GameController.uiCanvas.CloseDialogBox();
                GetComponent <AudioSource>().Stop();

                if (_playerObjective >= 7 && DateTime.Now > _killPlayerTime && !_soundPlayer.GetAudioSources()[0].isPlaying)
                {
                    GameController.player.GetComponent <SoundPlayer>().PlayAudioClip(9);
                    _killPlayerTime = DateTime.MaxValue;

                    //Show credits or whatever
                }
            }
        }
    }