Exemple #1
0
    public Resources_Player(ProfileSettings profile,
                            Resources_Building home,
                            int money,
                            int income,
                            int expenses,
                            int strength,
                            int presence,
                            int opinion,
                            Resources_Inventory inventory)
        : base(profile.id,
               profile.name,
               profile.image,
               profile.gender,
               home,
               money,
               income,
               expenses,
               strength,
               inventory)
    {
        _presence = presence;
        _opinion  = opinion;
        instance  = this;

        Manager_Resources.NewPlayer(this);
    }
Exemple #2
0
    public Resources_Building(string id,
                              string name,
                              string image,
                              Enums.BuildingType type,
                              int money,
                              int income,
                              int expenses,
                              int rent,
                              int payment,
                              Enums.DayOfTheWeek day,
                              Resources_InventoryShop inventory)
        : base(id,
               name,
               image,
               money,
               income,
               expenses)
    {
        _type      = type;
        _payment   = payment;
        _day       = day;
        _type      = type;
        _inventory = inventory;

        Manager_Resources.NewBuilding(this);
    }
 public Resources_Shopkeeper(string id,
                             string name,
                             string image,
                             Enums.Gender gender,
                             Resources_Building home,
                             int money,
                             int income,
                             int expenses,
                             int strength,
                             int respect,
                             int fear,
                             int greed,
                             int integrity,
                             int stubbornness,
                             Enums.Personality personality,
                             Resources_Inventory inventory)
     : base(id,
            name,
            image,
            gender,
            home,
            money,
            income,
            expenses,
            strength,
            respect,
            fear,
            greed,
            integrity,
            stubbornness,
            personality,
            inventory)
 {
     Manager_Resources.NewShopkeeper(this);
 }
Exemple #4
0
    static protected List <string> GeneratePlayerResource(List <string> occupiedBuildingResources, string scenarioID, JSONObject json, ProfileSettings profileSettings)
    {
        for (int i = 0; i < json.Count; i++)
        {
            JSONObject player = json[i];

            new Resources_Player(
                // profile settings, home, money, income, expenses, strength, presence, opinion, inventory
                profileSettings,
                Manager_Resources.GetBuildingByID(player.GetField("home").str),
                Mathf.Clamp(int.Parse(player.GetField("money").str), moneyMin, moneyMax),
                Mathf.Clamp(int.Parse(player.GetField("income").str), moneyMin, moneyMax),
                Mathf.Clamp(int.Parse(player.GetField("expenses").str), moneyMin, moneyMax),
                Mathf.Clamp(int.Parse(player.GetField("strength").str), statMin, statMax),
                Mathf.Clamp(int.Parse(player.GetField("presence").str), statMin, statMax),
                Mathf.Clamp(int.Parse(player.GetField("opinion").str), statMin, statMax),
                Resources_Inventory.GetInventoryByID(player.GetField("inventory").str)
                );

            if (occupiedBuildingResources.Contains(player.GetField("home").str))
            {
                Debug.LogError("Easy, Nelly. Someone messed up. Go tell whoever was messing with the static data that the player's safehouse can't be in " + player.GetField("home").str + ". Someone else is already in there! -Scott");
            }
            else
            {
                occupiedBuildingResources.Add(player.GetField("home").str);
            }
        }
        return(occupiedBuildingResources);
    }
Exemple #5
0
 static protected void SetReferencesBetweenResourcesAndDesignBuildings(List <string> existing)
 {
     for (int i = 0; i < existing.Count; i++)
     {
         string exist = existing[i];
         for (int j = 0; j < Building_Script.buildingIDs.Count; j++)
         {
             string script = Building_Script.buildingIDs[j];
             if (exist == script)
             {
                 Manager_Resources.GetBuildingByID(exist).building = Building_Script.GetBuilding(script);
                 Building_Script.GetBuilding(script).resources     = Manager_Resources.GetBuildingByID(exist);
             }
         }
     }
 }
