示例#1
0
    // Runs one of the optional commands
    public override IEnumerator RunCommand(Yarn.Command command)
    {
        // Since we're not using any commands for this demo, this coroutine is empty

        // Ends a coroutine. Required if you're not returning an IEnumerator elsewhere
        yield break;
    }
示例#2
0
    /// Run an internal command.
    public override IEnumerator RunCommand(Yarn.Command command)
    {
        // "Perform" the command
        Debug.Log("Command: " + command.text);

        yield break;
    }
示例#3
0
 public override System.Collections.IEnumerator RunCommand(Yarn.Command command)
 {
     if (commandHandler != null)
     {
         commandHandler(command);
     }
     yield break;
 }
    /// Runs a command.
    /// <inheritdoc/>
    public override Dialogue.HandlerExecutionType RunCommand(Yarn.Command command, System.Action onCommandComplete)
    {
        // Dispatch this command via the 'On Command' handler.
        onCommand?.Invoke(command.Text);

        // Signal to the DialogueRunner that it should continue
        // executing. (This implementation of RunCommand always signals
        // that execution should continue, and never calls
        // onCommandComplete.)
        return(Dialogue.HandlerExecutionType.ContinueExecution);
    }
示例#5
0
    /// Run an internal command.
    public override IEnumerator RunCommand(Yarn.Command command)
    {
        // "Perform" the command
        Debug.Log("Command: " + command.text);

        // if (command.text == "jump")
        // {
        //     player.GetComponent<Rigidbody2D>().AddForce(new Vector2(0, 300));
        // }



        yield break;
    }
示例#6
0
    /// Run an internal command.
    public override IEnumerator RunCommand(Yarn.Command command)
    {
        // "Perform" the command
        // dialogueRunner.?
        // command.
        Debug.Log("Command: " + command.text);

        if (command.text.Contains("end"))
#if UNITY_EDITOR
        { UnityEditor.EditorApplication.isPlaying = false; }
#else
        { Application.Quit(); }
#endif

        yield break;
    }
示例#7
0
 public CommandResult(string text)
 {
     var command = new Command();
     command.text = text;
     this.command = command;
 }
示例#8
0
    public override IEnumerator RunCommand(Yarn.Command command)
    {
        string[] commandSplit = command.text.Split(' ');

        if (commandSplit[0] == "hideui")
        {
            dialogueUIFrame.SetActive(false);
            yield return(null);
        }
        else if (commandSplit[0] == "wait")
        {
            float seconds = 0.0f;
            float.TryParse(commandSplit[1], out seconds);
            yield return(new WaitForSeconds(seconds));
        }
        else if (command.text == "protag_passed_out_eyes_closed")
        {
            player.AnimatePassedOut();
            yield return(null);
        }
        else if (command.text == "protag_passed_out_eyes_open")
        {
            player.AnimatePassedOutEyesOpen();
            yield return(null);
        }
        else if (command.text == "protag_idle")
        {
            player.AnimateIdle();
            yield return(null);
        }
        else if (command.text == "protag_still")
        {
            player.AnimateStill();
            yield return(null);
        }
        else if (command.text == "protag_smoke")
        {
            Debug.Log("dialogue says to smoke");
            player.AnimateSmoking();
            yield return(null);
        }
        else if (command.text == "protag_vom")
        {
            yield return(player.AnimateVom());
        }
        else if (command.text == "logan_put_out_cig")
        {
            yield return(logan.AnimatePutOutCig());
        }
        else if (command.text == "logan_pull_out_gun")
        {
            yield return(logan.AnimatePullOutGun());
        }
        else if (command.text == "loop")
        {
            dialogueUIFrame.SetActive(false);
            runner.Stop();
            yield return(gameCoordinator.ShootAndLoop());
        }
        else if (command.text == "win")
        {
            dialogueUIFrame.SetActive(false);
            runner.Stop();
            yield return(gameCoordinator.Win());
        }
    }
