internal virtual void GenerateName(ref EmployeeGeneratedData generatedData) { NameLists employeeNames = names; generatedData.name = (generatedData.gender == "female") ? employeeNames.PersonName(PersonNames.FemaleFirstName) : employeeNames.PersonName(PersonNames.MaleFirstName); generatedData.name += " " + employeeNames.PersonName(PersonNames.LastName); }
/// <summary> /// Generates a Mocked Employee. /// </summary> /// <returns>The Mocked Employee</returns> private EmployeeGeneratedData GenerateMockedEmployee() { EmployeeGeneratedData genData = new EmployeeGeneratedData(); genData.AssignRandomGender(); var employeeParts = Enum.GetValues(typeof(EmployeePart)); foreach (EmployeePart part in employeeParts) { genData.SetColorToPart(factory.GenerateColor(part), part); } return(genData); }
/// <summary> /// Generates a new Material, with the Colors specified in empData. /// The Material provided as a parameter is not changed during the process. /// </summary> /// <param name="empData">The generated Data, where the colors are specified.</param> /// <param name="ui"></param> /// <returns></returns> public Material GenerateMaterialForEmployee(EmployeeGeneratedData empData, bool ui = false) { Material newMat; newMat = ui ? new Material(empUiMaterial) : new Material(empMaterial); SwapColor(SwapIndex.skin, empData.skinColor); SwapColor(SwapIndex.hair, empData.hairColor); SwapColor(SwapIndex.shirt, empData.shirtColor); SwapColor(SwapIndex.eyes, empData.eyeColor); SwapColor(SwapIndex.shoes, empData.shoeColor); SwapColor(SwapIndex.shorts, empData.shortsColor); colorSwapTex.Apply(); return(newMat); }
public void GenerateNameTest() { var generatedData = new EmployeeGeneratedData() { gender = "male" }; var names = Substitute.For <NameLists>(); names.PersonName(PersonNames.MaleFirstName).Returns("male"); names.PersonName(PersonNames.FemaleFirstName).Returns("female"); names.PersonName(PersonNames.LastName).Returns("last"); factory.names = names; factory.GenerateName(ref generatedData); Assert.AreEqual("male last", generatedData.name); }
/// <summary> /// Generates new and random EmployeeData. /// </summary> /// <returns>The generated EmployeeData.</returns> public virtual EmployeeData GenerateRandomEmployee() { EmployeeData employee = new EmployeeData(); EmployeeGeneratedData generatedData = new EmployeeGeneratedData(); //Skills employee.Skills = GenerateSkills(); LevelUpSkills(employee.Skills); addSpecials(employee); //Color var employeeParts = Enum.GetValues(typeof(EmployeePart)); foreach (EmployeePart part in employeeParts) { generatedData.SetColorToPart(GenerateColor(part), part); } //Name generatedData.AssignRandomGender(); GenerateName(ref generatedData); //Set Salary and Prize employee.Salary = calcSalary(employee); employee.Prize = calcPrize(employee); //hireableDays employee.hireableDays = rnd.Next(1, 4); //AnimationClips int numDiffClips = contentHub.maleAnimationClips.Length / 3; int clipIndex = rnd.Next(numDiffClips); generatedData.idleClipIndex = clipIndex; generatedData.walkingClipIndex = clipIndex + numDiffClips; generatedData.workingClipIndex = clipIndex + 2 * numDiffClips; employee.generatedData = generatedData; employee.State = Enums.EmployeeState.PAUSED; return(employee); }