コード例 #1
0
ファイル: EmmaMainScript.cs プロジェクト: martinezpierre/Emma
    void Update()
    {
        if (textDelay || choiceHandler.choicesShown || gameEnded)
        {
            return;
        }

        bool input = false;

        foreach (KeyCode kC in Options.Instance.nextSentenceInput)
        {
            if (Input.GetKeyDown(kC))
            {
                input = true;
            }
        }

        if (input && canClick)
        {
            if (histo.historicShown)
            {
                histo.CloseHistoric();
            }
            else if (!textWriter.isWriting)
            {
                if (myList [count].choices.Count > 0)
                {
                    choiceHandler.DisplayChoices(myList [count]);
                    return;
                }

                if (!myList [count].isSMS)
                {
                    currentSprites = imageHandler.CheckImagesAfterSentence(currentSprites);
                }

                if (imageHandler.canInterupt)
                {
                    UpdateIndex();
                }
            }
            else
            {
                textWriter.FinishText();
            }
        }
        else if (Input.GetAxis("Mouse ScrollWheel") > 0 && !histo.historicShown && canShowHistoric)
        {
            histo.ShowHistoric();
        }
        else
        {
            input = false;

            foreach (KeyCode kC in Options.Instance.openMenuInput)
            {
                if (Input.GetKeyDown(kC))
                {
                    input = true;
                }
            }
            if (input)
            {
                if (pauseMenu.menuShown)
                {
                    ClosePauseMenu();
                }
                else
                {
                    ShowPauseMenu();
                }
            }
        }
    }
コード例 #2
0
    public void HandleNode(EventNode node)
    {
        currentNode = node;

        if (node.GetType() == typeof(ImageNode))
        {
            imageHandler.DisplayImage((ImageNode)node);
        }
        else if (node.GetType() == typeof(TextNode))
        {
            textWriter.WriteText((TextNode)node);
            soundHandler.PlayVoice((TextNode)node);
        }
        else if (node.GetType() == typeof(LucidityAddNode))
        {
            int currentLucidity = PlayerPrefs.GetInt("Lucidity");
            PlayerPrefs.SetInt("Lucidity", currentLucidity + ((LucidityAddNode)node).amount);
        }
        else if (node.GetType() == typeof(SetVariableNode))
        {
            int currentLucidity = 0;

            string variable = ((SetVariableNode)node).variableName;

            if (((SetVariableNode)node).incrementation)
            {
                currentLucidity = PlayerPrefs.GetInt(variable);
            }

            PlayerPrefs.SetInt(variable, currentLucidity + ((SetVariableNode)node).amount);
        }
        else if (node.GetType() == typeof(WaitNode))
        {
            StartCoroutine(StartWait(((WaitNode)node).delay));
        }
        else if (node.GetType() == typeof(FadeNode))
        {
            if (((FadeNode)node).startFade)
            {
                fader.StartFade((FadeNode)node);
            }
            else
            {
                fader.StopFade((FadeNode)node);
            }
        }
        else if (node.GetType() == typeof(ChoiceNode))
        {
            choiceHandler.DisplayChoices((ChoiceNode)node);
        }
        else if (node.GetType() == typeof(DestroyNode))
        {
            if (((DestroyNode)node).isImage)
            {
                imageHandler.DestroyImage(((DestroyNode)node).toDestroyName);
            }
            else
            {
                imageHandler.DestroyObject(((DestroyNode)node).toDestroyName);
            }
        }
        else if (node.GetType() == typeof(ConditionNode))
        {
            EvaluateCondition((ConditionNode)node);
        }
        else if (node.GetType() == typeof(AnimationNode))
        {
            imageHandler.AnimateImage((AnimationNode)node);
        }
        else if (node.GetType() == typeof(PlaySoundNode))
        {
            soundHandler.PlaySound((PlaySoundNode)node);
        }
        else if (node.GetType() == typeof(StopSoundNode))
        {
            soundHandler.StopSound((StopSoundNode)node);
        }
        else if (node.GetType() == typeof(GameObjectNode))
        {
            imageHandler.InstantiateObject((GameObjectNode)node);
        }
    }