/// <summary> /// Update the actions of the ground crew using <c>CrewHandler.groundGunnerHandler</c>. /// </summary> private void updateGroundCrewActions() { // iterate over each groundCrew that is being tracked var crew = groundCrew.Keys; for (int i = 0; i < crew.Count; i++) { // check if the NPC is dead; if so, remove from list and continue Ped p = crew.ElementAt(i); if (p.IsDead) { CrewHandler.crewDestructor(p); groundCrew.Remove(p); continue; } } }
/// <summary> /// Script destructor; cleans up assets created by the script as necessary /// </summary> /// <param name="force"></param> private void cleanUp(bool force) { // try to clean up helis try { attackHeli.destructor(force); supportHeli.destructor(force); strafeRun.destructor(force); } catch { } // clean up any ground crew PedGroup playerPedGrp = Game.Player.Character.PedGroup; foreach (Ped p in groundCrew.Keys.ToArray()) { playerPedGrp.Remove(p); // remove the ped from player's PedGroup CrewHandler.crewDestructor(p, force); } }