private void SetGoblinDialogue1_and_2()
    {
        //the victim
        victimName          = randomizedData.GetName();                         //randomly pick a name for victim
        uiScript.VictimName = victimName;                                       //tell InterfaceScript victim's name for updating intro screen

        //the living goblins
        foreach (GameObject goblinA in goblins)                                 //iterate through each goblin to set dialogue options 1 and 2
        {
            //SET FEELINGS ABOUT VICTIM AND FIRST DIALOGUE OPTION
            GoblinData goblinData = goblinA.GetComponent <GoblinData>();                                    //ref to current goblin's goblinData script instance
            string     feeling    = "neutral";                                                              //create var to store feeling
            if (!goblinData.isMurderer)                                                                     //if current goblin is not the murderer
            {
                feeling = randomizedData.GetFeeling();                                                      //get random feeling about victim
            }
            else
            {
                feeling = "hate";                                                                               //if current goblin is the murderer, set their feeling about victim to hate
            }

            goblinData.victimFeelings = feeling;

            string dialogue = randomizedData.GetEmotionalDialogue(feeling, victimName);                     //generate current goblin's dialogue about victim
            goblinData.victimDialogue = dialogue;                                                           //set current goblin's dialogue about victim


            //Set feelings
            List <GameObject> otherGoblins = new List <GameObject>();                                   //create list of other goblins
            otherGoblins.AddRange(goblins);                                                             //add all goblins to the list
            Dictionary <string, string> otherFeels = new Dictionary <string, string>();                 //create temp dictionary to store names and associated feelings for other goblins
            foreach (GameObject g in otherGoblins)                                                      //for each OTHER goblin
            {
                string otherName = g.GetComponent <GoblinData>().goblinName;                            //get other goblin's name (goblin B)
                if (otherName != goblinData.goblinName)                                                 //if other goblin's name is not the same as current goblin's name...
                {
                    string otherFeeling = randomizedData.GetFeeling();                                  //get random feeling

                    otherFeels.Add(otherName, otherFeeling);                                            //set name and feeling in temp dict
                }
            }
            goblinData.goblinFeelings = otherFeels;                                                             //set current goblin's feelings dictionary to match the one we just created

            Dictionary <string, string> Dialogue2 = new Dictionary <string, string>();                          //create temp dictionary to store names and dialogue for Dialogue Option 2
            foreach (KeyValuePair <string, string> pair in goblinData.goblinFeelings)                           //for every entry we just added (other goblins)
            {
                //CHOOSE FOR #2
                string newDialogue2 = randomizedData.GetEmotionalDialogue(pair.Value, pair.Key);                //get random 2nd dialogue for emotion for that specific other goblin
                Dialogue2.Add(pair.Key, newDialogue2);                                                          //add it to temp Dictionary
            }
            goblinData.goblinDialogue2 = Dialogue2;                                                             //set current Goblin's dialogues for Dialogue #2
        }
    }
    private void SetVictimDialogue()
    {
        foreach (GameObject goblin in goblins)
        {
            GoblinData goblinData = goblin.GetComponent <GoblinData>();                                                         //ref to current goblin's goblinData script instance

            string feeling = randomizedData.GetFeeling();                                                                       //set current goblin's feeling about victim
            goblinData.victimFeelings = feeling;

            string dialogue = randomizedData.GetEmotionalDialogue(feeling, victimName);                         //set current goblin's dialogue about victim
            goblinData.victimDialogue = dialogue;
        }
    }
    private void SetGoblinDialogue3()
    {
        foreach (GameObject goblinA in goblins)                                                 //for each goblin (A) in the array
        {
            GoblinData A = goblinA.GetComponent <GoblinData>();
            Dictionary <string, string> SpokenFeels = new Dictionary <string, string>();            //temp dict to store spoken feels, possible lies.
            Dictionary <string, string> Dialogue3   = new Dictionary <string, string>();            //create temp dictionary to store names and dialogue for Dialogue Option 2

            foreach (GameObject goblinB in goblins)                                                 //for each goblin (B) in the array
            {
                GoblinData B = goblinB.GetComponent <GoblinData>();
                if (goblinA.GetInstanceID() != goblinB.GetInstanceID())                                 //if A and B are not the same Goblin
                {
                    string aName = A.goblinName;
                    bName   = B.goblinName;                                 //set global goblin info variables to prepare to get string
                    bWeapon = B.weapon;

                    //FOR TESTING ONLY
                    string newFeel = "UNSET FIX THIS";
                    newFeel = GetTrueFeel(bName);
                    //get variables
                    //bool aIsMurderer = aData.isMurderer;
                    //bool aKnowsMurderer = aData.knowsMurderer;
                    //bool bIsMurderer = goblinB.GetComponent<GoblinData>().isMurderer;

                    //PUT THE COMPLEX FORMULA HERE
                    if (A.isMurderer)                                               //if Goblin A is the murderer...
                    {
                        if (A.goblinFeelings[bName] == "hate")                      //...and A hates B...
                        {
                            int odds = Random.Range(0, 100);
                            if (odds <= 25)
                            {
                                newFeel = "hate";                                                       //...%25 chance to lie - Goblin B hated the victim
                            }
                            else if (odds > 25 && odds <= 50)
                            {
                                newFeel = "murdered";                                                   //...%25 chance to lie - Goblin B murdered victim
                            }
                            else
                            {
                                newFeel = GetTrueFeel(bName);                                           //...%50 chance to tell Goblin B's true feelings about victim
                            }
                        }
                        else                                                                //...and A neutrals/loves B...
                        {
                            newFeel = GetTrueFeel(bName);                                   //...tells the truth.
                        }
                    }
                    else                                                            //If Goblin A is NOT the murderer...
                    {
                        if (B.isMurderer)                                           //... but B IS the murderer...
                        {
                            if (A.knowsMurderer)                                    //...and A knows it...
                            {
                                if (A.goblinFeelings[bName] == "love")              //...and A loves B...
                                {
                                    int odds = Random.Range(0, 100);
                                    if (odds <= 25)
                                    {
                                        newFeel = "love";                                                               //...25% chance to lie - Goblin B loved the victim.
                                    }
                                    else if (odds > 25 && odds <= 50)
                                    {
                                        newFeel = "hate";                                                               //...25% chance to tell truth about feeling.
                                    }
                                    else if (odds > 50 && odds <= 75)
                                    {
                                        newFeel = "neutral";                                                            //...25% chance to lie - Goblin B felt neutral about victim.
                                    }
                                    else
                                    {
                                        newFeel = "murdered";                                                           //...25% chance to admit Goblin B murdered victim.
                                    }
                                }
                                else                                                                        //...and A neutrals/hates B...
                                {
                                    newFeel = GetTrueFeel(bName);                                           //...A tells the truth.
                                }
                            }
                            else                                                                    //...and A doesn't know B is the murderer...
                            {
                                newFeel = GetTrueFeel(bName);                                       //...A tells the truth.
                            }
                        }
                        else                                                                     //...and B is also NOT the murderer...
                        {
                            if ((A.knowsMurderer) && (A.goblinFeelings[murdererName] == "love")) //...and A knows who the murderer is and loves them
                            {
                                if (A.goblinFeelings[bName] == "hate")                           //...and A hates B...
                                {
                                    int odds = Random.Range(0, 100);
                                    if (odds <= 50)                                                                                         //...50% chance to frame B for murder
                                    {
                                        newFeel = "murdered";
                                    }
                                }
                            }
                        }
                    }



                    //TESTING - gets true feeling
                    string newDialogue3 = getD3(newFeel);
                    SpokenFeels.Add(bName, newFeel);
                    Dialogue3.Add(bName, newDialogue3);                                                     //add new name / dialogue to temp dictionary
                }
            }
            A.spokenFeelings  = SpokenFeels;
            A.goblinDialogue3 = Dialogue3;
        }
    }
Beispiel #4
0
 /// <summary>
 /// Обрабатывает сохраненные данные
 /// </summary>
 /// <param name="goblinData">Сохраненные данные</param>
 public void ApplyData(GoblinData goblinData)
 {
     Level    = goblinData.Level;
     Health   = goblinData.Health;
     Manapool = goblinData.Manapool;
 }