Example #1
0
 void Start()
 {
     fullLine = "";
     readLine = "";
     //Input.
     androidState = new AndroidUpset(this);
     androidState.Enter();
     AndroidStatus.AddTalkingElement(starting_element);
 }
Example #2
0
    public override void Update()
    {
        if (gameRef.currentTalkingElement == null)
        {
            //Add interjection?
            if (was_interjection == false && UnityEngine.Random.Range(0, 1.0f) > 0.5f)
            {
                List <RegularTalkingPoint> possibilities = new List <RegularTalkingPoint>();

                foreach (RegularTalkingPoint rtp in gameRef.interjections)
                {
                    if (AndroidStatus.happiness >= rtp.happiness_min && AndroidStatus.happiness <= rtp.happiness_max)
                    {
                        possibilities.Add(rtp);
                    }
                }

                if (possibilities.Count == 0)
                {
                    possibilities.AddRange(gameRef.interjections);
                    Debug.LogWarning("No matching");
                }

                RegularTalkingPoint chosen = possibilities[UnityEngine.Random.Range(0, possibilities.Count)];

                AndroidStatus.AddTalkingElement(chosen);
                was_interjection = true;
            }
            else
            {
                Question[] source = gameRef.questions;

                if (gameRef.game_sequence == Gameplay.GameSequence.Livingroom)
                {
                    if (gameRef.livingroom_questions.Length > 0)
                    {
                        source = gameRef.livingroom_questions;
                    }
                }
                if (gameRef.game_sequence == Gameplay.GameSequence.Balcony)
                {
                    if (gameRef.balcony_questions.Length > 0)
                    {
                        source = gameRef.balcony_questions;
                    }
                }
                if (gameRef.game_sequence == Gameplay.GameSequence.Bedroom)
                {
                    if (gameRef.bedroom_questions.Length > 0)
                    {
                        source = gameRef.bedroom_questions;
                    }
                }

                List <Question> possibilities = new List <Question>();
                foreach (Question q in source)
                {
                    if (AndroidStatus.happiness >= q.happiness_min && AndroidStatus.happiness <= q.happiness_max)
                    {
                        if (q != prev_question)
                        {
                            possibilities.Add(q);
                        }
                    }
                }

                if (possibilities.Count == 0)
                {
                    possibilities.AddRange(gameRef.questions);
                }

                Debug.Log("Possible " + possibilities.Count);

                Question chosen = possibilities[UnityEngine.Random.Range(0, possibilities.Count)];
                AndroidStatus.AddTalkingElement(chosen);
                prev_question    = chosen;
                was_interjection = false;
            }
        }
    }