Ejemplo n.º 1
0
    private void UpdateWardrobe()
    {
        if (Head)
        {
            enemyAvatar.SetSlot(Head.GetComponent <Armor>().GetWardrobePiece().Item1);
        }

        if (Chest)
        {
            enemyAvatar.SetSlot(Chest.GetComponent <Armor>().GetWardrobePiece().Item1);
            if (Chest.GetComponent <Armor>().GetWardrobePiece().Item2)
            {
                enemyAvatar.SetSlot(Chest.GetComponent <Armor>().GetWardrobePiece().Item2);
            }
        }

        if (Legs)
        {
            enemyAvatar.SetSlot(Legs.GetComponent <Armor>().GetWardrobePiece().Item1);
            if (Legs.GetComponent <Armor>().GetWardrobePiece().Item2)
            {
                enemyAvatar.SetSlot(Legs.GetComponent <Armor>().GetWardrobePiece().Item2);
            }
        }

        if (enemyAvatar)
        {
            enemyAvatar.BuildCharacter();
        }
    }
Ejemplo n.º 2
0
    public IEnumerator CustomizeCharacterAppearance(CharacterDataHolder characterData, DynamicCharacterAvatar newAvatar)
    {
        // Hide avatar until delay ends.
        newAvatar.gameObject.SetActive(false);

        // Unfortunately UMA needs a small delay to initialize.
        yield return(new WaitForSeconds(0.25f));

        // Delay ended. Show avatar.
        newAvatar.gameObject.SetActive(true);

        // Customize character.
        int hairType = characterData.GetHairType();

        if (characterData.GetRace() == 0)
        {
            newAvatar.ChangeRace("HumanMaleDCS");
            if (hairType != 0)
            {
                newAvatar.SetSlot("Hair", _hairModelsMale[characterData.GetHairType()]);
            }
        }
        if (characterData.GetRace() == 1)
        {
            newAvatar.ChangeRace("HumanFemaleDCS");
            if (hairType != 0)
            {
                newAvatar.SetSlot("Hair", _hairModelsFemale[characterData.GetHairType()]);
            }
        }

        // Set colors.
        newAvatar.SetColor("Hair", Util.IntToColor(characterData.GetHairColor()));
        newAvatar.SetColor("Skin", Util.IntToColor(characterData.GetSkinColor()));
        newAvatar.SetColor("Eyes", Util.IntToColor(characterData.GetEyeColor()));
        newAvatar.UpdateColors(true);

        Dictionary <string, DnaSetter> dna = newAvatar.GetDNA();

        dna["height"].Set(characterData.GetHeight());
        dna["belly"].Set(characterData.GetBelly());
        newAvatar.BuildCharacter(false);

        // Set visible equipable armor items.
        EquipItem(newAvatar, characterData.GetHeadItem());
        EquipItem(newAvatar, characterData.GetChestItem());
        EquipItem(newAvatar, characterData.GetLegsItem());
        EquipItem(newAvatar, characterData.GetHandsItem());
        EquipItem(newAvatar, characterData.GetFeetItem());

        // Without this delay, sometimes, we cannot not see mounted weapons.
        yield return(new WaitForSeconds(0.25f));

        // Set visible equipable left and right hand items.
        EquipItem(newAvatar, characterData.GetLeftHandItem());
        EquipItem(newAvatar, characterData.GetRightHandItem());
    }
Ejemplo n.º 3
0
    void ChangeHairStyle(int styleIndex)
    {
        currentStyle = styleIndex;
        if (avatar.activeRace.name == "HumanMaleDCS")
        {
            avatar.SetSlot("Hair", maleHairStyles[styleIndex].name);
        }
        else
        {
            avatar.SetSlot("Hair", femaleHairStyles[styleIndex].name);
        }

        avatar.BuildCharacter();
    }
Ejemplo n.º 4
0
 public void ApplyClothing(DynamicCharacterAvatar avatar)
 {
     foreach (UMATextRecipe r in Recipes)
     {
         avatar.SetSlot(r);
     }
 }
