Example #1
0
        void InitializeClothes()
        {
            clothing    = CharacterClothing.Top;
            MaleClothes = new Dictionary <CharacterClothing, List <CharacterSpriteSet> >();
            MaleClothes.InitializeDefaultValues(true);

            FemaleClothes = new Dictionary <CharacterClothing, List <CharacterSpriteSet> >();
            FemaleClothes.InitializeDefaultValues(true);
        }
    public void AddClothingData(CharacterClothing characterClothing)
    {
        Dictionary <ClothingSlot, CharacterClothing> dictionary = GetDictionary();

        CharacterClothingSO clothingSO = characterClothing.GetClothingSO();

        if (dictionary.ContainsKey(clothingSO.ClothingSlot.Slot))
        {
            dictionary[clothingSO.ClothingSlot.Slot] = characterClothing;
        }
        else
        {
            dictionary.Add(clothingSO.ClothingSlot.Slot, characterClothing);
        }

        SetUpLists(dictionary);
    }
    public CharacterCustomizationData GetCustomizationData()
    {
        CharacterCustomizationData data = new CharacterCustomizationData(MaterialBody.color);

        Dictionary <ClothingSlot, CharacterClothing> dictionary = new Dictionary <ClothingSlot, CharacterClothing>();

        List <GameObject> accessoryObjects = GetAccessoryObjects();

        foreach (ClothingSlot slot in ClothingObjects.Keys)
        {
            if (IsClothingSlotUsed(slot))
            {
                GameObject clothingObj = transform.GetChild(ClothingObjects[slot]).gameObject;

                CharacterClothing characterClothing = new CharacterClothing(clothingObj.GetComponent <ClothingSlotScript>().ClothingIndex, clothingObj.GetComponent <Renderer>().sharedMaterial.color);

                dictionary.Add(slot, characterClothing);
            }
        }

        foreach (GameObject accObj in accessoryObjects)
        {
            CharacterAccessory charAcc = new CharacterAccessory(accObj.GetComponent <AccessoryScript>().AccessoryIndex, accObj.GetComponent <Renderer>().sharedMaterial.color);

            data.CurrentAccessories.Add(charAcc);
        }

        data.SetUpLists(dictionary);

        //TEMP:
        Debug.Log("GENERATE CUSTOMIZATION DATA:");
        Debug.Log("Body Color: " + data.GetBodyColor().ToString());
        for (int i = 0; i < data.CurrentClothing_Keys.Count; i++)
        {
            Debug.Log("*" + data.CurrentClothing_Keys[i].ToString() + "* - Clothing ID: " + data.CurrentClothing_Values[i].ClothingID.ToString() + "; Color: " + data.CurrentClothing_Values[i].GetColor().ToString());
        }
        for (int i = 0; i < data.CurrentAccessories.Count; i++)
        {
            Debug.Log("*" + "ACC ID: " + data.CurrentAccessories[i].AccessoryID.ToString() + "; ACC Color: " + data.CurrentAccessories[i].GetColor().ToString());
        }

        return(data);
    }