Ejemplo n.º 1
0
    private void NextDialogue()
    {
        if (dialogueBase.ghostLines[dialogueIndex].nextText > 0)
        {
            dialogueIndex = dialogueBase.ghostLines[dialogueIndex].nextText;
        }

        GhostLine ghostLine = dialogueBase.ghostLines[dialogueIndex];

        audioSource.PlayOneShot(textSFX);
        audioSource.PlayOneShot(textSFX);
        audioSource.PlayOneShot(textSFX);
        if (ghostLine.multiChoices.Length > 0)
        {
            //TODO: Show Stats Update
            state = BattleState.MultiChoice;
            StartCoroutine(TypeDialogue(BattleState.MultiChoice, ghostLine.text));
            playerHud.OpenMulti();
            playerHud.UpdateChoice(ghostLine.multiChoices);
        }
        else
        {
            if (ghostLine.nextText == -1 && ghostLine.end == true)
            {
                StartCoroutine(TypeDialogue(BattleState.Bonus, ghostLine.text));
            }
            else
            {
                StartCoroutine(TypeDialogue(BattleState.GhostDialogue, ghostLine.text));
            }
        }
    }
Ejemplo n.º 2
0
        public void BasicCompletionTest()
        {
            // arrange
            var origin = new GhostLine <int>();

            var doubler = new GhostLine <int>();

            origin.AddConsumer(doubler);

            origin.AddWorkUnit(5);
            origin.AddWorkUnit(6);
            origin.AddWorkUnit(7);
            origin.AddWorkUnit(8);

            bool completed = false;

            origin.ProcessCompleted += (o, e) =>
            {
                Console.WriteLine("Origin completed.");
                completed = true;
            };

            // Act
            origin.Begin();
            origin.CompleteAdding();

            Thread.Sleep(3000);

            // Assert
            Debug.Assert(completed == true);
        }
Ejemplo n.º 3
0
        public void BasicComputationTest()
        {
            // arrange
            var origin = new GhostLine <int>();

            origin.Process = w =>
            {
                return(w);
            };

            var doubler = new GhostLine <int>();

            origin.AddConsumer(doubler);

            origin.AddWorkUnit(5);
            origin.AddWorkUnit(6);
            origin.AddWorkUnit(7);
            origin.AddWorkUnit(8);

            var outputList = new List <int>();

            doubler.Process = w =>
            {
                int x = w * 2;
                outputList.Add(x);
                return(x);
            };

            // Act
            origin.Begin();
            origin.CompleteAdding();

            Thread.Sleep(10000);

            bool success = (outputList.Any(ol => ol == 10) &&
                            outputList.Any(ol => ol == 12) &&
                            outputList.Any(ol => ol == 14) &&
                            outputList.Any(ol => ol == 16));

            // Assert
            Debug.Assert(success);
        }