public void GenerateNewLevel() { List <Sprite> spCarasCopy = new List <Sprite>(spCaras); List <Sprite> spPeloHombreCopy = new List <Sprite>(spPeloHombre); List <Sprite> spPeloMujerCopy = new List <Sprite>(spPeloMujer); List <Sprite> spRopaHombreCopy = new List <Sprite>(spRopaHombre); List <Sprite> spRopaMujerCopy = new List <Sprite>(spRopaMujer); for (int i = 0; i < numberPerson; i++) { int sexInt = scRandomGenerator.GetRandomLinearCongruential(2); int ropaInt = (sexInt == 0) ? scRandomGenerator.GetRandomLinearCongruential(spRopaHombreCopy.Count) : scRandomGenerator.GetRandomLinearCongruential(spRopaMujerCopy.Count); Sprite spriteRopa = (sexInt == 0) ? spRopaHombreCopy[ropaInt] : spRopaMujerCopy[ropaInt]; int peloInt = (sexInt == 0) ? scRandomGenerator.GetRandomLinearCongruential(spPeloHombreCopy.Count) : scRandomGenerator.GetRandomLinearCongruential(spPeloMujerCopy.Count); Sprite spritePelo = (sexInt == 0) ? spPeloHombreCopy[peloInt] : spPeloMujerCopy[peloInt]; int baseInt = scRandomGenerator.GetRandomLinearCongruential(spBases.Length); Sprite spriteBase = spBases[baseInt]; int caraInt = scRandomGenerator.GetRandomLinearCongruential(spCarasCopy.Count); Sprite spriteCara = spCarasCopy[caraInt]; scPersonModel person = new scPersonModel(sexInt, baseInt, caraInt, ropaInt, peloInt, spriteBase, spriteCara, spritePelo, spriteRopa); if (i == 0) { person.esObjetivo = true; SetIconObjetivo("iconSexo", spSexo[sexInt]); if (level < 4) { SetIconObjetivo("iconCara", spCarasCopy[caraInt]); spCarasCopy.RemoveAt(caraInt); if (sexInt == 0) { SetIconObjetivo("iconPelo", spPeloHombreCopy[peloInt]); spPeloHombreCopy.RemoveAt(peloInt); SetIconObjetivo("iconRopa", spRopaHombreCopy[ropaInt]); spRopaHombreCopy.RemoveAt(ropaInt); } else { SetIconObjetivo("iconPelo", spPeloMujerCopy[peloInt]); spPeloMujerCopy.RemoveAt(peloInt); SetIconObjetivo("iconRopa", spRopaMujerCopy[ropaInt]); spRopaMujerCopy.RemoveAt(ropaInt); } } else if (level < 7) { SetIconObjetivo("iconCara", spCarasCopy[caraInt]); spCarasCopy.RemoveAt(caraInt); if (sexInt == 0) { SetIconObjetivo("iconPelo", spPeloHombreCopy[peloInt]); spPeloHombreCopy.RemoveAt(peloInt); } else { SetIconObjetivo("iconPelo", spPeloMujerCopy[peloInt]); spPeloMujerCopy.RemoveAt(peloInt); } SetIconObjetivo("iconRopa", spInterrogation[0]); } else { if (sexInt == 0) { SetIconObjetivo("iconPelo", spPeloHombreCopy[peloInt]); spPeloHombreCopy.RemoveAt(peloInt); } else { SetIconObjetivo("iconPelo", spPeloMujerCopy[peloInt]); spPeloMujerCopy.RemoveAt(peloInt); } SetIconObjetivo("iconRopa", spInterrogation[0]); SetIconObjetivo("iconCara", spInterrogation[0]); } } scObjetivoNivel = person; GameObject goPerson = (GameObject)Instantiate(prefabPerson, ReturnRandomPositionMap(), Quaternion.identity); goPerson.GetComponent <scRandomGenerateCharacter>().SetPersonModel(person); } }
public void SetPersonModel(scPersonModel personM) { person = personM; SetAllChildComponents(); }