Esempio n. 1
0
    void HideCurrentFlowchart()
    {
        if (currentFlowchart != null)
        {
            currentFlowchart.GetComponent <Flowchart>().StopAllBlocks();
            currentFlowchart.GetComponent <Flowchart>().StopAllCoroutines();
        }

        // hide any possible menus of our own
        Transform playerSayTransform = transform.FindChild("Dialogues/Player_SayDialog");

        if (playerSayTransform != null)
        {
            playerSayTransform.gameObject.SetActive(false);
        }

        Transform playerMenuTransform = transform.FindChild("Dialogues/Player_MenuDialog");

        if (playerMenuTransform != null)
        {
            GameObject playerMenu = playerMenuTransform.gameObject;

            if (playerMenu != null)
            {
                if (ChildIsActive(playerMenu, "TimeoutSlider"))
                {
                    SetActive(playerMenu, "TimeoutSlider", false);
                }
                if (ChildIsActive(playerMenu, "ButtonGroup/OptionButton0"))
                {
                    SetActive(playerMenu, "ButtonGroup/OptionButton0", false);
                }
                if (ChildIsActive(playerMenu, "ButtonGroup/OptionButton1"))
                {
                    SetActive(playerMenu, "ButtonGroup/OptionButton1", false);
                }
                if (ChildIsActive(playerMenu, "ButtonGroup/OptionButton2"))
                {
                    SetActive(playerMenu, "ButtonGroup/OptionButton2", false);
                }
                if (ChildIsActive(playerMenu, "ButtonGroup/OptionButton3"))
                {
                    SetActive(playerMenu, "ButtonGroup/OptionButton3", false);
                }
                if (ChildIsActive(playerMenu, "ButtonGroup/OptionButton4"))
                {
                    SetActive(playerMenu, "ButtonGroup/OptionButton4", false);
                }
                if (ChildIsActive(playerMenu, "ButtonGroup/OptionButton5"))
                {
                    SetActive(playerMenu, "ButtonGroup/OptionButton5", false);
                }
                if (playerMenu.activeInHierarchy)
                {
                    playerMenu.SetActive(false);
                }
            }
        }
    }
        /// <summary>
        /// Starts the flowchart.
        /// </summary>
        /// <param name="other">The other GameObject we're dialoguing with.</param>

        void StartFlowchart(GameObject other)
        {
            // find this flowchart in this character
            Flowchart flowchart = GetFlowchart(other.gameObject);

            // if we found this persona's flowchart
            if (flowchart != null)
            {
                // remember who we're interacting with
                currentInterlocutor = other;
                // remember which flowchart we're interacting with
                currentFlowchart = flowchart;
                //                // start this specific flowchart
                //                flowchart.SendFungusMessage("DialogEnter");
                // check to see if there's an InteractionEnter event waiting for us
                Handler_InteractionEnter interactionEnterEvent = currentFlowchart.GetComponent<Handler_InteractionEnter>();
                // did we find it?
                if (interactionEnterEvent != null)
                {
                    interactionEnterEvent.ExecuteBlock();
                }
                // Started a dialog using this flowchart
                StartedDialogue(flowchart);
            }

        }