public int VisitCharacterExpression(CharacterExpression ast, Frame frame)
        {
            var valSize = ast.Type.Visit(this, null);

            _emitter.Emit(OpCode.LOADL, (short)ast.CharacterLiteral.Value);
            return(valSize);
        }
        public int VisitCharacterExpression(CharacterExpression ast, Frame frame)
        {
            int valSize = ast.Type.Visit(this, null);

            emitter.Emit(OpCode.LOADL, ast.Value);
            return(valSize);
        }
Esempio n. 3
0
 public void changeExpression(CharacterExpression expression)
 {
     if (targetExpression != expression) // Don't play the animation if we're already on the correct expression.
     {
         targetExpression = expression;
         animator.SetTrigger("NormalExpression");
     }
 }
Esempio n. 4
0
 public void ShowDescription(string description, CharacterExpression expression = CharacterExpression.normal)
 {
     CharacterProp.Turn(-1);
     CharacterProp.startTalking();
     CharacterProp.changeExpression(expression);
     ItemDescriptionBubble.gameObject.SetActive(true);
     ItemDescriptionBubble.SetDialogueBubbleContent(description);
     ItemDescriptionBubble.Show();
     Debug.Log(description);
 }
Esempio n. 5
0
 public CutsceneScriptLine(
     CutsceneAction action,
     CutsceneBackground background  = CutsceneBackground.None,
     CutsceneSide side              = CutsceneSide.Left,
     CutsceneCharacter character    = null,
     CharacterExpression expression = CharacterExpression.Default,
     string dialogue = "")
 {
     this.action     = action;
     this.background = background;
     this.side       = side;
     this.character  = character;
     this.expression = expression;
     this.dialogue   = dialogue;
 }
Esempio n. 6
0
    public void setCharacterPortrait(CharacterExpression expr)
    {
        Sprite portrait = currentCharacter.getCharacterPortrait(expr.ToString());

        if (characterImage == null)
        {
            characterImage = GameObject.Find("CharacterImage");
        }
        if (portrait != null && portrait != characterImage.GetComponent <Image>().sprite)
        {
            characterImage.GetComponent <Image>().sprite = portrait;
            characterImage.GetComponent <Animator>().ResetTrigger("swappedState");
            characterImage.GetComponent <Animator>().SetTrigger("swappedState");
        }
    }
Esempio n. 7
0
    public void updateText()
    {
        string targetText = currDialogue[currIndex].text;

        reshuffle(currDialogue[currIndex].options);
        Option[] options = currDialogue[currIndex].options;

        if (currDialogue[currIndex].state == null)
        {
            dialogueUI.setState(CharacterExpression.Default);
        }
        else
        {
            CharacterExpression expr = (CharacterExpression)System.Enum.Parse(typeof(CharacterExpression), currDialogue[currIndex].state);
            dialogueUI.setState(expr);
        }

        StartCoroutine(dialogueUI.updateTextUI(targetText, options));
    }
Esempio n. 8
0
 private void Start()
 {
     name                             = Roll.RandomName();
     gameObject.name                  = name;
     traits                           = new CharacterTraits().Initialize((list) => dbTraits = list);
     expression                       = new CharacterExpression().Initialize(
         (skill) => dbSkills          = skill,
         (preference) => dbPreference = preference
         );
     attraction = new CharacterAttraction().Initialize((identity, attraction) =>
     {
         dbidentity   = identity;
         dbAttraction = attraction;
     });
     relationships        = new CharacterRelationships().Initialize(
         (list) => dbBond = list
         );
     placement = new CharacterPlacement().Initialize(this);
     GameManager.RegisterCharacter(this);
 }
Esempio n. 9
0
 public TypeDenoter VisitCharacterExpression(CharacterExpression ast, Void arg)
 {
     ast.Type = StandardEnvironment.CharType;
     return(ast.Type);
 }
 public void changeExpression(CharacterExpression expression)
 {
     expressionAnimator?.changeExpression(expression);
 }
Esempio n. 11
0
 public void setState(CharacterExpression state)
 {
     GameObject.Find("InteractUIManager").GetComponent <InteractUIManager>().setCharacterPortrait(state);
 }
Esempio n. 12
0
 public void setExpression(CharacterExpression expression)
 {
     currentExpression = expressions[(int)(expression)];
 }
