Ejemplo n.º 1
0
 private void soundResponse()
 {
     fishDictionary.word word = soundCommunication.nearestReceived();
     if (word != null)
     {
         soundCommunication.Clear();
         if (word.Name == "music")
         {
             curState = 13;
         }
         if (word.Name == "followme")
         {
             // Debug.Log("follow me");
             curState     = 14; //follow state
             followTarget = interactionTarget;
             isFollowing  = true;
         }
         if (word.Name == "greeting")
         {
             curState = 11;
         }
         if (word.Name == "alert")
         {
             curState = 15; //flight state
         }
         if (word.Name == "smallTalk")
         {
             curState = 11;
         }
     }
 }
Ejemplo n.º 2
0
 public void ReceiveSound(fishDictionary.word word)
 {
     if (!playbackDevice && !receivedWords.Contains(word))
     {
         receivedWords.Add(word);
     }
     //Debug.Log(clip.name);
 }
Ejemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     soundTimer += Time.deltaTime;
     if (soundTimer > soundFrequency)
     {
         fishDictionary.word sound = words[Random.Range(0, words.Length)];
         soundCommunication.playWord(sound, dictionary);
         soundTimer = Random.Range(-soundFrequency / 2, 0);
         GameObject balloon = Instantiate(speechBalloon, transform, false);
         balloon.GetComponent <speechBalloon>().initWord(sound, false);
     }
 }
Ejemplo n.º 4
0
    public void playWord(fishDictionary.word word, fishDictionary dictionary)
    {
        PlayRandomSound(word.audio);
        currentWord = word;
        AudioClip far = dictionary.far[word.farawaySound];

        if (sourceFar.clip != far)
        {
            StartCoroutine(NextSound(far, sourceFar));
        }
        knownWordManager.wordBalloon(transform, word);
    }
Ejemplo n.º 5
0
 public static void checkRecording(fishDictionary.word word)
 {
     if (!word.known)
     {
         textBalloon(self.transform, "NEW SOUND DISCOVERED");
         word.known = true;
     }
     else
     {
         wordBalloon(self.transform, word);
     }
 }
Ejemplo n.º 6
0
    // Update is called once per frame
    public void initWord(fishDictionary.word initword, bool b)
    {
        word = initword;
        if (b)
        {
            TextMeshPro.font = mojili;
        }
        string text = word.meaning;

        if (!word.known)
        {
            text = "???????";
        }
        init(text);
    }
Ejemplo n.º 7
0
    public void Init(int i, fishDictionary.word w)
    {
        word = w;
        id   = i;

        gameObject.name = word.meaning;
        humanSpeak.text = word.meaning;
        if (CHIPSStorage.storage[i])
        {
            mojiliSpeak.text = "FILLED";
        }
        else
        {
            mojiliSpeak.text = "???";
        }
    }
Ejemplo n.º 8
0
    public static void wordBalloon(Transform t, fishDictionary.word word)
    {
        if (!self)
        {
            Debug.Log("no self knownwordmanager");
            return;
        }
        ;
        Instantiate(self.speechParticles, t);
        if (!word.known)
        {
            return;
        }
        o = Instantiate(self.speechBalloon, t);
        o.GetComponent <speechBalloon>().initWord(word, true);
        o.transform.parent = null;
        setGlobScale(o.transform, Vector3.one);
        Vector3 r = Random.insideUnitSphere / 8;

        r.y = Mathf.Abs(r.y) + .1f;
        o.transform.position += r;
    }
Ejemplo n.º 9
0
    void Update()
    {
        isRecording = leftHand.triggerPressed;
        //setting the audio recorder
        if (!microphoneListener.enabled && isRecording && !menuActive)
        {
            audioRecorder.StartRecording();
            microphoneCommunication.Clear();

            barProgress = 0;
        }
        if (microphoneListener.enabled && !isRecording)
        {
            audioRecording = audioRecorder.StopRecording();
            //audioImage = WaveFormImage.RenderWaveForm(audioRecording,Color.red);
            playbackWord = microphoneCommunication.nearestReceived();
            recordingProgress.enabled = false;
            barProgress = 2 * maxRecordingLength;
            if (playbackWord != null)
            {
                knownWordManager.checkRecording(playbackWord);
            }
            else
            {
                knownWordManager.textBalloon(speaker, "Nothing recorded");
            }
        }
        holdingRecording = audioRecorder.recording != null;

        //updating UI


        recordingProgress.enabled = isRecording;
        playProgress.enabled      = !isRecording && holdingRecording;
        playButton.enabled        = holdingRecording;

        barProgress += Time.deltaTime;
        recordingProgress.fillAmount = barProgress / maxRecordingLength;
        if (audioRecording)
        {
            playProgress.fillAmount = 2 * barProgress / audioRecording.length;
        }


        microphoneListener.enabled = isRecording;
        characterListener.enabled  = !isRecording;

        if (leftHand.menuPressed && barProgress > .3f)
        {
            return;

            barProgress = 0;
            menuActive  = !Menu.activeInHierarchy;
            Menu.SetActive(menuActive);
            //PointerScript.Toggle(a);
            playButton.enabled        = menuActive;
            recordingProgress.enabled = menuActive;
        }

        if (leftHand.padPressed && !isRecording && holdingRecording && !menuActive && barProgress / audioRecording.length > .25f)
        {
            barProgress = 0;
            playbackDevice.playbackWord = playbackWord;
            playbackDevice.PlaySound(audioRecording);
            if (playbackWord != null)
            {
                knownWordManager.wordBalloon(speaker, playbackWord);
            }
            knownWordManager.particles(speaker);
        }
    }