void PickStalker() { // Get someone from the list to be the target int nStalkerIdx = Random.Range(0, goAllPersonInTheLevel.Length); PersonBehavior personBehaviorScript = goAllPersonInTheLevel[nStalkerIdx].GetComponent <PersonBehavior>(); personBehaviorScript.typePersonBehavior = TypePersonBehavior.Stalker; // Keep the stalker info PersonChangeMaterials personChangeScript = goAllPersonInTheLevel[nStalkerIdx].GetComponent <PersonChangeMaterials>(); objectivesCardScript.SetStalkerInfo(personChangeScript.personColors); }
/// <summary> /// Picks one person, pick one appearance combination /// </summary> void RandomizePeopleAppeareance() { foreach (GameObject go in goAllPersonInTheLevel) { // Pick one from the all color combinations int nIdxColorCombinations = Random.Range(0, ltPersonsColors.Count); // Get the script from the person PersonChangeMaterials personChangeScript = go.GetComponent <PersonChangeMaterials>(); // and set it's colors personChangeScript.SetPersonColors(ltPersonsColors[nIdxColorCombinations].uniquePersonColors); } foreach (GameObject go in goAllWorkersInTheLevel) { // Pick one from the all color combinations int nIdxColorCombinations = Random.Range(0, ltPersonsColors.Count); // Get the script from the person PersonChangeMaterials personChangeScript = go.GetComponent <PersonChangeMaterials>(); // and set it's colors personChangeScript.SetPersonColors(ltPersonsColors[nIdxColorCombinations].uniquePersonColors); } }