static void CheckBirthday(Character c) { if (c.Birthday == null) { c.Birthday = new MonthYear(rnd.Next(0, StrategicClock.Months.Count), StrategicClock.year - c.Age); } if (c.Birthday.Month == StrategicClock.month) { c.Age++; if (rnd.Next(0, 15) < 2) { c.AddTrait(Trait.Traits[rnd.Next(0, c.Traits.Count)]); } if (c.Age == 18) { c.Role = SystemRandomExtensions.RandomEnum <OfficerRoles>(); if (c.Role == OfficerRoles.Child) { c.Role = OfficerRoles.Navy; } if ((int)c.Role < 100) { c.JoinsUp(); } } else if (c.Age > 65) { c.Retire(false); } } }
// Update is called once per frame void Update() { if (gameObject.active) { if (LocationsParentRect.localPosition.y < 0) { LocationsParentRect.transform.localPosition = new Vector3(0f, 0f, 0f); } if (OfficersParentRect.localPosition.y < 0) { OfficersParentRect.transform.localPosition = new Vector3(0f, 0f, 0f); } if (HistoryRect.localPosition.y < 0) { HistoryRect.transform.localPosition = new Vector3(0f, 0f, 0f); } if (Input.GetKeyDown(KeyCode.Space) && SelectedChar != null) { OfficerRoles original = SelectedChar.Role; SelectedChar.Role = SystemRandomExtensions.RandomEnum <OfficerRoles>(); Debug.LogError(original.ToString() + "=>" + SelectedChar.Role.ToString()); } } }