Esempio n. 1
0
    // Assign random attributes
    public void Randomise()
    {
        Appearance.Randomise(false, false);
        Movement.LookDir = new Vector3(Random.Range(-1f, 1f), 0, Random.Range(-1f, 1f));

        charName    = AssetManager.instance.GetUniqueNpcName();
        age         = (CharacterAge)Random.Range(0, System.Enum.GetNames(typeof(CharacterAge)).Length);
        occupation  = (CharacterOccupation)Random.Range(0, System.Enum.GetNames(typeof(CharacterOccupation)).Length - 1); // -1 to not include politician
        wealth      = (CharacterWealth)Random.Range(0, System.Enum.GetNames(typeof(CharacterWealth)).Length);
        disposition = Random.Range(40, 60);

        // If poor then high chance of wearing rags and fingerless gloves
        if (wealth == CharacterWealth.Poor && Random.value > 0.2f)
        {
            Appearance.hands = 2;
            Appearance.body  = 3;
        }
        if (occupation == CharacterOccupation.Monk)
        {
            // Monk hairstyle
            Appearance.hair = 2;
            Appearance.hat  = 0;
        }
        if (occupation == CharacterOccupation.Knight)
        {
            // Helmet and armour
            Appearance.hat  = 5;
            Appearance.body = 2;
            Appearance.hair = 0; // Bald head so hair doesn't clip through helmet
        }

        // Randomise colours AFTER setting body parts so it picks colours from the new palettes
        Appearance.RandomiseColours();
        Appearance.ApplyAll();
    }
Esempio n. 2
0
 public string GetRandomFlattery(CharacterOccupation occupation)
 {
     if (_flatteryOccupation.ContainsKey(occupation))
     {
         return(_flatteryOccupation.GetValue(occupation).RandomText);
     }
     return("");
 }
Esempio n. 3
0
 public string GetRandomThreaten(CharacterOccupation occupation)
 {
     if (_threatenOccupation.ContainsKey(occupation))
     {
         return(_threatenOccupation.GetValue(occupation).RandomText);
     }
     return("");
 }
Esempio n. 4
0
    public string GetRandomThreaten(NPC npc, bool correct)
    {
        float occupationCount = System.Enum.GetNames(typeof(CharacterOccupation)).Length;
        float ageCount        = 2; // only old and young, not middle-aged
        float wealthCount     = 2; // only rich and poor, not average
        float totalCount      = occupationCount + ageCount + wealthCount;

        float rVal = Random.value;

        // Picks wealth (there are no lines for average age and wealth so default to occupation for those)
        if (rVal < wealthCount / totalCount && npc.wealth != CharacterWealth.GettingBy)
        {
            // Pick the NPCs if correct, otherwise pick the other age (average wealth doesn't reach here)
            if (correct)
            {
                return(GetRandomThreaten(npc.wealth));
            }
            else
            {
                return(GetRandomThreaten(npc.wealth == CharacterWealth.Poor ? CharacterWealth.Rich : CharacterWealth.Poor));
            }
        }
        // Picks age
        else if (rVal < (wealthCount + ageCount) / totalCount && npc.age != CharacterAge.MiddleAged)
        {
            // Pick the NPCs if correct, otherwise pick the other age (middle aged doesn't reach here)
            if (correct)
            {
                return(GetRandomThreaten(npc.age));
            }
            else
            {
                return(GetRandomThreaten(npc.age == CharacterAge.Youthful ? CharacterAge.Elderly : CharacterAge.Youthful));
            }
        }
        // Picks occupation
        else
        {
            CharacterOccupation occupation = npc.occupation;
            if (!correct)
            {
                // Keep picking an occupation that isn't the same as the NPCs
                do
                {
                    occupation = (CharacterOccupation)Random.Range(0, occupationCount);
                }while(occupation == npc.occupation);
            }
            return(GetRandomThreaten(occupation));
        }
    }