// Use this for initialization
 void Start()
 {
     if (transform.name.EndsWith("Default") || transform.name.StartsWith("Character"))
     {
         isCharacterButton = true;
     }
     if (manager == null)
     {
         if (isCharacterButton)
         {
             manager = transform.parent.parent.GetComponentInChildren <DialogueManagerScript> ();
         }
         else
         {
             manager = transform.GetComponentInParent <DialogueManagerScript> ();
         }
     }
     scrollRectTransform = manager.transform.parent.GetComponent <RectTransform>();
     scrollScrollRect    = scrollRectTransform.transform.GetComponent <DragOverrideScript> ();
     dialogue            = transform.GetComponentInParent <DialogueEntryScript> ();
     rt    = dialogue.transform.GetComponent <RectTransform>();
     dMPos = 0;
     //entries = new List<DialogueEntryScript> ();
     entries = manager.entries;
     UpdateEntryList();
     drag = false;
 }
    // This Method is to communicate to the Dialogue Manager, telling it to start dialogue using the dialogue script attached to the NPC
    public void TriggerDialogue()
    {
        DialogueManagerScript.DialogueMiddleman(this.gameObject);
        dia = DialogueManagerScript.dia;

        StartCoroutine(DisplayDialogue());
    }
 private void Awake()
 {
     if (DialogueManagerInstance == null)
     {
         DialogueManagerInstance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
    private void display_node(DialogueNode node)
    {
        if (GameObject.Find("CharacterPortrait"))           //Early Testing, will probalby be changed later so that more than one portrait can be in a scene at once
        {
            Destroy(GameObject.Find("CharacterPortrait"));
        }

        StartCoroutine(TypeSentence(node.Text));

        option_1.SetActive(false);
        option_2.SetActive(false);
        option_3.SetActive(false);
        Debug.Log("options:" + node.Options.Count);

        if (node.stateChangeValue != -1)
        {
            DialogueManagerScript.DialogueStateChangeManager(this.gameObject, node.stateChangeValue);
        }


        if (node.portraitID > 0)
        {
            DialogueManagerScript.SetDialoguePortrait(this.gameObject, node.portraitID);
        }

        if (node.Options.Count != 0)
        {
            for (int i = 0; i < node.Options.Count; i++)
            {
                switch (i)
                {
                case 0:
                    set_option_button(option_1, node.Options[i]);
                    break;

                case 1:
                    set_option_button(option_2, node.Options[i]);
                    break;

                case 2:
                    set_option_button(option_3, node.Options[i]);
                    break;
                }
            }
        }
        else
        {
            tempNextNode = node;
            noOptions    = true;
        }
    }
    //private DataScript ds;

    void Start()
    {
        //ds = GameObject.Find("GaudyBG").GetComponent<DataScript>();
        //Debug.Log(ds.firstName);
        dms = transform.parent.parent.GetComponentInChildren <DialogueManagerScript> ();

        if (isMainCharacter)
        {
            if (transform.Find("CharacterNameValue"))
            {
                if (this.name == "PlayerEntryDefault")
                {
                    transform.Find("CharacterNameValue").GetComponent <TextMeshProUGUI>().text = "Provider";
                }
                else if (this.name == "InstructorEntryDefault")
                {
                    transform.Find("CharacterNameValue").GetComponent <TextMeshProUGUI>().text = "Instructor";
                }
                else if (this.name.StartsWith("Character "))
                {
                    //we set the name when adding the character, so this shouldn't be necessary, but it's an option
                    //transform.Find("CharacterNameValue").GetComponent<Text>().text = this.name;
                }

                else if (GlobalData.firstName == "" && GlobalData.lastName == "")
                {
                    transform.Find("CharacterNameValue").GetComponent <TextMeshProUGUI>().text = "Patient";
                }

                else
                {
                    if (GlobalData.firstName == "")
                    {
                        //transform.Find("CharacterNameValue").GetComponent<Text>().text = ds.lastName;
                        transform.Find("CharacterNameValue").GetComponent <TextMeshProUGUI>().text = "Patient";
                    }

                    else
                    {
                        //transform.Find("CharacterNameValue").GetComponent<Text>().text = ds.firstName + " " + ds.lastName;
                        transform.Find("CharacterNameValue").GetComponent <TextMeshProUGUI>().text = "Patient";
                    }
                }
            }
            //transform.Find("CharacterNameValue").GetComponent<Text>().text = "Patient";
        }
    }
Beispiel #6
0
    public void SetWriterColor(string characterName)
    {
        DialogueManagerScript manager = GetComponentInParent <DialogueManagerScript>();
        Transform             name;

        print(characterName);
        for (int i = 0; i < manager.characterParent.childCount; i++)
        {
            if ((name = manager.characterParent.GetChild(i).Find("CharacterNameValue")) && name.GetComponent <TextMeshProUGUI>().text.Equals(characterName))
            {
                charColor = manager.characterParent.GetChild(i).Find("CharacterImage").GetComponent <Image>().color;
                GetComponentInChildren <Image>().color = charColor;
                print(charColor.ToString());
                break;
            }
        }
    }
Beispiel #7
0
    /**
     * Removes the specified object
     */
    public void ApprovedRemove(GameObject obj)
    {
        DialogueManagerScript dms = null;
        Transform             t   = transform;

        while (t != null && t.parent.GetComponent <DialogueManagerScript> () == null)
        {
            t = t.parent;
        }
        if (t == null)
        {
            return;
        }
        else
        {
            dms = t.parent.GetComponent <DialogueManagerScript> ();
        }

        dms.RemoveDialogue(obj);
    }
 // Use this for initialization
 void Start()
 {
     dmScript = GameObject.Find("DialogueManager").GetComponent <DialogueManagerScript> ();
 }
 // Use this for initialization
 void Start()
 {
     dmScript = GameObject.Find ("DialogueManager").GetComponent<DialogueManagerScript> ();
 }
Beispiel #10
0
    public Approaches myApproach = Approaches.na;     // initialize an approach

    private void Start()
    {
        me    = this;      // singleton
        timer = interval;  // set timer
    }