Esempio n. 1
0
        /// <summary>
        /// Assign selectedItem with random PartItem found in this Transform's children.
        /// </summary>
        public void RandomizeItem()
        {
            PartItem[] items = this.transform.GetComponentsInChildren <PartItem>(true);
            if (items.Length > 1)
            {
                SelectItem(items[Random.Range(1, items.Length)]);
            }
            if (_partcolors.Count > 0)
            {
                Color tcolor = _partcolors[Random.Range(0, _partcolors.Count)];
                CreatorUI.character.SetPartColor(this.slotCategory, ColorCode.Color1, tcolor);

                if (this.slotCategory == SlotCategory.SkinDetails)
                {
                    UIBodyColor uibodycolor = CreatorUI.GetComponentInChildren <UIBodyColor>(true);
                    if (uibodycolor != null)
                    {
                        uibodycolor.skinDetailsImg.color = tcolor;
                    }
                }
                else if (!SetupData.colorableSpriteLinks.ContainsKey(this.slotCategory))
                {
                    tcolor = _partcolors[Random.Range(0, _partcolors.Count)];
                    CreatorUI.character.SetPartColor(this.slotCategory, ColorCode.Color2, tcolor);

                    tcolor = _partcolors[Random.Range(0, _partcolors.Count)];
                    CreatorUI.character.SetPartColor(this.slotCategory, ColorCode.Color3, tcolor);
                }
            }
        }
Esempio n. 2
0
        void OnEnable()
        {
            Initialize();
            UIBodyColor uibodycolor = CreatorUI.GetComponentInChildren <UIBodyColor>(true);

            if (uibodycolor != null)
            {
                uibodycolor.gameObject.SetActive(true);
            }
        }
        /// <summary>
        /// Assign selectedItem with random BodyTypeItem found in this Transform's children.
        /// </summary>
        public void RandomizeBodyType()
        {
            if (CreatorUI == null)
            {
                return;
            }

            BodyTypeItem[] items = this.transform.GetComponentsInChildren <BodyTypeItem>(true);
            if (items.Length > 0)
            {
                SelectItem(items[Random.Range(0, items.Length)]);
            }

            if (_bodycolors.Count > 0)
            {
                Color selectedcolor = _bodycolors[Random.Range(0, _bodycolors.Count)];
                CreatorUI.character.SkinColor = selectedcolor;
                UIBodyColor uibodycolor = CreatorUI.GetComponentInChildren <UIBodyColor>(true);
                if (uibodycolor != null)
                {
                    uibodycolor.skinColorImg.color = selectedcolor;
                }
            }
        }