Ejemplo n.º 5
0
    //public void ChangeHair(int hair)
    //{
    //    if (characterAvatar.activeRace.name == "HumanMaleDCS")
    //    {
    //        characterAvatar.SetSlot(MaleHair[hair]);
    //    }
    //    if (characterAvatar.activeRace.name == "HumanFemaleDCS")
    //    {
    //        characterAvatar.SetSlot(FemaleHair[hair]);
    //    }
    //    characterAvatar.BuildCharacter();
    //}
    public void ChangeHair(bool plus)
    {
        if (characterAvatar.activeRace.name == "HumanMaleDCS")
        {
            if (plus)
            {
                CurrentMaleHair++;
            }
            else
            {
                CurrentMaleHair--;
            }
            CurrentMaleHair = Mathf.Clamp(CurrentMaleHair, 0, hairMaleModels.Count - 1);
            if (hairMaleModels[CurrentMaleHair] == "None")
            {
                characterAvatar.ClearSlot("Hair");
            }
            else
            {
                characterAvatar.SetSlot("Hair", hairMaleModels[CurrentMaleHair]);
            }
        }
        if (characterAvatar.activeRace.name == "HumanFemnetaleDCS")
        {
            //Female Hair
            if (plus)
            {
                CurrentFemaleHair++;
            }
            else
            {
                CurrentFemaleHair--;
            }
            CurrentFemaleHair = Mathf.Clamp(CurrentFemaleHair, 0, hairFemaleModels.Count - 1);

            if (hairFemaleModels[CurrentFemaleHair] == "None")
            {
                characterAvatar.ClearSlot("Hair");
            }
            else
            {
                characterAvatar.SetSlot("Hair", hairFemaleModels[CurrentFemaleHair]);
            }
        }
        characterAvatar.BuildCharacter();
    }
Ejemplo n.º 6
0
        public void CreateFromPrefab()
        {
            float                  x   = Random.Range(-8.0f, 8.0f);
            float                  z   = Random.Range(1.0f, 12.0f);
            GameObject             go  = GameObject.Instantiate(AvatarPrefab);
            DynamicCharacterAvatar dca = go.GetComponent <DynamicCharacterAvatar>();

            dca.SetSlot(CollectionToAdd);
            go.transform.localPosition = new Vector3(x, 0, z);
            go.SetActive(true);
        }
Ejemplo n.º 7
0
 private void EquipItemVisual(ItemData itemData)
 {
     if (itemData.equippable != null)
     {
         if (avatar)
         {
             avatar.SetSlot(itemData.equippable);
             avatar.BuildCharacter();
         }
     }
 }
Ejemplo n.º 8
0
 public void RPC_ChangeWardrobe(string category, string recipe)
 {
     if (recipe != "")
     {
         dca.SetSlot(category, recipe);
     }
     else
     {
         dca.ClearSlot(category);
     }
     dca.BuildCharacter(true);
 }
Ejemplo n.º 9
0
    //EquipedConsumable//////////////////////////////////


    //EquipedArmor///////////////////////////////////////
    public void EquipArmor(GameObject item, ArmorType armorType) //MUST UNEQUIP BEFORE EQUIPPING IF NOT NULL
    {
        ItemMaster tempMaster   = item.GetComponent <ItemMaster>();
        int        itemSubArray = (int)tempMaster.ReturnItemType();
        Armor      armorScript  = item.GetComponent <Armor>();

        UnEquipArmor(armorType);

        EquippedArmor[(int)armorType] = item;
        InventoryStorage[itemSubArray][tempMaster.ReturnItemName()].Remove(item);

        playerStats.AddAttributeEffect(AttributesEnum.armor, STARTUP_DECLARATIONS.ArmorTypeEnumReverse[(int)armorType], true, armorScript.returnArmor());     //second entry is name e.g. "Head"
        playerStats.AddAttributeEffect(AttributesEnum.plating, STARTUP_DECLARATIONS.ArmorTypeEnumReverse[(int)armorType], true, armorScript.returnPlating()); //second entry is name e.g. "Head"
        playerStats.AddAttributeEffect(AttributesEnum.stamina_regen, STARTUP_DECLARATIONS.ArmorTypeEnumReverse[(int)armorType], false, armorScript.returnEEnergyRegenModifier());

        // UMA Component
        playerAvatar.SetSlot(armorScript.GetWardrobePiece().Item1);
        if (armorScript.GetWardrobePiece().Item2)
        {
            playerAvatar.SetSlot(armorScript.GetWardrobePiece().Item2);
        }
        playerAvatar.BuildCharacter();
    }
Ejemplo n.º 10
0
        void SetWardrobe(bool active)
        {
            if (wardrobeRecipe == null)
            {
                return;
            }

            if (active)
            {
                avatar.SetSlot(wardrobeRecipe);
            }
            else
            {
                avatar.ClearSlot(wardrobeRecipe.wardrobeSlot);
            }

            avatar.BuildCharacter();
        }
