// Start is called before the first frame update
    void Start()
    {
        DontDestroyOnLoad(this);

        phrasebook             = new PhraseBook();
        conversationVoiceLines = new VoiceLines("VoiceLines/");
        phraseVoiceLines       = new VoiceLines("PhraseVoiceLines/");

        audio        = GetComponent <AudioSource>();
        volume       = 0.01f;
        audio.volume = volume;

        //checks if voice line audio clips loaded properly
        Debug.Log(conversationVoiceLines.AudioClips.Length);

        if (File.Exists(Application.persistentDataPath + "/PlayerData.save"))
        {
            string jsonString = File.ReadAllText(Application.persistentDataPath + "/PlayerData.save");
            Debug.Log(jsonString);
            if (jsonString.Equals("null"))
            {
                player       = new Player();
                fileDetected = false;
            }
            else
            {
                player       = JsonConvert.DeserializeObject <Player>(jsonString);
                fileDetected = true;
            }
        }
        else
        {
            fileDetected = false;
            player       = new Player();
        }
    }
Exemplo n.º 2
0
 void Start()
 {
     voice = GameObject.Find("VoiceLines").GetComponent <VoiceLines>();
     lang  = voice.RandomLanguage();
 }
 public void Initialize(VoiceLines voiceLines)
 {
     _selectAudio = voiceLines.selectionLines;
     _moveAudio   = voiceLines.movementLines;
     _attackAudio = voiceLines.aggressiveLines;
 }