Example #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);
    }
 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);
 }
    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);
    }
Example #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);
    }
Example #5
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);
    }
Example #6
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);
    }
Example #7
0
 public Resources_Character(string id,
                            string name,
                            string image,
                            Enums.Gender gender,
                            Resources_Building home,
                            int money,
                            int income,
                            int expenses,
                            int strength,
                            Resources_Inventory inventory)
     : base(id,
            name,
            image,
            money,
            income,
            expenses)
 {
     _gender    = gender;
     _home      = home;
     _strength  = strength;
     _inventory = inventory;
 }
    public Resources_NPC(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,
	            inventory)
    {
        _respect = respect;
        _fear = fear;
        _greed = greed;
        _integrity = integrity;
        _stubbornness = stubbornness;
        _personality = personality;

        UpdateAttitude();
    }
    public Resources_NPC(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,
               inventory)
    {
        _respect      = respect;
        _fear         = fear;
        _greed        = greed;
        _integrity    = integrity;
        _stubbornness = stubbornness;
        _personality  = personality;

        UpdateAttitude();
    }
    private void GenerateStartingInventoriesFromJSON()
    {
        for (int i = 0; i < _worldData["StartingInventories"].Count; i++)
        {
            JSONObject entry = _worldData["StartingInventories"][i];

            JSONObject gunInfo     = entry["gun"];
            JSONObject meleeInfo   = entry["melee"];
            JSONObject clothesInfo = entry["clothes"];
            JSONObject shoesInfo   = entry["shoes"];
            JSONObject pinInfo     = entry["pin"];
            JSONObject neckInfo    = entry["neck"];
            JSONObject ringInfo    = entry["ring"];
            JSONObject wristInfo   = entry["wrist"];
            JSONObject hairInfo    = entry["hair"];
            JSONObject flowerInfo  = entry["flower"];

            Item_Weapon_Gun   gun     = null;
            Item_Weapon_Melee melee   = null;
            Item_Gear_Clothes clothes = null;
            Item_Gear_Shoes   shoes   = null;
            Item_Gear_Pin     pin     = null;
            Item_Gear_Neck    neck    = null;
            Item_Gear_Ring    ring    = null;
            Item_Gear_Wrist   wrist   = null;
            Item_Decay_Hair   hair    = null;
            Item_Decay_Flower flower  = null;

            if (gunInfo != null)
            {
                gun = (Item_Weapon_Gun)Item_Root.GetItemByID(gunInfo.str);
            }
            if (meleeInfo != null)
            {
                melee = (Item_Weapon_Melee)Item_Root.GetItemByID(meleeInfo.str);
            }
            if (clothesInfo != null)
            {
                clothes = (Item_Gear_Clothes)Item_Root.GetItemByID(clothesInfo.str);
            }
            if (shoesInfo != null)
            {
                shoes = (Item_Gear_Shoes)Item_Root.GetItemByID(shoesInfo.str);
            }
            if (pinInfo != null)
            {
                pin = (Item_Gear_Pin)Item_Root.GetItemByID(pinInfo.str);
            }
            if (neckInfo != null)
            {
                neck = (Item_Gear_Neck)Item_Root.GetItemByID(neckInfo.str);
            }
            if (ringInfo != null)
            {
                ring = (Item_Gear_Ring)Item_Root.GetItemByID(ringInfo.str);
            }
            if (wristInfo != null)
            {
                wrist = (Item_Gear_Wrist)Item_Root.GetItemByID(wristInfo.str);
            }
            if (hairInfo != null)
            {
                hair = (Item_Decay_Hair)Item_Root.GetItemByID(hairInfo.str);
            }
            if (flowerInfo != null)
            {
                flower = (Item_Decay_Flower)Item_Root.GetItemByID(flowerInfo.str);
            }

            Resources_Inventory inventory = new Resources_Inventory(entry["id"].str, gun, melee, clothes, shoes, pin, neck, ring, wrist, hair, flower);
        }
    }
    private void GenerateStartingInventoriesFromJSON()
    {
        for (int i = 0; i < _worldData["StartingInventories"].Count; i++)
        {
            JSONObject entry = _worldData["StartingInventories"][i];

            JSONObject gunInfo		 = entry["gun"];
            JSONObject meleeInfo	 = entry["melee"];
            JSONObject clothesInfo	 = entry["clothes"];
            JSONObject shoesInfo	 = entry["shoes"];
            JSONObject pinInfo		 = entry["pin"];
            JSONObject neckInfo		 = entry["neck"];
            JSONObject ringInfo		 = entry["ring"];
            JSONObject wristInfo	 = entry["wrist"];
            JSONObject hairInfo		 = entry["hair"];
            JSONObject flowerInfo	 = entry["flower"];

            Item_Weapon_Gun gun = null;
            Item_Weapon_Melee melee = null;
            Item_Gear_Clothes clothes = null;
            Item_Gear_Shoes shoes = null;
            Item_Gear_Pin pin = null;
            Item_Gear_Neck neck = null;
            Item_Gear_Ring ring = null;
            Item_Gear_Wrist wrist = null;
            Item_Decay_Hair hair = null;
            Item_Decay_Flower flower = null;

            if(gunInfo != null) {		gun = (Item_Weapon_Gun)			Item_Root.GetItemByID(gunInfo.str); }
            if(meleeInfo != null) {		melee = (Item_Weapon_Melee)		Item_Root.GetItemByID(meleeInfo.str); }
            if(clothesInfo != null) {	clothes = (Item_Gear_Clothes)	Item_Root.GetItemByID(clothesInfo.str);}
            if(shoesInfo != null) {		shoes = (Item_Gear_Shoes)		Item_Root.GetItemByID(shoesInfo.str);}
            if(pinInfo != null) {		pin = (Item_Gear_Pin)			Item_Root.GetItemByID(pinInfo.str);}
            if(neckInfo != null) {		neck = (Item_Gear_Neck)			Item_Root.GetItemByID(neckInfo.str);}
            if(ringInfo != null) {		ring = (Item_Gear_Ring)			Item_Root.GetItemByID(ringInfo.str);}
            if(wristInfo != null) {		wrist = (Item_Gear_Wrist)		Item_Root.GetItemByID(wristInfo.str);}
            if(hairInfo != null) {		hair = (Item_Decay_Hair)		Item_Root.GetItemByID(hairInfo.str);}
            if(flowerInfo != null) {	flower	= (Item_Decay_Flower)	Item_Root.GetItemByID(flowerInfo.str);}

            Resources_Inventory inventory = new Resources_Inventory (entry["id"].str, gun, melee, clothes, shoes, pin, neck, ring, wrist, hair, flower);
        }
    }