public SubjectsContainer(BodyContainer parent, SituationsBiomesSubject situationsSubjects) : base(parent)
 {
     foreach (ObjectPair <ScienceSituation, BiomesSubject> situation in situationsSubjects)
     {
         Situations.Add(new SituationContainer(situation));
     }
 }
Esempio n. 2
0
 public void Apply(int rotationChange, int powerChange, MarsLanderEnvironment environment)
 {
     if (Status != LanderStatus.Flying) return;
     if (Situation.Fuel < Situation.Power + powerChange) powerChange = 0;
     if (Situation.Fuel < Situation.Power) powerChange = -1;
     Situation.Power += LimitPower(powerChange);
     Situation.Rotation += LimitRotation(rotationChange);
     Situation.Fuel -= Situation.Power;
     Situation.HorizontalSpeed += Trigonometry.GetHorizontalSpeedFraction(Situation.Rotation, ZeroDegreesDirection.Top) * Situation.Power;
     if (Situation.HorizontalSpeed > MarsLanderRules.MaxHorizontalSpeed)
         Situation.HorizontalSpeed = MarsLanderRules.MaxHorizontalSpeed;
     if (Situation.HorizontalSpeed < MarsLanderRules.MinHorizontalSpeed)
         Situation.HorizontalSpeed = MarsLanderRules.MinHorizontalSpeed;
     Situation.VerticalSpeed += Trigonometry.GetVerticalSpeedFraction(Situation.Rotation, ZeroDegreesDirection.Top) * Situation.Power - MarsLanderRules.Gravity;
     if (Situation.VerticalSpeed > MarsLanderRules.MaxVerticalSpeed)
         Situation.VerticalSpeed = MarsLanderRules.MaxVerticalSpeed;
     if (Situation.VerticalSpeed < MarsLanderRules.MinVerticalSpeed)
         Situation.VerticalSpeed = MarsLanderRules.MinVerticalSpeed;
     Situation.X += Situation.HorizontalSpeed;
     Situation.Y += Situation.VerticalSpeed;
     RoundValues();
     Situations.Add(Situation.Clone());
     Actions.Add($"{rotationChange} {powerChange}");
     SetStatus(environment);
 }