示例#1
0
    void Update()
    {
        if (interactable)
        {
            if (Input.GetKeyUp("e"))
            {
                if (modalPanel.modalPanelObject.activeInHierarchy)
                {
                    modalPanel.ClosePanel();
                    GameInformation.PlayerControllable = true;

                    interactions++;
                    GameInformation.AddInteraction(this.gameObject.name, interactions);

                    SendMessage("ResetFacing");
                }
                else
                {
                    GameInformation.PlayerControllable = false;

                    SendMessage("FaceThePlayer");

                    ModalPanelDetails modalPanelDetails = new ModalPanelDetails();

                    string temp = DialogueData.LoadFromXML(dialogID);
                    modalPanelDetails.text = temp.Replace("PlayerName", GameInformation.PlayerName);

                    modalPanelDetails.title     = this.gameObject.name;
                    modalPanelDetails.iconImage = spriteRenderer.sprite;
                    modalPanel.NewChoice(modalPanelDetails);
                }
            }
        }
    }