void ChangeCurrentRole(PD_CrewAssignment.Role role) { // update the current position index m_currentRole = role; // get access to the crew assignment player data PD_CrewAssignment crewAssignment = DataController.m_instance.m_playerData.m_crewAssignment; // check if we have don't have someone assigned to this position if (!crewAssignment.IsAssigned(m_currentRole)) { // automatically select the first personnel file ChangeCurrentPersonnelId(0, true); } else { // get the current file id for this position int fileId = crewAssignment.GetFileId(m_currentRole); // get access to the personnel player data PD_Personnel personnel = DataController.m_instance.m_playerData.m_personnel; // update the current personnel id m_currentPersonnelId = personnel.GetPersonnelId(fileId); } // play a sound SoundController.m_instance.PlaySound(SoundController.Sound.Update); }
// update the assigned crewmember list void UpdateAssignedCrewmemberList() { // get access to the crew assignment player data PD_CrewAssignment crewAssignment = DataController.m_instance.m_playerData.m_crewAssignment; // start with an empty text string m_positionValuesText.text = ""; // go through each position for (PD_CrewAssignment.Role role = PD_CrewAssignment.Role.First; role < PD_CrewAssignment.Role.Count; role++) { // get the file id for the assigned crewmember if (crewAssignment.IsAssigned(role)) { // get the personnel file for that role PD_Personnel.PD_PersonnelFile personnelFile = crewAssignment.GetPersonnelFile(role); // add the crewmember's name m_positionValuesText.text += personnelFile.m_name; } else { // add the not assigned text m_positionValuesText.text += "[Not Assigned]"; } if (role < (PD_CrewAssignment.Role.Count - 1)) { m_positionValuesText.text += Environment.NewLine; } } }