예제 #1
0
        public void AddingDialoguesIncreasesDialogueCount()
        {
            var mgr = new DialogueManager();

            mgr.AddDialogue("New Dialogue 1");
            Assert.AreEqual(mgr.NumDialogues, 1);

            mgr.AddDialogue("New Dialogue 2");
            Assert.AreEqual(mgr.NumDialogues, 2);
        }
예제 #2
0
        public void RemovingDialoguesDecreasesDialogueCount()
        {
            var mgr = new DialogueManager();

            mgr.AddDialogue("New Dialogue 1");
            mgr.AddDialogue("New Dialogue 2");

            mgr.RemoveDialogue("New Dialogue 1");
            Assert.AreEqual(mgr.NumDialogues, 1);

            mgr.RemoveDialogue("New Dialogue 2");
            Assert.AreEqual(mgr.NumDialogues, 0);
        }
예제 #3
0
 protected override void ChangeState(Personality newPersonality)
 {
     if (GameManager.currentScene == 0)
     {
         base.ChangeState(newPersonality);
         if (newPersonality == Personality.FIND)
         {
             countStates++;
             if (countStates == 2)
             {
                 DialogueManager.AddDialogue(Personality.FIND, new string[] { "Oh no..", "I can't let the other personalities take over.. ", "I must continue.." });
             }
         }
         else if (newPersonality == Personality.ATTACK)
         {
             if (firstAttack)
             {
                 DialogueManager.AddDialogue(Personality.ATTACK, new string[] { "I will protect us..", "If anyone comes close to us..", "I will kill them!" });
                 firstAttack = false;
             }
         }
     }
     else
     {
         base.ChangeState(newPersonality);
     }
 }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     topLeft       = new Vector2(-boundWidth / 2, boundsHeight / 2);
     spawnDistance = 5f;
     SpawnBounds();
     SpawnObstacles();
     SpawnCharacters();
     SpawnEnemies();
     SpawnTraps();
     Time.timeScale = 0f;
     dm.AddDialogue("It's past sunset. You are lost deep in the woods and begin to hear strange noises.");
     dm.AddDialogue("You have to find your friends and get out of this forest.");
     dm.AddDialogue("All you have is this silly hand crank flashlight...         \nYou can just about keep it going on low power.         \nHigh drains it in less than a second.");
     dm.AddDialogue("Better find your friends quick and make it out of this forest.");
     dialogueStart = true;
 }
예제 #5
0
 public void MyTestInitialize()
 {
     _mgr    = new DialogueManager();
     _dlg    = _mgr.AddDialogue(_dlgName);
     _part   = _dlg.AddParticipant(_partName);
     _entry1 = _dlg.AddEntry(_part, entryContent1);
     _entry2 = _dlg.AddEntry(_part, entryContent2);
 }
예제 #6
0
    public void ContinueStory()
    {
        GetComponent <GameManager>().winScreen.SetActive(false);
        DialogueManager dialogueManager = FindObjectOfType <DialogueManager>();

        dialogueManager.AddDialogue("Good News: Two days later, your neighbor was found gobbled up by a rock.");
        dialogueManager.AddDialogueToQueue("It turns out that Tim was hungry for revenge and decided to eat your neighbor! O Tim!");
        StartCoroutine(MainMenu());
    }
예제 #7
0
        public void CanGetDialogueByName()
        {
            var mgr = new DialogueManager();

            var addedDlg = mgr.AddDialogue("A Name");

            var retrievedDlg = mgr.Dialogue("A Name");

            Assert.AreEqual(addedDlg, retrievedDlg);
        }
예제 #8
0
        public void RetrievingNonExistantDialogueReturnsNull()
        {
            var mgr = new DialogueManager();

            mgr.AddDialogue("A Name");

            var dlgName = mgr.Dialogue("Not A Name");

            Assert.IsNull(dlgName);
        }
예제 #9
0
            public void Execute()
            {
                var dlg = _mgr.AddDialogue(_dialogueName);

                if (_addedItem == null)
                {
                    _addedItem = new DialogueViewModel(_cmdExec, dlg);
                }
                _dlgItems.Add(_addedItem);
            }
예제 #10
0
            public void Undo()
            {
                if (_index < 0 || _removedItem == null)
                {
                    Debug.Assert(false);
                    return;
                }

                _mgr.AddDialogue(_removedItem._dialogue);
                _model.DlgItems.Insert(_index, _removedItem);
            }
