public void ReleaseGameEngine(DateTime gameDate, GameEngine gameEngine, Database.Database.DatabaseCollection <EngineFeature> engineFeatures) { float score = 0f; if (gameEngine.SupportedFeaturesIDs.Count == 0) { Debug.LogError($"Market.ReleaseGameEngine({gameEngine.Name}) : no features."); return; } foreach (string featureId in gameEngine.SupportedFeaturesIDs) { EngineFeature feature = engineFeatures.FindById(featureId); if (feature == null) { Debug.LogError($"Market.ReleaseGameEngine({gameEngine.Name}) : " + $"unknown feature \"{featureId}\""); return; } int deltaYears = feature.ExpectedYear - gameDate.Year; score += deltaYears + 1f; } score /= gameEngine.SupportedFeaturesIDs.Count; //Debug.LogWarning($"Market.ReleaseGameEngine({gameEngine.Name}) : score = {score}"); Product product = new Product(ProductType.GameEngine, gameEngine.Name, score); activeProducts.Add(product); }
public void InitSkillsTypes(Database.Database.DatabaseCollection <Skill> skills, ParserContext parserContext) { skillTypes = new SkillType[skills.Collection.Count]; for (int i = 0; i < skills.Collection.Count; i++) { Skill skill = skills.Collection[i]; // daily progress var dailyProgress = ParseSkillScript(skill.DailyProgress, "daily progress", skill.Id, parserContext); if (dailyProgress == null) { continue; } // hiring cost var hiringCost = ParseSkillScript(skill.HiringCost, "hiring cost", skill.Id, parserContext); if (hiringCost == null) { continue; } // salary var salary = ParseSkillScript(skill.Salary, "salary", skill.Id, parserContext); if (salary == null) { continue; } skillTypes[i] = new SkillType(skill.Id, dailyProgress, hiringCost, salary); } }
public void InitStartingRooms(Database.Database.DatabaseCollection <Database.Room> dbRooms) { GameObject roomsParentObject = transform.Find("Rooms").gameObject; Room room0 = roomsParentObject.transform.Find("Room0").GetComponent <Room>(); Room room1 = roomsParentObject.transform.Find("Room1").GetComponent <Room>(); room0.SetInfo(dbRooms.FindById("GameDevSimple")); room1.SetInfo(dbRooms.FindById("RestroomDouble")); UpdateEmptyTiles(); }
public Employee GenerateRandomEmployee(IScriptContext context, HiringMethod hiringMethod, Names commonNames, Database.Database.DatabaseCollection <Skill> skillsCollection, out float hiringCost) { // Sex bool male = Random.value > 0.5f; // Name string firstName = commonNames.RandomFirstName(male); string lastName = commonNames.RandomLastName(); // Skills EmployeeSkill[] skills = new EmployeeSkill[hiringMethod.SkillsDistribution.Length]; for (int i = 0; i < hiringMethod.SkillsDistribution.Length; i++) { var skillDistribution = hiringMethod.SkillsDistribution[i]; string skillId = skillDistribution.Item1; Skill skillInfo = skillsCollection.FindById(skillId); if (skillInfo == null) { Debug.LogError($"Staff.GenerateRandomEmployee : invalid skill ID {skillId} in Hiring Method of ID {hiringMethod.Id}."); hiringCost = -1f; return(null); } int proficiency = Random.Range(skillDistribution.Item2, skillDistribution.Item3 + 1); // upper bound is inclusive by convention skills[i] = new EmployeeSkill(skillId, skillInfo.Name, proficiency); } // Game Object Creation Employee employee = Instantiate(employeeModel); Employee generated = new Employee(firstName, lastName, 0, context.D(), skills); // TODO : find other way employee.CopyEmployee(generated); employee.name = $"Employee_{generated.Id}"; context.SetCurrentEmployee(employee); // Hiring cost and salary hiringCost = ComputeEmployeeHiringCost(context); employee.Salary = ComputeEmployeeSalary(context); context.SetCurrentEmployee(null); employee.gameObject.SetActive(true); return(employee); }
public void Init(Database.Database.DatabaseCollection <Skill> skills, ParserContext parserContext) { employeesManager.InitSkillsTypes(skills, parserContext); }