Exemple #6
0
    static protected List <string> GenerateShopkeeperResources(List <string> occupiedBuildingResources, string scenarioID, JSONObject json)
    {
        for (int i = 0; i < json.Count; i++)
        {
            JSONObject shopkeeper = json[i];

            Resources_Shopkeeper newShopkeeper = new Resources_Shopkeeper(
                //id, name, image, gender, home, money, income, expenses,
                //strength, respect, fear, greed, integrity, stubbornness, personality, inventory
                shopkeeper.GetField("id").str,
                shopkeeper.GetField("name").str,
                shopkeeper.GetField("image").str,
                Enums.GenderFromString(shopkeeper.GetField("gender").str),
                Manager_Resources.GetBuildingByID(shopkeeper.GetField("home").str),
                Mathf.Clamp(int.Parse(shopkeeper.GetField("money").str), moneyMin, moneyMax),
                Mathf.Clamp(int.Parse(shopkeeper.GetField("income").str), moneyMin, moneyMax),
                Mathf.Clamp(int.Parse(shopkeeper.GetField("expenses").str), moneyMin, moneyMax),
                Mathf.Clamp(int.Parse(shopkeeper.GetField("strength").str), statMin, statMax),
                Mathf.Clamp(int.Parse(shopkeeper.GetField("respect").str), statMin, statMax),
                Mathf.Clamp(int.Parse(shopkeeper.GetField("fear").str), statMin, statMax),
                Mathf.Clamp(int.Parse(shopkeeper.GetField("greed").str), statMin, statMax),
                Mathf.Clamp(int.Parse(shopkeeper.GetField("integrity").str), statMin, statMax),
                Mathf.Clamp(int.Parse(shopkeeper.GetField("stubbornness").str), statMin, statMax),
                Enums.PersonalityFromStatic(shopkeeper.GetField("personality").str),
                Resources_Inventory.GetInventoryByID(shopkeeper.GetField("inventory").str)
                );

            if (occupiedBuildingResources.Contains(shopkeeper.GetField("home").str))
            {
                Debug.LogError("Whoa there, Sally. Someone done goofed. Go tell whoever was messing with the static data that " + shopkeeper.GetField("id").str + " can't set up shop in " + shopkeeper.GetField("home").str + ". Someone else is already in there! -Scott");
            }
            else
            {
                occupiedBuildingResources.Add(shopkeeper.GetField("home").str);
                // to be moved to a different section
                Building_Script buildingScriptRef = Building_Script.GetBuilding(shopkeeper.GetField("home").str);
                if (buildingScriptRef != null)
                {
                    buildingScriptRef.shopkeeper = newShopkeeper;
                }
            }
        }
        return(occupiedBuildingResources);
    }
Exemple #7
0
    static protected List <string> GenerateOfficerResources(List <string> occupiedBuildingResources, string scenarioID, JSONObject json)
    {
        List <string> policeStations = new List <string>();

        for (int i = 0; i < json.Count; i++)
        {
            JSONObject officer = json[i];

            new Resources_Officer(
                //id, name, image, gender, home, money, income, expenses,
                //strength, respect, fear, greed, integrity, stubbornness, personality, inventory
                officer.GetField("id").str,
                officer.GetField("name").str,
                officer.GetField("image").str,
                Enums.GenderFromString(officer.GetField("gender").str),
                Manager_Resources.GetBuildingByID(officer.GetField("home").str),
                Mathf.Clamp(int.Parse(officer.GetField("money").str), moneyMin, moneyMax),
                Mathf.Clamp(int.Parse(officer.GetField("income").str), moneyMin, moneyMax),
                Mathf.Clamp(int.Parse(officer.GetField("expenses").str), moneyMin, moneyMax),
                Mathf.Clamp(int.Parse(officer.GetField("strength").str), statMin, statMax),
                Mathf.Clamp(int.Parse(officer.GetField("respect").str), statMin, statMax),
                Mathf.Clamp(int.Parse(officer.GetField("fear").str), statMin, statMax),
                Mathf.Clamp(int.Parse(officer.GetField("greed").str), statMin, statMax),
                Mathf.Clamp(int.Parse(officer.GetField("integrity").str), statMin, statMax),
                Mathf.Clamp(int.Parse(officer.GetField("stubbornness").str), statMin, statMax),
                Enums.PersonalityFromStatic(officer.GetField("personality").str),
                Resources_Inventory.GetInventoryByID(officer.GetField("inventory").str)
                );

            if (occupiedBuildingResources.Contains(officer.GetField("home").str))
            {
                Debug.LogError("Dial it back there, toots. " + officer.GetField("home").str + " isn't a police station. Go tell whoever was doing the static data to send officer " + officer.GetField("id").str + " someplace else! -Scott");
            }
            else if (!policeStations.Contains(officer.GetField("home").str))
            {
                policeStations.Add(officer.GetField("home").str);
            }
        }
        occupiedBuildingResources.AddRange(policeStations);
        return(occupiedBuildingResources);
    }
Exemple #8
0
 static protected void MakeSureAllDesignBuildingsHaveExistingResources(List <string> existing)
 {
     for (int i = 0; i < Building_Script.buildingIDs.Count; i++)
     {
         string script = Building_Script.buildingIDs[i];
         bool   found  = false;
         for (int j = 0; j < existing.Count; j++)
         {
             string exist = existing[j];
             if (exist == script)
             {
                 Building_Script.GetBuilding(script).resources = Manager_Resources.GetBuildingByID(exist);
                 found = true;
                 break;
             }
         }
         if (!found)
         {
             Debug.LogError("BUILDING HARMONY ISSUE: The Building Script '" + script + "' exists in design land, but is not declared in data.");
         }
     }
 }
Exemple #9
0
 static protected void MakeSureAllExistingResourcesHaveDesignBuildings(List <string> existing)
 {
     for (int i = 0; i < existing.Count; i++)
     {
         string exist = existing[i];
         bool   found = false;
         for (int j = 0; j < Building_Script.buildingIDs.Count; j++)
         {
             string script = Building_Script.buildingIDs[j];
             if (exist == script)
             {
                 Manager_Resources.GetBuildingByID(exist).building = Building_Script.GetBuilding(script);
                 found = true;
                 break;
             }
         }
         if (!found)
         {
             Debug.LogError("BUILDING HARMONY ISSUE: The Building Resource '" + exist + "' is declared in data but does not exist in design land.");
         }
     }
 }
Exemple #10
0
 static public void ClearScenario()
 {
     Manager_Resources.ClearAllResources();
     scenarioExists = false;
 }