예제 #11
0
 public static void StartDialogue()
 {
     Debug.Log("Add Dialogue");
     if (currentScene == 0)
     {
         DialogueManager.AddDialogue(Personality.FIND, new string[] { "I must get to the golden cookies.. ", "I have to hurry!" });
     }
     else if (currentScene == 1)
     {
         DialogueManager.AddDialogue(Personality.FIND, new string[] { "So many people are after my cookies...", "I have to hurry!" });
         DialogueManager.AddDialogue(Personality.ATTACK, new string[] { "No one will harm us..", "I will keep us safe!" });
     }
     else if (currentScene == 2)
     {
         DialogueManager.AddDialogue(Personality.SOCIALIZE, new string[] { "Are these my friends..?", "Maybe I can share my cookies with them!" });
     }
 }
예제 #12
0
    IEnumerator DialogueCoroutine(Dialogue d, string colorString = "")
    {
        dialogueManager.SetColor(colorString);
        dialogueManager.ClearDialogue();
        dialogueManager.AddDialogue(d);

        gameState = GameState.CUTSCENE;



        dialogueManager.DisplayNextSentence();

        yield return(dialogueManager.WaitForCaughtUpTextAndInput());

        gameState = GameState.OVERWORLD;

        dialogueManager.SetDisplay(false);
    }
예제 #13
0
 private void onAddCallback(ReorderableList l)
 {
     DManager.AddDialogue();
 }
예제 #14
0
 public void MyTestInitialize()
 {
     _mgr  = new DialogueManager();
     _dlg  = _mgr.AddDialogue(_dlgName);
     _part = _dlg.AddParticipant(_partName);
 }
예제 #15
0
 public void MyTestInitialize()
 {
     _mgr = new DialogueManager();
     _dlg = _mgr.AddDialogue(_dlgName);
 }
예제 #16
0
    public IEnumerator SingleAttack(Pokemon attacker, Pokemon defender, MoveInSet moveInSet)
    {
        float accuracyCheck = Random.Range(0, 100f);

        MoveData move = moveInSet.move;

        dialogueManager.AddDialogue(attacker.GetName() + " used " + move.name + "!");

        yield return(StartCoroutine(dialogueManager.WaitForCaughtUpText()));

        if (move.accuracy > 0 && accuracyCheck > move.accuracy)
        {
            yield return(StartCoroutine(dialogueManager.WaitForCaughtUpTextAndInput()));

            dialogueManager.AddDialogue("But it missed!");
            yield break;
        }

        float level = attacker.level;
        float power = move.basePower;

        float ratingMultiplier;
        float burn;

        if (move.isSpecial)
        {
            burn             = 1.0f;
            ratingMultiplier = (float)attacker.specialAttack / defender.specialDefense;
        }
        else
        {
            burn             = attacker.status.Equals(Status.BURN) ? .5f : 1.0f;
            ratingMultiplier = (float)attacker.attack / defender.defense;
        }

        float targets = 1.0f;
        float weather = 1.0f;
        float badge   = 1.0f;

        float criticalChance = 1f / 16.0f;

        bool criticalHappened = Random.Range(0f, 1f) < criticalChance;

        float critical = (criticalHappened? 2.0f : 1.0f);

        float randomVariation = Random.Range(.85f, 1.0f);

        float STAB = (attacker.IsType(move.type) ? 1.5f : 1.0f);

        float typeEffectiveness = PokemonTypeData.Effectiveness(move.type, defender);

        float other = 1.0f;

        float modifier = targets * weather * badge * critical * randomVariation * STAB * typeEffectiveness * burn * other;

        int damage = Mathf.CeilToInt((2f + ((2f + (2f * level) / 5f) * power * ratingMultiplier) / 50f) * modifier);

        if (damage <= 0)
        {
            yield return(StartCoroutine(dialogueManager.WaitForCaughtUpTextAndInput()));

            dialogueManager.AddDialogue("It didn't effect " + defender.GetName() + "...");
            yield break;
        }


        defender.ModHP(-damage);
        yield return(StartCoroutine(WaitForBarsToLoad()));

        if (criticalHappened)
        {
            yield return(StartCoroutine(dialogueManager.WaitForCaughtUpTextAndInput())); dialogueManager.AddDialogue("Critical hit!");
        }
        if (typeEffectiveness > 1.0f)
        {
            yield return(StartCoroutine(dialogueManager.WaitForCaughtUpTextAndInput())); dialogueManager.AddDialogue("It was super effective!");
        }
        if (typeEffectiveness < 1.0f)
        {
            yield return(StartCoroutine(dialogueManager.WaitForCaughtUpTextAndInput())); dialogueManager.AddDialogue("It wasn't very effective...");
        }


        dialogueManager.DisplayNextSentence();
    }