示例#9
0
    /// Run an internal command.
    public override IEnumerator RunCommand(Yarn.Command command)
    {
        // "Perform" the command
        //Debug.Log("Command: " + command.text);
        //Debug.Log("listenToJordy Variable: " + Choices.listenedToJordy);
        if (command.text.StartsWith("setscene") && inBrainRoom)
        {
            if (command.text == "setscene Dryve")
            {
                EventManager.TriggerEvent("ExitBrainRoom");
                cameraTransition.ZoomOut();
            }
            else
            {
                EventManager.TriggerEvent("ExitBrainRoomQuick");
            }
            inBrainRoom = false;
        }
        switch (command.text)
        {
        case "setscene innerDateCut":
            EventManager.TriggerEvent("EnterBrainRoomQuick");
            cameraTransition.ToggleBrainRoomCut();
            inBrainRoom = true;
            break;

        case "setscene innerDate":
            EventManager.TriggerEvent("EnterBrainRoom");
            cameraTransition.ZoomIn();
            inBrainRoom = true;
            break;

        case "setScene nextScene":
            sceneHandler.LoadNextScene();
            break;

        case "setscene 06_Ending_SecondDate":
            sceneHandler.LoadScene("06_Ending_SecondDate");
            break;

        case "setscene 07_Ending_Jordy":
            if (Choices.listenedToJordy)
            {
                sceneHandler.LoadScene("07_Ending_Jordy");
            }
            else
            {
                sceneHandler.LoadScene("08_Ending_Alone");
            }
            break;

        case "setscene 08_Ending_Alone":
            sceneHandler.LoadScene("08_Ending_Alone");
            break;

        case "listenToJordy":
            Choices.listenedToJordy = true;
            break;

        case "setscene 09_Credits":
            StartCoroutine(RollCredits());
            break;

        default:
            inBrainRoom = false;
            break;
        }
        yield break;
    }
    public override IEnumerator RunCommand(Yarn.Command command)
    {
        /*
         * Running the custom commands made for the textbox system, like those that
         * define what is in a textbox.
         */

        switch (command.text)
        {
        case "Textbox":
            // clear the text to show so it can be read
            //Debug.Log("At start of a textbox!");
            readingDialogue = true;
            textToShow      = new StringBuilder();
            CreateTextbox();
            break;

        case "/Textbox":
            // its time to display the text read up to this point
            //Debug.Log(this.name + ": At end of a textbox!");
            dialogueRunner.paused = true;
            readingDialogue       = false;
            GetTextDisplayed();
            break;
        }

        string imageName;

        // The following can't be handled with a switch statement, so...
        string commandText     = command.text.ToLower();
        bool   textboxCommand  = commandText.Contains("textbox");
        bool   nameCommand     = commandText.Contains("name|");
        bool   portraitCommand = commandText.Contains("portrait|");
        bool   nameTagCommand  = commandText.Contains("nametag|");

        if (nameCommand)
        {
            // for reading in nametags
            if (textboxController.nameTag != null)
            {
                nameTagText = command.text.Remove(0, "name|".Length);
            }
            else
            {
                throw new System.InvalidOperationException(this.name + ": Tried to set nametag text for a textbox with no name tag!");
            }
        }

        else if (portraitCommand)
        {
            // for choosing which portrait to show
            imageName = command.text.Remove(0, "portrait|".Length);

            if (textboxController.portrait != null)
            {
                portrait = Resources.Load <Sprite> ("Graphics/Portraits/" + imageName);
            }
            else
            {
                throw new System.InvalidOperationException(this.name + ": Tried to set a portrait for a textbox with no portrait!");
            }
        }
        else if (nameTagCommand)
        {
            float xPos = 0;

            TextboxNametag nameTag = textboxController.nameTag;

            if (commandText.Contains("rightedge"))
            {
                xPos  = textboxController.box.rectTransform.RightEdgeX();
                xPos -= nameTag.rectTransform.rect.width / 2;
            }

            else if (commandText.Contains("leftedge"))
            {
                xPos  = textboxController.box.rectTransform.LeftEdgeX();
                xPos += nameTag.rectTransform.rect.width / 2;
            }

            Vector3 newPos = nameTag.rectTransform.position;
            newPos.x = xPos;
            nameTag.rectTransform.position = newPos;
        }

        bool someUnaccountedCommand = !textboxCommand && !nameCommand && !portraitCommand;

        if (someUnaccountedCommand)
        {
            Debug.LogWarning("Unaccounted command: " + command.text);
        }

        yield return(null);
    }
 public override IEnumerator RunCommand(Yarn.Command command)
 {
     yield return(null);
 }