Exemple #1
0
    public void UpdateFavoriteWares()
    {
        for (int i = 0; i < m_favoriteWares.Count; i++)
        {
            FavoriteWare fav = m_favoriteWares[i];
            bool         res = M_WaresManager.SIsWareProduced(fav.ware);

            if (res && !fav.active)
            {
                m_moodWares += fav.mood;
                fav.active   = true;
            }
            else if (!res && fav.active)
            {
                m_moodWares -= fav.mood;
                fav.active   = false;
            }
        }
    }
Exemple #2
0
    /// <summary> Creates a new settler </summary>
    /// <returns>Guid of a new settler</returns>
    public Guid CreateSettler(Guid houseId)
    {
        Settler settler = new Settler(houseId);

        settler.SetName(GetRandName());
        settler.SetPortrait(GetRandPortrait());

        List <FavoriteBuilding> favoriteBuildings = new List <FavoriteBuilding>();
        List <FavoriteWare>     favoriteWares     = new List <FavoriteWare>();
        int FAVORITE_BUILDINGS = 3;
        int FAVORITE_WARES     = 3;

        M_BuildingManager.SEnableUniqueRandomizing(FAVORITE_BUILDINGS);
        for (int i = 0; i < FAVORITE_BUILDINGS; i++)
        {
            FavoriteBuilding temp = new FavoriteBuilding();
            temp.maxMood         = 20;
            temp.buildingTemplId = M_BuildingManager.SGetRandProductionBuildingTempl();
            temp.active          = false;
            favoriteBuildings.Add(temp);
        }


        M_WaresManager.SEnableUniqueWareRandomizing(FAVORITE_WARES);
        for (int i = 0; i < FAVORITE_WARES; i++)
        {
            FavoriteWare temp = new FavoriteWare();
            temp.mood   = UnityEngine.Random.Range(10, 21);;
            temp.ware   = M_WaresManager.SGetRandWare();
            temp.active = false;
            favoriteWares.Add(temp);
        }

        settler.SetFavoriteBuildings(favoriteBuildings);
        settler.SetFavortiteWares(favoriteWares);


        m_settlers.Add(settler);
        Debug.Log("CreateSettler id: " + settler.GetId());
        return(settler.GetId());
    }