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);
    }
    /// <summary>
    /// Sets up the characters appearance according to the specified customization data.
    /// </summary>
    /// <param name="clothingList"></param>
    public void SetAppearanceByData(CharacterCustomizationData customizationData)
    {
        Dictionary <ClothingSlot, CharacterClothing> clothingDictionary = customizationData.GetDictionary();

        MaterialBody.color = customizationData.GetBodyColor();

        UnsetAllClothing();
        UnsetAllAccessories();

        foreach (ClothingSlot slot in clothingDictionary.Keys)
        {
            SetClothing(clothingDictionary[slot].ClothingID);

            UpdateClothingColor(slot, clothingDictionary[slot].GetColor());
        }

        foreach (CharacterAccessory accessory in customizationData.CurrentAccessories)
        {
            SetAccessory(accessory.AccessoryID);

            UpdateAccessoryColor(accessory.AccessoryID, accessory.GetColor());
        }
    }
Пример #3
0
    /// <summary>
    /// Creates a NEW player. Default clothing unlocked and activated in customization data. Default Office items unlocked.
    /// </summary>
    public Player(string name, string businessName, float startingMoney, float initialMarkup, float maximumInventorySpace, int shopItemSlotCount)
    {
        Name = name;

        Business = new SupplierPlayer(businessName, startingMoney, initialMarkup, maximumInventorySpace, shopItemSlotCount);

        Level = 1;

        PlayTime = 0f;

        HasLifeLine = true;

        CharacterCustomizationData = new CharacterCustomizationData(GameMaster.Instance.CustomizationManager.Character.MaterialBodyDefault.color);
        UnlockedClothing           = new List <int>();
        PurchasedClothing          = new List <int>();

        OfficeCustomizationData = new OfficeCustomizationData(GameMaster.Instance.CustomizationManager.Office.MaterialWallsDefault.color, GameMaster.Instance.CustomizationManager.Office.MaterialWallsDefault.color, GameMaster.Instance.CustomizationManager.Office.MaterialFloorDefault.color, GameMaster.Instance.CustomizationManager.Office.MaterialCeilingDefault.color);
        UnlockedOfficeItems     = new List <int>();

        GetLevelUnlocks();

        foreach (int i in GameMaster.Instance.CustomizationManager.Character.DefaultClothingIndexes)
        {
            PurchasedClothing.Add(i);

            CharacterCustomizationData.AddClothingData(new CharacterClothing(i));
        }

        UnlockedAchievements = new List <int>();

        UnlockedUpgradesPassive = new List <int>();
        CurrentUpgradesActive   = new List <UpgradeActive>();

        ////TEMP:
        //for (int i = 1; i <= 20; i++)
        //    Debug.Log("Level " + i + ": " + GetLevelExperience(i));
    }
    /// <summary>
    /// Sets the specified object as the player object, and binds it with the specified clothing.
    /// </summary>
    /// <param name="playerObject"></param>
    /// <param name="currentClothing"></param>
    public void SetPlayer(GameObject playerObject, CharacterCustomizationData customizationData)
    {
        player = playerObject;

        player.GetComponent <CharacterCustomizationScript>().SetAppearanceByData(customizationData);
    }
Пример #5
0
 void CurrentOutfit()
 {
     Char = playerCus.GetCustomizationData();
 }