Exemplo n.º 1
0
        public Shishi(string name, string textureName, Vector3 position, Vector2 size) : base(name, textureName, position, size)
        {
            PortraitSize = new Vector2(674.181f, 822.543f); // Size(224.727f, 274.181f) * 3

            DialoguePiece d = new DialoguePiece(10, new List <string>()
            {
                "Magic be damned! A Dori!",
                "Ahem.. I mean.. Greetings, friend.",
                "What brings you to the slopes of Avash?"
            });

            List <DialoguePiece> dialogues = new List <DialoguePiece>();

            dialogues.Add(d);

            Dialogues = dialogues;

            IsFacingRight     = true;
            InteractionOffset = new Vector2(-80, 250);

            //"X": 224.727,
            //"Y": 274.181
            CollisionBox = new Transform(
                X + 82,
                Y + 124,
                Z,
                60,
                150
                );

            VelocityX         = _horizontalVelocity;
            StartingVelocityY = _verticalVelocity;
        }
 void UpdateUI()
 {
     currentPiece           = dialogue.pieces[pieceIndex];
     characterSprite.sprite = currentPiece.character.sprite;
     nameText.text          = currentPiece.character.name;
     nameText.color         = currentPiece.character.textColor;
     lineText.color         = currentPiece.character.textColor;
     foreach (RawImage rImage in panelImages)
     {
         rImage.color = currentPiece.character.bgColor;
     }
 }
Exemplo n.º 3
0
    private IEnumerator ScrollingText(DialoguePiece dialoguePiece, float delay)
    {
        nameText.text     = dialoguePiece.characterName;
        dialogueIsTyping  = true;
        dialogueText.text = "";
        int currChar = 0;

        while (dialogueIsTyping && currChar < dialoguePiece.text.Length)
        {
            dialogueText.text += dialoguePiece.text[currChar];
            currChar++;
            yield return(new WaitForSecondsRealtime(delay));
        }
        dialogueText.text = dialoguePiece.text;
        dialogueIsTyping  = false;
        yield return(null);
    }
Exemplo n.º 4
0
    public DialoguePiece getDialogueForTags(List <string> tags)
    {
        List <string> desiredTags         = new List <string>();
        DialoguePiece bestMatch           = null;
        int           nearnessOfBestMatch = Int32.MaxValue;

        desiredTags.AddRange(tags);
        foreach (DialoguePiece piece in this.pieces)
        {
            if (piece.speaker.givenName == this.charactersPresent[selectedPartner].givenName)
            {
                if (piece.matchesExactly(desiredTags))
                {
                    return(piece);
                }
                else if (piece.matchesPartially(desiredTags) > 0)
                {
                    bestMatch = piece.matchesPartially(desiredTags) < nearnessOfBestMatch ? piece : bestMatch;
                }
            }
        }
        return(bestMatch);
    }
Exemplo n.º 5
0
    public List <DialoguePiece> ParseText(TextAsset rawFile)
    {
        List <DialoguePiece> dialogue = new List <DialoguePiece>();

        string[] lines = Regex.Split(rawFile.text, "\r\n|\n|\r");
        foreach (string line in lines)
        {
            string trimmedLine = line.Trim();
            trimmedLine = Regex.Replace(trimmedLine, @"#.*", "");
            if (trimmedLine.Trim() == string.Empty)
            {
                continue;
            }

            // separate name and text to say. Currently used | to separate name and text, and == to set sprite portrait
            // TODO: add error checking for when some idiot writes the file wrong.
            // TODO: choices in dialogue.
            string[]      pieces = trimmedLine.Split('|');
            DialoguePiece dp     = new DialoguePiece();
            dp.text = FixLongLines(pieces[1]);
            if (pieces[0].Contains("=="))
            {
                string[] nameAndPortrait = Regex.Split(pieces[0], "==");
                dp.characterName      = nameAndPortrait[0];
                dp.portraitSpriteName = nameAndPortrait[1];
            }
            else
            {
                dp.characterName      = pieces[0];
                dp.portraitSpriteName = "";
            }
            dialogue.Add(dp);
        }

        return(dialogue);
    }
Exemplo n.º 6
0
 public void registerDialogue(DialoguePiece piece)
 {
     this.pieces.Add(piece);
 }
Exemplo n.º 7
0
 public DialoguePiece addResponse(DialoguePiece response)
 {
     this.responses.Add(response);
     return(this);
 }