public void Set(int clothingIndex) { CharacterClothingSO clothingSO = GameMaster.Instance.CustomizationManager.Character.Clothing[clothingIndex]; if (!IsBodyObject) { GetComponent <SkinnedMeshRenderer>().sharedMesh = clothingSO.Meshes[0]; GetComponent <SkinnedMeshRenderer>().enabled = true; ClothingIndex = clothingIndex; if (clothingSO.HasCustomMaterial) { HasCustomMaterial = true; GetComponent <Renderer>().sharedMaterials = clothingSO.CustomMaterials; } else { HasCustomMaterial = false; GetComponent <Renderer>().sharedMaterial = currentClothingMaterial; } } else if (clothingSO.HasBodyMesh) { GetComponent <SkinnedMeshRenderer>().sharedMesh = clothingSO.Meshes[1]; GetComponent <SkinnedMeshRenderer>().enabled = true; ClothingIndex = clothingIndex; } }
private void GetLevelUnlocks() { for (int i = 0; i < GameMaster.Instance.CustomizationManager.Character.Clothing.Count; i++) { CharacterClothingSO clothing = GameMaster.Instance.CustomizationManager.Character.Clothing[i]; if (!clothing.Special && clothing.LevelRequirement <= Level) { if (!UnlockedClothing.Contains(i)) { UnlockedClothing.Add(i); GameMaster.Instance.Notifications.Add(string.Format("Clothing unlocked: '{0}'", clothing.Name)); } } } for (int i = 0; i < GameMaster.Instance.CustomizationManager.Office.Items.Count; i++) { if (GameMaster.Instance.CustomizationManager.Office.Items[i].LevelRequirement <= Level) { if (!UnlockedOfficeItems.Contains(i)) { UnlockedOfficeItems.Add(i); GameMaster.Instance.Notifications.Add(string.Format("Office item unlocked: '{0}'", GameMaster.Instance.CustomizationManager.Office.Items[i].Name)); } } } }
public void SetClothing(int clothingId) { CharacterClothingSO clothingSO = GameMaster.Instance.CustomizationManager.Character.Clothing[clothingId]; GetClothingSlotScript(ClothingObjects[clothingSO.ClothingSlot.Slot]).Set(clothingId); if (clothingSO.HasBodyMesh) { GetClothingSlotScript(BodyObjects[clothingSO.ClothingSlot.Slot]).Set(clothingId); } switch (clothingSO.ClothingSlot.Slot) { case ClothingSlot.Costume: { if (GetClothingSlotScript(ClothingObjects[ClothingSlot.Upper]).IsSet) { UnsetClothing(ClothingSlot.Upper); } if (GetClothingSlotScript(ClothingObjects[ClothingSlot.Lower]).IsSet) { UnsetClothing(ClothingSlot.Lower); } if (GetClothingSlotScript(ClothingObjects[ClothingSlot.LeftArm]).IsSet) { UnsetClothing(ClothingSlot.LeftArm); } if (GetClothingSlotScript(ClothingObjects[ClothingSlot.RightArm]).IsSet) { UnsetClothing(ClothingSlot.RightArm); } break; } case ClothingSlot.Upper: case ClothingSlot.Lower: case ClothingSlot.LeftArm: case ClothingSlot.RightArm: { if (GetClothingSlotScript(ClothingObjects[ClothingSlot.Costume]).IsSet) { UnsetClothing(ClothingSlot.Costume); } break; } case ClothingSlot.Head: { break; } } SetUpBodyObjects(); }
public bool selectedItems(CharacterClothingSO item) { int iCurrent = playerCus.GetClothingIndexBySlot(item.ClothingSlot.Slot); CharacterClothingSO itemFound = null; if (iCurrent != -1) { itemFound = GameMaster.Instance.CustomizationManager.Character.Clothing[iCurrent]; } return(itemFound == item); }
public CharacterClothingSO PurchasedItems(CharacterClothingSO item) { foreach (var purchase in GameMaster.Instance.Player.PurchasedClothing) { if (GameMaster.Instance.CustomizationManager.Character.Clothing[purchase] == item) { return(item); } else { return(null); } } return(null); }
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); }
void slots(CharacterClothingSO clothing) { int i = 0; clicked = true; tempItem = clothing; foreach (CharacterClothingSO item in GameMaster.Instance.CustomizationManager.Character.Clothing) { if (item == clothing) { SetClothing(i, item.ClothingSlot.Slot); currentSlot = item.ClothingSlot.Slot; price.SetText(item.Price.ToString()); break; } i++; } }
void SetItem(GameObject newItem, CharacterClothingSO item) { newItem.transform.Find("Button/Image").GetComponent <Image>().sprite = outfit; newItem.transform.Find("Name").GetComponent <TMP_Text>().text = item.Name; newItem.transform.Find("Button/Text").GetComponent <TMP_Text> ().text = "$" + item.Price.ToString(); if (selectedItems(item)) { newItem.transform.Find("Button/Equipped").GetComponent <Image>().sprite = equipped; Debug.Log("Bloop"); } if (item.LevelRequirement > GameMaster.Instance.Player.Level) { newItem.transform.Find("Image").GetComponent <Image>().gameObject.SetActive(true); } newItem.transform.Find("Button").GetComponent <Button>().onClick.AddListener(delegate { slots(item); }); }