Esempio n. 13
0
    public static List <ScriptLine> CreateDialogueComponents(string text, List <DialogueInstruction> AvailableInstructions = null)
    {
        if (!initialized)
        {
            throw new Exception("InitializeGenerators not yet called");
        }

        List <string> rawLines = new List <string>(text.Split('\n'));

        rawLines = rawLines.Select(x => x.Trim()).ToList();
        rawLines = rawLines.Where(x => x != "").ToList();

        List <ScriptLine> processedLines = new List <ScriptLine>();

        string currentSpeaker     = "";
        int    speakingLineNumber = 0;
        Dictionary <string, ScriptLine> labeledLines = new Dictionary <string, ScriptLine>();

        for (int i = 0; i < rawLines.Count; i++)
        {
            ScriptLine processedLine = null;

            string line = rawLines[i];

            // Dealing with commented out lines
            if (line.StartsWith("//"))
            {
                continue;
            }

            // Checking if the line is valid based on what the game says
            // This is mainly used to filter out statements which should appear/not appear based on the game
            List <string> conditions = GetConditions(line);
            if (!IsLineValid(conditions))
            {
                continue;
            }
            line = RemoveConditions(line);

            // processing current speaker
            string speaker = GetSpeaker(line);
            if (speaker != "")
            {
                currentSpeaker = speaker;
            }
            else if (currentSpeaker == "")
            {
                Debug.LogWarning("Speaker not specified");
            }
            line = RemoveSpeaker(line);

            // processing jump statements
            string jump = GetJump(line);
            line = RemoveJump(line);

            // processing labels
            string label = GetLabel(line);
            line = RemoveLabel(line);

            switch (GetLineType(line))
            {
            case LineType.SpeakingLine:
                processedLine = GenerateSpeakingLine(currentSpeaker, GetSpokenLine(line), speakingLineNumber);
                break;

            case LineType.Expression:
                CharacterExpression desiredExpression = GetExpression(line);
                processedLine = GenerateExperssionLine(currentSpeaker, desiredExpression);
                break;

            case LineType.Choice:
                List <ChoiceLineContent> choices = GetChoices(line, currentSpeaker, speakingLineNumber);
                processedLine = GenerateChoiceLine(currentSpeaker, choices);
                break;

            case LineType.Instruction:
                if (AvailableInstructions != null)
                {
                    line = GetInstructionName(line);
                    DialogueInstruction instruction = AvailableInstructions.Find(x => x.name == line);
                    if (instruction != null)
                    {
                        processedLine = GenerateInstructionLine(instruction);
                    }
                    else
                    {
                        throw new Exception(string.Format("Instruction with name '{0}' not found", line));
                    }
                }
                else
                {
                    throw new Exception("No instructions provided");
                }
                break;

            case LineType.Stall:
                float time = GetStallTime(line);
                processedLine = GenerateStallLine(time);
                break;
            }

            //Redundant hacky coding
            processedLine.speaker = currentSpeaker;

            // adding label to our repository of labels
            if (!string.IsNullOrEmpty(jump))
            {
                processedLine.jumpLabel = jump;
            }

            // adding label to our repository of labels
            if (!string.IsNullOrEmpty(label))
            {
                labeledLines.Add(label, processedLine);
                processedLine.lineLabel  = label;
                processedLine.lineNumber = speakingLineNumber;
            }

            processedLines.Add(processedLine);
            speakingLineNumber++;
        }

        // final scrub through of processed lines to set up proper routing to tags
        for (int i = 0; i < processedLines.Count; i++)
        {
            ScriptLine processedLine = processedLines[i];

            switch (processedLine.GetLineType())
            {
            case LineType.SpeakingLine:
            case LineType.Expression:
                if (!string.IsNullOrEmpty(processedLine.jumpLabel))
                {
                    try
                    {
                        processedLine.nextLine = labeledLines[processedLine.jumpLabel];
                    }
                    catch (Exception e)
                    {
                        Debug.Log(processedLine.jumpLabel);
                        throw e;
                    }
                }
                break;

            case LineType.Choice:
                ((ChoiceLine)processedLine).InitJumps(labeledLines);
                break;
            }
        }
        return(processedLines);
    }
Esempio n. 14
0
 public ExpressionLine(string speaker, CharacterExpression expression)
 {
     this.speaker      = speaker;
     desiredExpression = expression;
 }
Esempio n. 15
0
    public static ExpressionLine CreateInstructionLine(string speaker, CharacterExpression expression)
    {
        ExpressionLine line = new ExpressionLine(speaker, expression);

        return(line);
    }