public void StartNewGame() { SaveManager.Instance.ActiveSave = null; DateTime birthday = ConstructDateFromInput(); var new_character = new Character { Name = string.IsNullOrEmpty(CharacterNameInput.text) ? PersonNames.GetRandomName() : CharacterNameInput.text, Age = DateTime.Today.Month > birthday.Month || (DateTime.Today.Month == birthday.Month && DateTime.Today.Day > birthday.Day) ? DateTime.Today.Year - birthday.Year : DateTime.Today.Year - birthday.Year - 1, Birthday = birthday.ToString("dd-MM-yyyy"), CurrentLocation = Location.Locations[currentLocationIndex], IsMale = NewCharacterAvatar.AvatarMaleBody.gameObject.activeSelf }; new_character.SetHeadColor(NewCharacterAvatar.AvatarHead.color); new_character.SetBodyColor(NewCharacterAvatar.AvatarMaleBody.color); new_character.SetLegsColor(NewCharacterAvatar.AvatarLegs.color); new_character.Skills[Skill.Programming].Level = ProgrammingSkillAllocator.CurrentSkillLevel; new_character.Skills[Skill.UserInterfaces].Level = UserInterfacesSkillAllocator.CurrentSkillLevel; new_character.Skills[Skill.Databases].Level = DatabasesSkillAllocator.CurrentSkillLevel; new_character.Skills[Skill.Networking].Level = NetworkingSkillAllocator.CurrentSkillLevel; new_character.Skills[Skill.WebDevelopment].Level = WebDevelopmentSkillAllocator.CurrentSkillLevel; new_character.Funds = 5000; new_character.Reputation = 50; new_character.SetupEvents(); CanvasGroup mm_canvas = SDTUIController.Instance.MainMenuCanvas.GetComponent <CanvasGroup>(); CanvasGroup ig_canvas = SDTUIController.Instance.InGameCanvas.GetComponent <CanvasGroup>(); mm_canvas.alpha = 0; mm_canvas.interactable = false; mm_canvas.blocksRaycasts = false; ig_canvas.alpha = 1; ig_canvas.interactable = true; ig_canvas.blocksRaycasts = true; TimeManager.Unlock(); TimeManager.Unpause(); }
public static Employee GenerateEmployee() { var title = JobTitle.GetRandomTitle(); var new_employee = new Employee(); new_employee.CurrentTitle = title; new_employee.Salary = Mathf.CeilToInt(title.SkillRequirements.Sum() * salary_skill_factor) * Random.Range(50, 60) * 1000; new_employee.HireCost = Mathf.CeilToInt(Random.Range(0.05f, 1.0f) * new_employee.Salary); new_employee.Name = PersonNames.GetRandomName(); new_employee.Age = Random.Range(18, 50); new_employee.CurrentLocation = Location.GetRandomLocation(); new_employee.Skills = new SkillList(); for (int i = 0; i < SkillInfo.COUNT; i++) { new_employee.Skills[(Skill)i] = title.SkillRequirements[(Skill)i] + Random.Range(2, 5); } new_employee.Morale = 50.0f; return(new_employee); }