public void ProcessDeadKerbal(ProtoCrewMember crewMember) { Kerbals.Remove(crewMember.name); if (LossAlreadyProcessed(crewMember)) { return; } for (int i = 0; i < Kerbals.Count; i++) { CrewMember c = Kerbals.ElementAt(i).Value; if (Utilities.Instance.Randomise.NextDouble() < c.CrewReference().courage) { continue; } string lostVessel = crewMember.name; if (CrewOnValidVessel(crewMember)) { lostVessel = crewMember.seat.vessel.vesselName; } c.AddUnhappiness("Loss of " + lostVessel); Debug.Log("[Bureaucracy]: Unhappiness event registered for " + crewMember.name + ": Dead Kerbal"); } float penalty = Reputation.Instance.reputation * (SettingsClass.Instance.DeadKerbalPenalty / 100.0f); Reputation.Instance.AddReputation(-penalty, TransactionReasons.VesselLoss); Debug.Log("[Bureaucracy]: Dead Kerbal Penalty Applied"); }
public void ProcessUnpaidKerbals(List <CrewMember> unpaidKerbals) { for (int i = 0; i < unpaidKerbals.Count; i++) { CrewMember c = Kerbals.ElementAt(i).Value; c.AddUnhappiness("not being paid"); Debug.Log("[Bureaucracy]: Adding new unpaid crew member " + c.Name); } }
public int Bonuses(double availableFunding, bool clearBonuses) { int bonus = 0; for (int i = 0; i < Kerbals.Count; i++) { CrewMember c = Kerbals.ElementAt(i).Value; int bonusToProcess = c.GetBonus(clearBonuses); if (clearBonuses && bonusToProcess > 0 && availableFunding < bonusToProcess) { c.AddUnhappiness("not being paid"); } else { bonus += bonusToProcess; } availableFunding -= bonus; } lastBonus = bonus; return(bonus); }