Exemplo n.º 1
0
 private void OnMouseOver()
 {
     if (Input.GetKeyDown(KeyCode.Mouse0))
     {
         TalkingPerson.SetCurrSpeakingPerson(Item.currSelectedItem);
     }
 }
 private void OnMouseOver()
 {
     if (Input.GetKeyDown(KeyCode.Mouse0))
     {
         _satchelScreen.GetComponent <SatchelScreen>().ChangeAfterPresentingNode(TalkingPerson.GetCurrSpeakingPerson().GetComponent <TalkingPerson>().GetSwitchNode());
         GameObject.Find("DialogueCanvasDecorated").GetComponent <DialogueBox>().Hide();
         GameObject.Find("DialogueSystemWright").GetComponent <DialogueSystemWright>().Hide();
         _satchelScreen.GetComponent <SatchelScreen>().SetPresentationMode(true);
     }
 }
    private void OnMouseOver()
    {
        if (GameObject.Find("SatchelBG").GetComponent <SatchelScreen>().CheckPresentationMode())
        {
            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                currSelectedItem = this.gameObject;

                if (TalkingPerson.GetCurrSpeakingPerson() != null)
                {
                    if (TalkingPerson.GetCurrSpeakingPerson().GetComponents <PresentablePerson>() != null)
                    {
                        bool foundMatch = false;
                        foreach (PresentablePerson p in TalkingPerson.GetCurrSpeakingPerson().GetComponents <PresentablePerson>())
                        {
                            if (p.CheckMatch())
                            {
                                foundMatch = true;
                            }
                        }

                        if (foundMatch == false)
                        {
                            GameObject.Find("DialogueCanvasDecorated").GetComponent <DialogueBox>().ChangeNode(12);
                            GameObject.Find("DialogueCanvasDecorated").GetComponent <DialogueBox>().Show();
                        }
                    }
                    GameObject.Find("SatchelBG").GetComponent <SatchelScreen>().SetPresentationMode(false);
                    GameObject.Find("DialogueCanvasDecorated").GetComponent <DialogueBox>().SetSwitchNode(TalkingPerson.GetCurrSpeakingPerson().GetComponent <TalkingPerson>().mySwitchNode);
                }
                else
                {
                }
            }
        }
    }
    public void ChangeNode(int nodeNum)
    {
        _currNode = nodeNum;
        MainText currNode = _nodeDictionary[_currNode];

        string myText = _nodeDictionary[_currNode].GetMainText();

        _canControlTextDisplay = false;

        if (UseItemManager.GetItemInUse() != null)
        {
            if (myText.Contains("INSERTOBJECTONE") && myText.Contains("INSERTOBJECTTWO"))
            {
                myText = myText.Replace("INSERTOBJECTONE", UseItemManager.GetItemInUse().name);
                myText = myText.Replace("INSERTOBJECTTWO", UseItemManager.GetApplicableItem().name);

                if (UseItemManager.GetApplicableItem().GetComponent <TalkingPerson>() != null)
                {
                    myText = " If you want to show an item to this person, try talking to them and PRESENTING it.";
                }

                UseItemManager.SetItemInUse(null);
                UseItemManager.SetApplicableItem(null);
            }
            else if (myText.Contains("INSERTOBJECTONE"))
            {
                myText = myText.Replace("INSERTOBJECTONE", UseItemManager.GetItemInUse().name);
            }
            else if (UseItemManager.GetApplicableItem() != null)
            {
                if (myText.Contains("INSERTOBJECTTWO"))
                {
                    myText = myText.Replace("INSERTOBJECTTWO", UseItemManager.GetApplicableItem().name);

                    if (UseItemManager.GetApplicableItem().GetComponent <TalkingPerson>() != null)
                    {
                        myText = " If you want to show an item to this person, try talking to them and PRESENTING it.";
                    }
                }
            }
        }
        else if (myText.Contains("CURRSELECTEDOBJECT"))
        {
            if (Item.currSelectedItem != null)
            {
                myText = myText.Replace("CURRSELECTEDOBJECT", Item.currSelectedItem.name);
            }
        }
        else if (myText.Contains("CURRTALKINGPERSON"))
        {
            if (TalkingPerson.GetCurrSpeakingPerson() != null)
            {
                myText = myText.Replace("CURRTALKINGPERSON", TalkingPerson.GetCurrSpeakingPerson().name);
            }
        }
        _displayText           = myText;
        _canControlTextDisplay = true;

        if (_nodeDictionary.ContainsKey(nodeNum))
        {
            string currSpeakingCharacter = currNode.GetCurrCharacter();

            if (currSpeakingCharacter.Equals("Kat") || currSpeakingCharacter.Equals("?") || GameObject.Find(currNode.GetCurrCharacter()) != null || currSpeakingCharacter == "Narrator")
            {
                if (GameObject.Find("EpisodeCanvas") != null)
                {
                    if (!_havingEpisode)
                    {
                        GameObject.Find("EpisodeCanvas").GetComponent <EpisodeCanvas>().StopEpisodeEffect();
                    }
                    else
                    {
                        GameObject.Find("EpisodeCanvas").GetComponent <EpisodeCanvas>().PlayEpisodeEffect();
                    }
                }

                Show();
                currNode.InvokeOnShownEvent();
            }
            else
            {
                Hide();
                print("!!!SPEAKING CHARACTER IS NOT IN THE SCENE");
            }

            if (GameObject.Find("AyandaImage") != null)
            {
                if (currSpeakingCharacter.Equals("Ayanda"))
                {
                    GameObject.Find("AyandaImage").GetComponent <Image>().enabled = true;
                }
                else
                {
                    GameObject.Find("AyandaImage").GetComponent <Image>().enabled = false;
                }
            }

            if (currNode.HasChoice())
            {
                int numChoices = currNode.GetChoiceList().Count;

                for (int i = 0; i < numChoices; i++)
                {
                    GameObject currChoice = Utilities.SearchChild("ChoiceButton" + i, this.gameObject);
                    ModifyChoice(i, currChoice, currNode);
                }

                //if (currChild.name.Equals("ChoiceButton0"))
                //{
                //    ModifyChoice(0, currChild, currNode);
                //}
                //else if (currChild.name.Equals("ChoiceButton1"))
                //{
                //    ModifyChoice(1, currChild, currNode);
                //}
                //else if (currChild.name.Equals("ChoiceButton2"))
                //{
                //    ModifyChoice(2, currChild, currNode);
                //}
            }

            foreach (GameObject currChild in _myChildren)
            {
                if (currChild.name.Equals("CurrentCharacterText"))
                {
                    currChild.GetComponent <Text>().text = currNode.GetCurrCharacter();
                }


                if (currChild.name.Equals("MainText"))
                {
                    currChild.GetComponent <Text>().text = "";
                    _displayMainText = true;
                    //    currChild.GetComponent<Text>().text = "";
                    //    string mainText = currChild.GetComponent<Text>().text;
                    //    string changeText = currNode.GetMainText();
                    //    foreach (char c in changeText.ToCharArray())
                    //    {
                    //        mainText += c.ToString();
                    //        currChild.GetComponent<Text>().text = mainText;
                    //    }

                    //    //currChild.GetComponent<Text>().text = currNode.GetMainText();
                }
            }
        }
    }