// Gather the Cl of all our children for connection strength calculations. public void GatherChildrenCl() { ChildrenCl = 0; // Add up the Cl and ChildrenCl of all our children to our ChildrenCl foreach (Part p in this.part.children) { WingManipulator child = p.Modules.OfType <WingManipulator>().FirstOrDefault(); if (child != null) { ChildrenCl += child.Cl; ChildrenCl += child.ChildrenCl; } } // If parent is a pWing, trickle the call to gather ChildrenCl down to them. if (this.part.parent != null) { WingManipulator Parent = this.part.parent.Modules.OfType <WingManipulator>().FirstOrDefault(); if (Parent != null) { Parent.GatherChildrenCl(); } } }
// Updates child pWings public void UpdateChildren() { // Get the list of child parts foreach (Part p in this.part.children) { // Check that it is a pWing and that it is affected by parent snapping WingManipulator wing = p.Modules.OfType <WingManipulator>().FirstOrDefault(); if (wing != null && !wing.IgnoreSnapping && !wing.doNotParticipateInParentSnapping) { // Update its positions and refresh the collider wing.UpdatePositions(); wing.SetupCollider(); // If its a wing, refresh its aerodynamic values if (isWing || isCtrlSrf) // FIXME should this be child.isWing etc? { wing.CalculateAerodynamicValues(); } } } }
protected bool triggerUpdate = false; // if this is true, an update will be done and it set false. // this will set the triggerUpdate field true on all wings on the vessel. public void TriggerUpdateAllWings() { List <Part> plist = new List <Part>(); if (HighLogic.LoadedSceneIsEditor) { plist = EditorLogic.SortedShipList; } else { plist = part.vessel.Parts; } for (int i = 0; i < plist.Count; i++) { WingManipulator wing = plist[i].Modules.OfType <WingManipulator>().FirstOrDefault(); if (wing != null) { wing.triggerUpdate = true; } } }