public void SetAppearance(CharacterGen.Appearance Appearance) { HeadRenderer.sprite = Appearance.Body.Head; ArmRendererLeft.sprite = Appearance.Body.Arm; ArmRendererRight.sprite = Appearance.Body.Arm; HandRendererLeft.sprite = Appearance.Body.Hand; HandRendererRight.sprite = Appearance.Body.Hand; NeckRenderer.sprite = Appearance.Body.Neck; LegRendererLeft.sprite = Appearance.Body.Leg; LegRendererRight.sprite = Appearance.Body.Leg; HairRenderer.sprite = Appearance.Hair; FaceRenderer.sprite = Appearance.Face; ShoesRendererLeft.sprite = Appearance.Shoes; ShoesRendererRight.sprite = Appearance.Shoes; //Shirt ShirtBaseRenderer.sprite = Appearance.Shirt.Base; ShirtSleeveRendererLeft.sprite = Appearance.Shirt.Limb; ShirtSleeveRendererRight.sprite = Appearance.Shirt.Limb; ShirtBaseRenderer.color = Appearance.Shirt.Col; ShirtSleeveRendererLeft.color = Appearance.Shirt.Col; ShirtSleeveRendererRight.color = Appearance.Shirt.Col; //Pants PantsWaistRenderer.sprite = Appearance.Pants.Base; PantsLegRendererLeft.sprite = Appearance.Pants.Limb; PantsLegRendererRight.sprite = Appearance.Pants.Limb; PantsWaistRenderer.color = Appearance.Pants.Col; PantsLegRendererLeft.color = Appearance.Pants.Col; PantsLegRendererRight.color = Appearance.Pants.Col; }
public void InitGameRound() { //Mouse stuffs Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; //Reset important things. ReservedAppearances = new List <CharacterGen.Appearance>(); CelebTargets.Clear(); PhotosThisRound.Clear(); //Get CharacterInformations in scene so they can be assigned a random few celebrities. List <CharacterInformation> allCharacters = new List <CharacterInformation>(FindObjectsOfType <CharacterInformation>()); //Grab a celebrities from the database List <CharacterInformation.Character> allCelebs = new List <CharacterInformation.Character>(Database.GetAllCharacters()); //Pick 3 random celebrities from the database and assign them for (int counter = 0; counter < NumberOfCelebsPerRound; counter++) { //Select random celeb int selectedCelebIndex = Random.Range(0, allCelebs.Count); //Select random character from scene to make become this celeb int selectedCharacterIndex = Random.Range(0, allCharacters.Count); allCharacters[selectedCharacterIndex].AssignCharacter(allCelebs[selectedCelebIndex]); //Debug.Log(allCharacters[selectedCelebIndex]) //Let selected char pick some identifying features CharacterGen.Appearance appearance = allCharacters[selectedCharacterIndex].GenerateFeatures(); ReservedAppearances.Add(appearance); IndicateCelebColors.SetCelebAppearance(counter, appearance); //record that this celeb is a target this round, then remove them from the pools of potentially picked celebs and characters. CelebTargets.Add(allCharacters[selectedCharacterIndex], -1); allCelebs.RemoveAt(selectedCelebIndex); allCharacters.RemoveAt(selectedCharacterIndex); } //Generate outfits for the rest of the characters foreach (CharacterInformation character in allCharacters) { character.GenerateFeatures(); } //Tell player to start moving? Maybe? If that's necessary? }
public CharacterGen.Appearance GenerateFeatures() { //New generation bool isSimilar; do { isSimilar = false; Appearance = GameManager.Instance.CharacterGenerator.GenerateAppearance(_info.CharID); foreach (CharacterGen.Appearance app in GameManager.Instance.ReservedAppearances) { if (Appearance.CompareTo(app) > GameManager.Instance.SimilarityMaximum) { isSimilar = true; } } } while (isSimilar); LoadAppearance(); return(Appearance); }
private void GenNewInstances() { CharacterGen.Appearance baseAppearance = generator.GenerateAppearance(-1); Vector3 offset = Vector3.zero; if (ShowPart == BodyPart.BODY) { foreach (CharacterGen.BodyCollection body in generator.AllBodyOptions) { CharacterInformation ch = Instantiate(charPrefab, transform.position + offset, Quaternion.identity); offset += deltaPosition; baseAppearance.Body = body; ch.SetAppearance(baseAppearance); CreatedCharacters.Push(ch); } } else { switch (ShowPart) { case BodyPart.HAIR: { foreach (Sprite sp in generator.AllHairOptions) { CharacterInformation ch = Instantiate(charPrefab, transform.position + offset, Quaternion.identity); offset += deltaPosition; baseAppearance.Hair = sp; ch.SetAppearance(baseAppearance); CreatedCharacters.Push(ch); } break; } case BodyPart.FACE: { foreach (Sprite sp in generator.AllFaceOptions) { CharacterInformation ch = Instantiate(charPrefab, transform.position + offset, Quaternion.identity); offset += deltaPosition; baseAppearance.Face = sp; ch.SetAppearance(baseAppearance); CreatedCharacters.Push(ch); } break; } case BodyPart.SHIRTBASE: { List <Sprite> baseShirts = new List <Sprite>(generator.AllFeminineShirtBaseOptions); baseShirts.AddRange(generator.AllMasculineShirtBaseOptions); foreach (Sprite sp in baseShirts) { CharacterInformation ch = Instantiate(charPrefab, transform.position + offset, Quaternion.identity); offset += deltaPosition; baseAppearance.Shirt.Base = sp; ch.SetAppearance(baseAppearance); CreatedCharacters.Push(ch); } break; } case BodyPart.SHIRTSLEEVE: { foreach (Sprite sp in generator.AllShirtSleeveOptions) { CharacterInformation ch = Instantiate(charPrefab, transform.position + offset, Quaternion.identity); offset += deltaPosition; baseAppearance.Shirt.Limb = sp; ch.SetAppearance(baseAppearance); CreatedCharacters.Push(ch); } break; } case BodyPart.PANTSBASE: { foreach (Sprite sp in generator.AllPantsWaistOptions) { CharacterInformation ch = Instantiate(charPrefab, transform.position + offset, Quaternion.identity); offset += deltaPosition; baseAppearance.Pants.Base = sp; ch.SetAppearance(baseAppearance); CreatedCharacters.Push(ch); } break; } case BodyPart.PANTSLEG: { foreach (Sprite sp in generator.AllPantsLegOptions) { CharacterInformation ch = Instantiate(charPrefab, transform.position + offset, Quaternion.identity); offset += deltaPosition; baseAppearance.Pants.Limb = sp; ch.SetAppearance(baseAppearance); CreatedCharacters.Push(ch); } break; } case BodyPart.SHOES: { foreach (Sprite sp in generator.AllShoeOptions) { CharacterInformation ch = Instantiate(charPrefab, transform.position + offset, Quaternion.identity); offset += deltaPosition; baseAppearance.Shoes = sp; ch.SetAppearance(baseAppearance); CreatedCharacters.Push(ch); } break; } } } }
public static void SetCelebAppearance(int CelebNumber, CharacterGen.Appearance CelebAppearance) { Instance.CelebIndicator[CelebNumber].SetAppearance(CelebAppearance); }
public void SetAppearance(CharacterGen.Appearance app) { Appearance = app; LoadAppearance(); }