예제 #1
0
        public void SetCharacter(CharacterControl character)
        {
            if (isCustomizing)
            {
                return;
            }
            UI.ToggleActive(true);
            // isCurrPlayer = character == Characters.I.Player.cc;
            isCustomizing = true;
            // mannequinAnim.gameObject.SetActive(true);
            var mannequin = Instantiate(mannequinPrefab);

            mannequin.transform.position = new Vector3(0, 1000f, 0);
            this.mannequin = mannequin.GetComponentInChildren <CharacterControl>();

            var cc = GetCharacterCustomize(character.character.name);

            if (cc == null)
            {
                // Debug.Log("Creating new customization profile");
                cc = new CharacterCustomizeOptions();
                cc.characterName = character.character.name;

                for (int i = 0; i < itemLibraries.Length; ++i)
                {
                    var option = new CustomizeItemOption();
                    option.optionType = itemLibraries[i].optionType;
                    option.library    = itemLibraries[i];
                    cc.options.Add(option);

                    var charEquip = character.charEquip.GetSlotFromTag(itemLibraries[i].optionType);
                    if (charEquip == null || !charEquip.item)
                    {
                        continue;
                    }
                    option.itemName = charEquip.item.name;
                    itemLibraries[i].tempItemInd = GetItemIndex(charEquip.item);
                }
            }

            cc.charCtrl       = character;
            currCharCustomize = cc;
            LoadCharacterCustomizations(this.mannequin);

            UI.SetupOptions(currCharCustomize);
            this.mannequin.charAnim.TogglePoseMode(true);
            Cams.I.SetCamTarget(this.mannequin.gameObject);
        }
예제 #2
0
        public void SetupOptions(CharacterCustomizeOptions cc)
        {
            currCc = cc;
            colorPicker.ClearAndDisable();

            for (int i = 0; i < cc.options.Count; ++i)
            {
                var o = cc.options[i];
                o.library.optionUI.ToggleShowHide(true);
                o.library.optionUI.slider1.value = o.library.tempItemInd;
                UpdateOptionLabel(o.library, o.library.items[o.library.tempItemInd]);

                SetupColorOptions(o.library);
                SetupBlendshapes(o.library);
            }
        }
예제 #3
0
 public void UpdateOptions(CharacterCustomizeOptions cc)
 {
     for (int i = 0; i < cc.options.Count; ++i)
     {
         var o = cc.options[i];
         o.library.optionUI.slider1.value = o.library.tempItemInd;
         UpdateOptionLabel(o.library, o.library.items[o.library.tempItemInd]);
         for (int j = 0; j < o.blendShapes.Length; ++j)
         {
             o.library.bsSliders[j].slider1.value = o.blendShapes[j];
         }
         for (int j = 0; j < o.colors.Length; ++j)
         {
             o.library.colorPickers[j].image1.color = o.colors[j];
         }
     }
 }
예제 #4
0
        public void ApplyCustomizationsOnCharacterSpawn(Character character, GameObject instance)
        {
            var cc = GetCharacterCustomize(character.name);

            if (cc == null)
            {
                return;
            }
            for (int i = 0; i < cc.options.Count; ++i)
            {
                var library = GetLibrary(cc.options[i].optionType);
                if (library == null)
                {
                    continue;
                }
                cc.options[i].library = library;
            }
            var chara = instance.GetComponent <CharacterControl>();

            cc.charCtrl       = chara;
            cc.characterName  = character.name;
            currCharCustomize = cc;
            LoadCharacterCustomizations(cc.charCtrl);
        }