void Awake() { if (manager == null) { DontDestroyOnLoad(gameObject); manager = this; } else if (manager != this) { Destroy(gameObject); } }
public void OnClick() { if(GUIDeathpanel == null) { deathCont = GameObject.FindGameObjectWithTag("MainCamera").transform.FindChild("popUp").transform.FindChild("deathLog").gameObject; GUIDeathpanel = GameObject.FindGameObjectWithTag("MainCamera").transform.FindChild("popUp").GetComponent<UIPanel>(); GUIMainpanel = GameObject.FindGameObjectWithTag("MainCamera").transform.FindChild("inGame").gameObject.GetComponent<UIPanel>(); GUIDeathList = deathCont.transform.FindChild("deathlist").GetComponent<UILabel> (); manager = GameObject.FindGameObjectWithTag ("eventManager").GetComponent<eventManager> (); chart = GUIMainpanel.transform.FindChild("Chart").gameObject; } GameObject.FindGameObjectWithTag ("MainCamera").transform.FindChild ("popUp").transform.FindChild ("options").gameObject.SetActive(false); GameObject.FindGameObjectWithTag("MainCamera").transform.FindChild("popUp").transform.FindChild("charViewer").gameObject.SetActive(false); deathCont.SetActive (true); GUIDeathpanel.enabled = true; GUIMainpanel.enabled = false; GUIDeathList.text = manager.getDeathMessages (); chart.SetActive (false); }
public personSim(int currentYear, float maleMod = 0, personSim guard1 = null, personSim guard2 = null) { evManager = GameObject.FindGameObjectWithTag ("eventManager").GetComponent<eventManager> (); children = new List<personSim> (); yearBorn = currentYear; isAlive = true; this.guard1 = guard1; this.guard2 = guard2; //assign gender if(UnityEngine.Random.value >= 0.5f + -maleMod) { isMale = true; } else { isMale = false; } if(guard1 != null && guard2 != null && guard1.isMale != guard2.isMale) { //guardians are biological parents, randomly inherit features! if(UnityEngine.Random.value >= 0.5f) this.eyeColour = guard1.eyeColour; else this.eyeColour = guard2.eyeColour; if(UnityEngine.Random.value >= 0.5f) this.hairColour = guard1.hairColour; else this.hairColour = guard2.hairColour; if(UnityEngine.Random.value >= 0.5f) this.hairDescription = guard1.hairDescription; else this.hairDescription = guard2.hairDescription; //I'm old fashioned.... if(guard1.isMale) generateName (guard1.surname); else generateName (guard2.surname); } else { if (guard1 != null && guard2 != null && guard1.isMale == guard2.isMale) { //child is adopted, take name only if(UnityEngine.Random.value >= 0.5f) generateName(guard1.surname); else generateName(guard2.surname); } else generateName();//no parents given, randomly gen everything maidenName = surname; eyeColour = eyeColours[UnityEngine.Random.Range(0, eyeColours.Length)]; hairColour = hairColours[UnityEngine.Random.Range(0, hairColours.Length)]; hairDescription = hairModifiers[UnityEngine.Random.Range(0, hairModifiers.Length)] + ", " + hairTypes[UnityEngine.Random.Range(0, hairTypes.Length)]; } }
private void Awake() { current = this; }