public RandomColors(RandomWardrobeSlot rws)
        {
#if UNITY_EDITOR
            CurrentColor = 0;
            GuiFoldout   = true;
            Delete       = false;
#endif
        }
        public void Randomize(DynamicCharacterAvatar Avatar)
        {
            // Must clear that out!
            Avatar.WardrobeRecipes.Clear();

            UMARandomizer Randomizer = null;

            if (Randomizers != null)
            {
                if (Randomizers.Count == 0)
                {
                    return;
                }

                if (Randomizers.Count == 1)
                {
                    Randomizer = Randomizers[0];
                }
                else
                {
                    Randomizer = Randomizers[UnityEngine.Random.Range(0, Randomizers.Count)];
                }
            }
            if (Avatar != null && Randomizer != null)
            {
                RandomAvatar ra = Randomizer.GetRandomAvatar();
                Avatar.ChangeRaceData(ra.RaceName);
                //Avatar.BuildCharacterEnabled = true;
                var RandomDNA = ra.GetRandomDNA();
                Avatar.predefinedDNA = RandomDNA;
                var RandomSlots = ra.GetRandomSlots();

                if (ra.SharedColors != null && ra.SharedColors.Count > 0)
                {
                    foreach (RandomColors rc in ra.SharedColors)
                    {
                        if (rc.ColorTable != null)
                        {
                            Avatar.SetColor(rc.ColorName, GetRandomColor(rc), false);
                        }
                    }
                }
                foreach (string s in RandomSlots.Keys)
                {
                    List <RandomWardrobeSlot> RandomWardrobe = RandomSlots[s];
                    RandomWardrobeSlot        uwr            = GetRandomWardrobe(RandomWardrobe);
                    if (uwr.WardrobeSlot != null)
                    {
                        AddRandomSlot(Avatar, uwr);
                    }
                }
            }
        }
Exemple #3
0
 private void AddRandomSlot(DynamicCharacterAvatar Avatar, RandomWardrobeSlot uwr)
 {
     Avatar.SetSlot(uwr.WardrobeSlot);
     if (uwr.Colors != null)
     {
         foreach (RandomColors rc in uwr.Colors)
         {
             if (rc.ColorTable != null)
             {
                 OverlayColorData ocd = GetRandomColor(rc);
                 Avatar.SetColor(rc.ColorName, ocd, false);
             }
         }
     }
 }