Exemplo n.º 1
0
    public IEnumerator initialisingCitizen()
    {
        yield return(new WaitForSeconds(0.1f));

        // GAMEMANAGER AND ID
        citizenID = gameManager.getCitizenCatalog().getAmountOfCitizens();
        gameManager.getCitizenCatalog().addCitizenToAllCitizens(this);

        // GENDER
        List <string> genders = new List <string> {
            "Male", "Female"
        };

        gender = genders[Random.Range(0, genders.Count)];

        // NAME
        List <string> maleFirstNames = new List <string> {
            "Hans", "Peter", "Ole", "Leonard", "Fredrik", "Markus", "Chad", "Rick", "Morty", "Erlend", "James", "Bertil"
        };
        List <string> femaleFirstNames = new List <string> {
            "Siri", "Grete", "Karen", "Martha", "Marte", "Monica"
        };
        List <string> lastNames = new List <string> {
            "Hansen", "Peterson", "Trump", "Opsal", "Taklo", "Berge", "Iversen", "Jakobsen", "Storeide", "Gaard", "Fiska", "Bush"
        };

        if (gender == "Male")
        {
            citizenFirstName = maleFirstNames[Random.Range(0, maleFirstNames.Count)];
        }
        else
        {
            citizenFirstName = femaleFirstNames[Random.Range(0, femaleFirstNames.Count)];
        }
        citizenLastName = lastNames[Random.Range(0, lastNames.Count)];
        transform.name  = citizenFirstName + " " + citizenLastName + " " + citizenID;

        // AGE
        age = Random.Range(16, 60);

        // SKILLS
        skills = GetComponent <Skills>();

        // PERKS
        perks = GetComponent <PerkCatalog>();

        // INVENTORY
        inventory = transform.GetComponent <Inventory>();

        // MODIFIERS
        health    = 100;
        hunger    = 100;
        thirst    = 100;
        happiness = 100;

        // MOVEMENTSPEED
        movementSpeed      = Random.Range(5, 12);
        citizenAgent.speed = movementSpeed;

        // STATUS
        status = null;

        // TOWN ALLIEGENCE AND LORD ALLIEGENCE
        if (home == null)
        {
            townAlliegence = null;
        }
        else
        {
            if (home.getTownBuildingIsApartOf())
            {
                townAlliegence = home.getTownBuildingIsApartOf();
            }
        }
        if (townAlliegence)
        {
            citizensLord = townAlliegence.getTownOwner();
        }
        else
        {
            citizensLord = null;
        }

        // WEALTH
        wealth = Random.Range(0, 100);

        // POSITION
        position = transform.position;

        // ADD ITEMS TO INVENTORY

        /*Dictionary<string,int> listOfItems = new Dictionary<string, int>{
         * {"Wood plank", 99},
         * {"Stone", 99},
         * {"Wood log", 99},
         * {"Iron ore", 99}
         * };
         * foreach(var item in listOfItems){
         *  getCitizenInventory().addItemToInventory(item.Key, item.Value);
         * }*/


        relatives = null;

        initalizedCitizen = true;
    }