예제 #1
0
 public void OnLoad(ConfigNode crewConfig)
 {
     Name = crewConfig.GetValue("Name");
     double.TryParse(crewConfig.GetValue("Bonus"), out bonusAwaitingPayment);
     double.TryParse(crewConfig.GetValue("RetirementDate"), out retirementDate);
     if (retirementDate == -1 && SettingsClass.Instance.RetirementEnabled)
     {
         retirementDate = Utilities.Instance.Randomise.Next(SettingsClass.Instance.MinimumTerm, SettingsClass.Instance.MaximumTerm) * FlightGlobals.GetHomeBody().orbit.period + Planetarium.GetUniversalTime();
     }
     else if (!SettingsClass.Instance.RetirementEnabled)
     {
         retirementDate = -1;
     }
     if (!crewConfig.TryGetValue("WageModifier", ref WageModifier))
     {
         WageModifier = 1.0f;
     }
     ConfigNode[] unhappyNodes = crewConfig.GetNodes("UNHAPPINESS");
     for (int i = 0; i < unhappyNodes.Length; i++)
     {
         CrewUnhappiness cu = new CrewUnhappiness("loading", this);
         cu.OnLoad(unhappyNodes.ElementAt(i));
         UnhappinessEvents.Add(cu);
         Unhappy = true;
     }
 }
예제 #2
0
 public void MonthWithoutIncident()
 {
     for (int i = UnhappinessEvents.Count - 1; i >= 0; i--)
     {
         CrewUnhappiness cu = UnhappinessEvents.ElementAt(i);
         if (cu.ClearStrike())
         {
             UnhappinessEvents.Remove(cu);
         }
     }
 }
예제 #3
0
        public void OnSave(ConfigNode crewManagerNode)
        {
            ConfigNode crewNode = new ConfigNode("CREW_MEMBER");

            crewNode.SetValue("Name", Name, true);
            crewNode.SetValue("Bonus", bonusAwaitingPayment, true);
            crewNode.SetValue("WageModifier", WageModifier, true);
            crewNode.SetValue("RetirementDate", retirementDate, true);
            for (int i = 0; i < UnhappinessEvents.Count; i++)
            {
                CrewUnhappiness cu = UnhappinessEvents.ElementAt(i);
                cu.OnSave(crewNode);
            }
            crewManagerNode.AddNode(crewNode);
        }