Пример #1
0
 void OnEnable()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #2
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #3
0
        private void internal_generatePhrases()
        {
            if (lastGeneratedPhrases == null)
            {
                lastGeneratedPhrases = new Dictionary <string, string>();
            }
            lastGeneratedPhrases.Clear();
            lastGeneratedPhrases.Add("Doctor0", "How does that make you feel? Who wants to continue?");
            lastGeneratedPhrases.Add("Doctor1", "How are you feeling right now? Who's next?");
            lastGeneratedPhrases.Add("Doctor2", "What feelings does that bring up? Who wants to elaborate?");
            lastGeneratedPhrases.Add("Doctor3", "How does that make you feel? Who wants to elaborate?");
            lastGeneratedPhrases.Add("Doctor4", "How are you feeling right now? Who wants to continue?");
            lastGeneratedPhrases.Add("Doctor5", "What feelings does that bring up? Who's next?");
            lastGeneratedPhrases.Add("DoctorStart", "Hello, let's start. Who wants to go first?");
            lastGeneratedPhrases.Add("DoctorEnd", "That's all the time we have today. See you next week.");
            var           details   = SessionLogic.GetSessionDetails();
            List <string> tempVerbs = new List <string>();

            tempVerbs.AddRange(verbs);
            for (int i = 0; i < details.roundCount; ++i)
            {
                string line = "";
                if (i > 0)
                {
                    line = string.Format(feelingStrings[Random.Range(0, feelingStrings.Length)], emotions[Random.Range(0, emotions.Length)]) + " ";
                }
                string verb1       = verbs[Random.Range(0, verbs.Length)];
                string accusationM = null;
                string accusationF = null;
                if (verb1.StartsWith("is"))
                {
                    int firstSpace = verb1.IndexOf(" ");
                    accusationM = line + string.Format("He is {0}{1}", Random.Range(0, 100) > 50 ? "always" : "never", verb1.Substring(firstSpace));
                    accusationF = line + string.Format("She is {0}{1}", Random.Range(0, 100) > 50 ? "always" : "never", verb1.Substring(firstSpace));
                }
                else
                {
                    accusationM = line + string.Format("He {0} {1}", Random.Range(0, 100) > 50 ? "always" : "never", verb1);
                    accusationF = line + string.Format("She {0} {1}", Random.Range(0, 100) > 50 ? "always" : "never", verb1);
                }
                lastGeneratedPhrases.Add("lineM" + i, accusationM);
                lastGeneratedPhrases.Add("lineF" + i, accusationF);
                lastGeneratedPhrases.Add("lineD" + i, "Honk honk, hunk. Honk! Honk?");
            }
            foreach (var line in lastGeneratedPhrases)
            {
                Debug.Log("Generated: " + line.Key + " -> " + line.Value);
            }
        }
Пример #4
0
 private IEnumerator HandleQuestionButtonClick(int index)
 {
     leftPlayButton.GetComponent<Animator>().SetTrigger("disappear");
     rightPlayButton.GetComponent<Animator>().SetTrigger("disappear");
     bool correct = SessionLogic.HandleSelection(index);
     if (correct)
     {
         if (index == 0)
         {
             leftCharacter.EmitLove();
         }
         else
         {
             rightCharacter.EmitLove();
         }
     }
     if (index == 0) leftCharacter.Talk = true;
     else if (index == 1) rightCharacter.Talk = true;
     SessionLogic.PersonType type = SessionLogic.GetPersonType(index);
     if (type == SessionLogic.PersonType.Male)
         yield return new WaitForSeconds(MaleClientSpeechWaitTime);
     else
         yield return new WaitForSeconds(FemaleClientSpeechWaitTime);
     if (index == 0) leftCharacter.Talk = false;
     else if (index == 1) rightCharacter.Talk = false;
     if (SessionLogic.HasSessionEnded())
     {
         StartCoroutine(ChangeState(GameState.PlaySessionEnded));
     }
     else
     {
         yield return new WaitForSeconds(1);
         WindowsVoice.getInstance().speak("You", SessionLogic.GetDoctorPrefix(), PhraseGenerator.getDoctorPhrase());
         yield return new WaitForSeconds(DoctorSpeechWaitTime);
         leftPlayButton.GetComponent<Animator>().SetTrigger("appear");
         rightPlayButton.GetComponent<Animator>().SetTrigger("appear");
         yield return new WaitForSeconds(0.5f);
     }
 }
