public IEnumerable <Programmer> MakeProgrammers(IEnumerable <ProgrammerSpec> specs) { var newProgrammers = new List <Programmer>(); foreach (var programmerSpec in specs) { programmerSpec.Status.DisposeRegisteredEvents(); var newProgrammer = Instantiate(programmerTemplate); var randomVector = StageField.GetRandomVector(); newProgrammer.transform.position = randomVector; newProgrammer.Ability = programmerSpec.Ability; foreach (var activeSkill in newProgrammer.Ability.AcquiredActiveSkills) { activeSkill.ResetStageParameters(); } newProgrammer.Status = programmerSpec.Status; newProgrammer.Status.ResetStageParameters(); newProgrammers.Add(newProgrammer); } return(newProgrammers); }
private void InitializeProgrammers() { Programmers.Clear(); HashSet <Vector3> programmerPositions = new HashSet <Vector3>(); foreach (var programmerSpec in CurrentStage.ProgrammerSpecs) { programmerSpec.Status.DisposeRegisteredEvents(); var newProgrammer = Instantiate(programmerTemplate); var randomVector = StageField.GetRandomVector(); while (programmerPositions.Contains(randomVector)) { randomVector = StageField.GetRandomVector(); } newProgrammer.transform.position = randomVector; newProgrammer.Ability = programmerSpec.Ability; foreach (var activeSkill in newProgrammer.Ability.AcquiredActiveSkills) { activeSkill.ResetStageParameters(); } newProgrammer.Status = programmerSpec.Status; newProgrammer.Status.ResetStageParameters(); programmerPositions.Add(randomVector); Programmers.Add(newProgrammer); } }