Example #1
0
 public DialogBlurb(string text, DialogState from, DialogState to, DialogBlurb dependentOnLine, Character character)
 {
     m_text            = text;
     m_from            = from;
     m_to              = to;
     m_dependentOnLine = dependentOnLine;
     m_said            = false;
     m_character       = character;
 }
Example #2
0
    private IEnumerator PlayGame()
    {
        InitDialog();
        m_boxes    = new List <GameObject>();
        saidBlurbs = new List <string>();
        int  month   = 10;
        int  day     = 24;
        int  year    = 2016;
        int  hour    = 4;
        int  minutes = 26;
        bool endgame = false;

        while (!(endgame))
        {
            minutes += 1 + Random.Range(2, 10);

            if (minutes > 59)
            {
                hour++;
                minutes = minutes % 59;
            }

            if (hour > 12)
            {
                hour = hour % 12;
                day++;
            }

            if (day > 30)
            {
                day = day % 30;
                month++;
            }

            if (month > 12)
            {
                month = month % 12;
                year++;
            }


            GameObject go_newDialogBox = GameObject.Instantiate(mp_dialogBox, m_spawnLocation.transform.position, m_spawnLocation.transform.rotation, m_gameCanvas.transform) as GameObject;

            DialogBlurb nextBlurb = null;
            while (nextBlurb == null)
            {
                int breakup   = 0;
                int loss      = 0;
                int academics = 0;

                foreach (Character c in m_characters)
                {
                    if (c.m_curState == DialogBlurb.DialogState.Loss)
                    {
                        loss++;
                    }
                    else if (c.m_curState == DialogBlurb.DialogState.Breakup)
                    {
                        breakup++;
                    }
                    else if (c.m_curState == DialogBlurb.DialogState.Academics)
                    {
                        academics++;
                    }
                }

                if (breakup == 4 || loss == 4 || academics == 4)
                {
                    nextBlurb = (new DialogBlurb("Hey guys I'm back.", DialogBlurb.DialogState.Any, DialogBlurb.DialogState.Any, null, m_characters[0]));
                    endgame   = true;
                }
                else
                {
                    nextBlurb = GetNextLineOfDialog();
                }

                yield return(new WaitForEndOfFrame());
            }

            go_newDialogBox.GetComponent <DialogLine>().Setup(nextBlurb, "" + hour + ":" + minutes);


            if (m_boxes.Count == 4)
            {
                m_boxes[0].GetComponent <DialogLine>().SetTarget(m_offscreen);
                m_boxes.Remove(m_boxes[0]);
            }

            m_boxes.Add(go_newDialogBox);

            m_boxes[0].GetComponent <DialogLine>().SetTarget(m_top);

            for (int i = 1; i < m_boxes.Count; i++)
            {
                m_boxes[i].GetComponent <DialogLine>().SetTarget(m_boxes[i - 1].GetComponent <DialogLine>().Target);
            }


            yield return(new WaitForSeconds(5.0f));
        }
    }