Ejemplo n.º 11
0
    public void UpdateCharacterEquip(EquipmentSlot slot, EquippableItem item)
    {
        for (int i = 0; i < equipmentSlots.Length; i++)
        {
            if (item.recipe == null)
            {
                Debug.Log("No Wardrobe Recipe: " + item.ItemName);
                return;
            }
            else
            {
                player.SetSlot(equipmentSlots[i].EquipmentType.ToString(), item.recipe.name);
                //_player.SetSlot(equipmentSlots[i].EquipmentType.ToString(), item.femaleRecipe.name);

                player.BuildCharacter();
            }
        }
    }
 public void SwitchGender(bool male)
 {
     if (male && _avatar.activeRace.name != "HumanMaleDCS")
     {
         _dataHolder = _dataHolderMale;
         Destroy(_avatar.gameObject);
         _avatar = CharacterManager.Instance.CreateCharacter(_dataHolder, 8.28f, 0.1035156f, 20.222f, 180);
         _avatar.SetSlot("Underwear", "MaleUnderwear");
         _avatar.CharacterUpdated.AddListener(Updated);
     }
     if (!male && _avatar.activeRace.name != "HumanFemaleDCS")
     {
         _dataHolder = _dataHolderFemale;
         Destroy(_avatar.gameObject);
         _avatar = CharacterManager.Instance.CreateCharacter(_dataHolder, 8.28f, 0.1035156f, 20.222f, 180);
         _avatar.SetSlot("Underwear", "FemaleUndies2");
         _avatar.CharacterUpdated.AddListener(Updated);
     }
 }
    private void Start()
    {
        // Return if account name is empty.
        if (MainManager.Instance == null || MainManager.Instance.GetAccountName() == null)
        {
            return;
        }

        // Set instance.
        if (Instance != null)
        {
            return;
        }
        Instance = this;

        // Schedule exit to login screen.
        StartCoroutine(ExitToCharacterSelection());

        // Add button listeners.
        _zoomIn.onClick.AddListener(CameraZoomIn);
        _zoomOut.onClick.AddListener(CameraZoomOut);
        _createButton.onClick.AddListener(OnClickCreateButton);
        _backButton.onClick.AddListener(OnClickBackButton);

        // Initialize character data holders.
        _dataHolderMale = new CharacterDataHolder();
        _dataHolderMale.SetRace(0);
        _dataHolderFemale = new CharacterDataHolder();
        _dataHolderFemale.SetRace(1);
        _dataHolder = _dataHolderMale;

        // Initial values.
        _avatar = CharacterManager.Instance.CreateCharacter(_dataHolderMale, 8.28f, 0.1035156f, 20.222f, 180);
        _avatar.SetSlot("Underwear", "MaleUnderwear");
        _avatar.CharacterUpdated.AddListener(Updated);
        _heightSlider.onValueChanged.AddListener(HeightChange);
        _bellySlider.onValueChanged.AddListener(BellyChange);

        // Camera position.
        Camera.main.transform.position = new Vector3(8.29f, 1.29f, 17.7f);
    }
Ejemplo n.º 14
0
    /// <summary>
    /// Sets any wardrobe slot. If a negative value is passed, then the slot is cleared.
    /// </summary>
    /// <param name="slotToChange">name of the wordrobe slot to change</param>
    /// <param name="fSlotNumber">Id number slot to change</param>
    public void SetSlot(string slotToChange, float fSlotNumber)
    {
        var           thisRace         = Avatar.activeRace.name;
        int           slotNumber       = (int)fSlotNumber;
        string        prioritySlot     = "";
        List <string> prioritySlotOver = new List <string>();
        UMATextRecipe tr = null;

        if (slotNumber >= 0)
        {
            tr = characterSystem.Recipes[thisRace][slotToChange][slotNumber];
            prioritySlotOver = tr.suppressWardrobeSlots;
            prioritySlot     = tr.wardrobeSlot;
            Avatar.SetSlot(tr);
        }
        else
        {
            Avatar.ClearSlot(slotToChange);
        }
        if (prioritySlotOver.Count > 0)
        {
            foreach (Transform child in wardrobeDropdownPanel.transform)
            {
                if (child.gameObject.activeSelf)
                {
                    var thisSlot = child.GetComponent <CSWardrobeSlotChangerDD>().wardrobeSlotToChange;
                    if (prioritySlotOver.Contains(thisSlot))
                    {
                        child.GetComponent <Dropdown>().value = 0;
                        child.GetComponent <Dropdown>().CancelInvoke();
                    }
                }
            }
        }
        Avatar.BuildCharacter(true, prioritySlot, prioritySlotOver);
        //Update the dropdowns to reflect any changes
        SetUpWardrobeDropdowns();
    }