Пример #5
0
        private IEnumerator ChangeState(GameState targetState)
        {
            switch (targetState)
            {
                case GameState.Started:
                    {
                        SessionLogic.InitSession();
                        PhraseGenerator.generatePhrases();
                        var parent = leftCharacter.transform.parent;


                        GameObject tempLeft;
                        GameObject tempRight;
                        var leftTrans = leftCharacter.transform;
                        var rightTrans = rightCharacter.transform;
                        if (SessionLogic.GetPersonType(0) == SessionLogic.PersonType.Male)
                        {
                            tempLeft = GameObject.Instantiate(malePrefab, leftTrans.position, leftTrans.rotation, parent);
                            tempLeft.transform.localScale = new Vector3(tempLeft.transform.localScale.x * -1, tempLeft.transform.localScale.y, tempLeft.transform.localScale.z);
                        }
                        else
                            tempLeft = GameObject.Instantiate(femalePrefab, leftTrans.position, leftTrans.rotation, parent);
                        if (SessionLogic.GetPersonType(1) == SessionLogic.PersonType.Male)
                            tempRight = GameObject.Instantiate(malePrefab, rightTrans.position, rightTrans.rotation, parent);
                        else
                        {
                            tempRight = GameObject.Instantiate(femalePrefab, rightTrans.position, rightTrans.rotation, parent);
                            tempRight.transform.localScale = new Vector3(tempRight.transform.localScale.x * -1, tempRight.transform.localScale.y, tempRight.transform.localScale.z);
                        }
                        Destroy(leftCharacter.gameObject);
                        Destroy(rightCharacter.gameObject);
                        yield return null;
                        leftCharacter = tempLeft.GetComponent<CharacterControllerGGJ>();
                        rightCharacter = tempRight.GetComponent<CharacterControllerGGJ>();
                        leftPlayButton = leftCharacter.playButton;
                        rightPlayButton = rightCharacter.playButton;
                        leftCharacter.index = 0;
                        rightCharacter.index = 1;
                        if (leftCharacter == null || rightCharacter == null)
                            Debug.Log("no component");

                        cameraController.FadeInCamera();
                        yield return new WaitForSeconds(1);
                        gameState = targetState;
                        break;
                    }
                case GameState.StartPlaySession:
                    {
                        gameState = GameState.PlaySessionStarted;
                        WindowsVoice.getInstance().speak("You", SessionLogic.GetDoctorPrefix(), PhraseGenerator.getPhrase("DoctorStart"));
                        yield return new WaitForSeconds(DoctorSpeechWaitTime);
                        leftPlayButton.GetComponent<Animator>().SetTrigger("appear");
                        rightPlayButton.GetComponent<Animator>().SetTrigger("appear");
                        gameState = GameState.PlaySessionRunning;
                        break;
                    }
                case GameState.PlaySessionEnded:
                    {
                        WindowsVoice.getInstance().speak("You", SessionLogic.GetDoctorPrefix(), PhraseGenerator.getPhrase("DoctorEnd"));
                        yield return new WaitForSeconds(DoctorSpeechWaitTime);
                        cameraController.FadeOutCamera();
                        yield return new WaitForSeconds(1);
                        playButton.SetActive(true);
                        subtitle.text = "";
                        gameState = targetState;
                        break;
                    }
                default:
                    break;
            }
        }