/// <summary> /// Discards the given random mission. /// Removed it from the random missions list /// </summary> /// <param name="m">M.</param> public void discardRandomMission(Mission m) { if (m.randomized) { RandomMission rm = currentProgram.findRandomMission(m); if (rm != null) { currentProgram.randomMissions.Remove(rm); } } }
/// <summary> /// Reloads the given mission for the given vessel. Checks for already finished mission goals /// and reexecutes the instructions. /// </summary> /// <returns>reloaded mission</returns> /// <param name="m">mission</param> /// <param name="vessel">vessel</param> public Mission reloadMission(Mission m, Vessel vessel) { int count = 1; if (m.randomized) { RandomMission rm = currentProgram.findRandomMission(m); System.Random random = null; if (rm == null) { rm = new RandomMission(); rm.seed = new System.Random().Next(); rm.missionName = m.name; currentProgram.add(rm); } random = new System.Random(rm.seed); m.executeInstructions(random); } else { // Maybe there are some instructions. We have to execute them!!! m.executeInstructions(new System.Random()); } foreach (MissionGoal c in m.goals) { c.id = m.name + "__PART" + (count++); c.repeatable = m.repeatable; c.doneOnce = false; } if (vessel != null) { foreach (MissionGoal g in m.goals) { if (isMissionGoalAlreadyFinished(g, vessel) && g.nonPermanent) { g.doneOnce = true; } } } return(m); }
public void add(RandomMission mission) { randomMissions.Add(mission); }
/// <summary> /// Reloads the given mission for the given vessel. Checks for already finished mission goals /// and reexecutes the instructions. /// </summary> /// <returns>reloaded mission</returns> /// <param name="m">mission</param> /// <param name="vessel">vessel</param> public Mission reloadMission(Mission m, Vessel vessel) { int count = 1; if (m.randomized) { RandomMission rm = currentProgram.findRandomMission (m); System.Random random = null; if (rm == null) { rm = new RandomMission (); rm.seed = new System.Random ().Next (); rm.missionName = m.name; currentProgram.add (rm); } random = new System.Random (rm.seed); m.executeInstructions (random); } else { // Maybe there are some instructions. We have to execute them!!! m.executeInstructions (new System.Random()); } foreach(MissionGoal c in m.goals) { c.id = m.name + "__PART" + (count++); c.repeatable = m.repeatable; c.doneOnce = false; } if (vessel != null) { foreach (MissionGoal g in m.goals) { if(isMissionGoalAlreadyFinished(g, vessel) && g.nonPermanent) { g.doneOnce = true; } } } return m; }
public void add(RandomMission mission) { randomMissions.Add(mission); }