//update and export json here?
        // i dunno
        // nothing makes sense XD


        public void CreateRandomCitizen()
        {
            #if UNITY_EDITOR
            EditorUtility.SetDirty(data);
            #endif

            int   randomItemAmount      = Random.Range(0, 11);
            float randomBaseStatValue   = Random.Range(0f, 10f);
            int   randomSprite          = Random.Range(0, data.CreatureSpritePrefabList.Count);
            int   randomName            = Random.Range(0, data.CreatureNamesList.Count);
            CreatureFactoryData citizen = new CreatureFactoryData(data.CitizensMasterList.Count,
                                                                  100f,
                                                                  new List <Stat>(),
                                                                  new List <ItemFactoryData>(),
                                                                  data.CitizenBasePrefab, // change to whichever base depending on usage
                                                                  Vector3.zero,
                                                                  randomSprite
                                                                  );
            citizen.Name = data.CreatureNamesList[randomName] + " " + data.CreatureNamesList[Random.Range(0, data.CreatureNamesList.Count)];


            createRandomItems(citizen, randomItemAmount);

            createRandomValueStats(citizen, 5, randomBaseStatValue);
            data.CitizensMasterList.Add(citizen);
        }
        void createRandomItems(CreatureFactoryData creature, int maxAmount)
        {
            float amt = 0;

            foreach (SourceDataItemSO item in data.ItemTemplates)
            {
                amt = Random.Range(0, maxAmount);
                creature.ItemsInBag.Add(new ItemFactoryData(item.name, (int)amt));
            }
        }
        void createRandomValueStats(CreatureFactoryData creature, float min, float baseValue)
        {
            float val;

            foreach (STAT_TYPE stat in data.CreatureDefaultStatList)
            {
                Stat statToAdd = new Stat(stat, baseValue);
                val = Random.Range(min, statToAdd.MaxValue);
                statToAdd.CurrentValue = (val);
                creature.Statlist.Add(statToAdd);
            }
        }
Esempio n. 4
0
 public bool ReadActorData(int id, out CreatureFactoryData actor)
 {
     foreach (CreatureFactoryData ad in houseHoldData.gamedata.CitizensMasterList)
     {
         if (ad.ActorID == id)
         {
             actor = ad;
             return(true);
         }
     }
     Debug.LogWarning("ID Does not Exist");
     actor = null;
     return(false);
 }
Esempio n. 5
0
        public bool FindCitizenDataFromList(int creatureID, out CreatureFactoryData actor)
        {
            foreach (CreatureFactoryData ad in CitizensMasterList)
            {
                if (ad.ActorID == creatureID)
                {
                    actor = ad;
                    return(true);
                }
            }

            Debug.LogWarning("ID Does not Exist");
            actor = null;
            return(false);
        }