private void Awake()
    {
        //clone configs on startup so we don't modify the global assets
        questBoard = QuestBoard.Create(questBoard);
        crewConfig = CrewConfiguration.Create(crewConfig);
        cargoConfig = Instantiate(cargoConfig);
        missionsConfig = Instantiate(missionsConfig);
        market = Instantiate(market);
        fleetManager = Instantiate(fleetManager);

        Debug.Assert(worldMap);

        SceneManager.activeSceneChanged += (oldScene, newScene) =>
        {
            PlayerNotifications.Clear();
        };

        FindObjectOfType<MissionManager>().OnMissionChanged += mission =>
        {
            if (mission)
            {
                LocalPlayer = null;
            }
            else
            {
                LocalPlayer = FindObjectOfType<PlayerShip>();
            }
        };

        //apply initial settings
        ReloadPrefs();
    }
 public ScriptingContext(CrewConfiguration crewConfiguration)
 {
     _storage = new Dictionary <string, Dictionary <string, double> >();
     using (var stream = Core.Support.GetDefaultStatesStream())
         using (var xmlReader = XmlReader.Create(stream))
             this.Element = XElement.Load(xmlReader);
     _crewConfiguration = crewConfiguration;
 }
    public static CrewConfiguration Create(CrewConfiguration prefab)
    {
        var result = Instantiate(prefab);

        Debug.Assert(result.Portraits.Contains(result.DefaultPortrait), "crew config portrait list must contain the default portrait");

        result.forenames = LoadNamesFromTextAsset(result.forenameList);
        result.surnames = LoadNamesFromTextAsset(result.surnameList);
        
        result.characters = new List<CrewMember>();

        return result;
    }