本文整理汇总了C#中ShipConstruct类的典型用法代码示例。如果您正苦于以下问题:C# ShipConstruct类的具体用法?C# ShipConstruct怎么用?C# ShipConstruct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShipConstruct类属于命名空间,在下文中一共展示了ShipConstruct类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HackStrutCData
private static void HackStrutCData(ShipConstruct ship, Part p,
int part_base)
{
//Debug.Log (String.Format ("[EL] before {0}", p.customPartData));
string[] Params = p.customPartData.Split (';');
for (int i = 0; i < Params.Length; i++) {
string[] keyval = Params[i].Split (':');
string Key = keyval[0].Trim ();
string Value = keyval[1].Trim ();
if (Key == "tgt") {
string[] pnameval = Value.Split ('_');
string pname = pnameval[0];
int val = int.Parse (pnameval[1]);
if (val == -1) {
Strut strut = new Strut (p, Params);
if (strut.target != null) {
val = ship.parts.IndexOf (strut.target);
}
}
if (val != -1) {
val += part_base;
}
Params[i] = "tgt: " + pname + "_" + val.ToString ();
break;
}
}
p.customPartData = String.Join ("; ", Params);
//Debug.Log (String.Format ("[EL] after {0}", p.customPartData));
}
示例2: KCT_BuildListVessel
public KCT_BuildListVessel(ShipConstruct s, String ls, double bP, String flagURL)
{
ship = s;
shipNode = s.SaveShip();
shipName = s.shipName;
//Get total ship cost
float dry, fuel;
s.GetShipCosts(out dry, out fuel);
cost = dry + fuel;
TotalMass = 0;
foreach (Part p in s.Parts)
{
TotalMass += p.mass;
TotalMass += p.GetResourceMass();
}
launchSite = ls;
buildPoints = bP;
progress = 0;
flag = flagURL;
if (launchSite == "LaunchPad")
type = ListType.VAB;
else
type = ListType.SPH;
InventoryParts = new Dictionary<string, int>();
id = Guid.NewGuid();
cannotEarnScience = false;
}
示例3: CaptureThumbnail
public static void CaptureThumbnail(ShipConstruct ship, int resolution,
float elevation, float azimuth, float pitch, float heading, float fov, string saveFolder, string craftName)
{
Log.Info ("CaptureThumbnail elevation: " + elevation.ToString () + " azimuth: " + azimuth.ToString () + "pitch: " + pitch.ToString () +
" heading: " + heading.ToString () + " fov: " + fov.ToString ());
CraftThumbnail.TakeSnaphot(ship, resolution, saveFolder, craftName, elevation, azimuth, pitch, heading, fov);
}
示例4: CheckVessel
public void CheckVessel(ShipConstruct ship)
{
if (!MainInstance.checklistSelected)
return;
if (EditorLogic.RootPart == null || (MainInstance.partSelection == null && MainInstance.checkSelected))
{
ActiveChecklist.items.ForEach(i => i.state = false);
return;
}
if (MainInstance.checkSelected && MainInstance.partSelection != null)
partsToCheck = MainInstance.partSelection.selectedParts.Intersect(ship.Parts).ToList();
else
partsToCheck = ship.Parts;
for (int j = 0; j < activeChecklist.items.Count; j++)
//foreach (ChecklistItem item in activeChecklist.items)
{
ChecklistItem item = activeChecklist.items[j];
if (item.isManual)
continue;
item.state = true;
for (int i = 0; i < item.criteria.Count; i++)
//foreach(Criterion crton in item.criteria)
{
Criterion crton = item.criteria[i];
switch (crton.type)
{
case CriterionType.Module:
crton.met = CheckForModules(crton);
break;
case CriterionType.Part:
crton.met = CheckForParts(crton);
break;
case CriterionType.MinResourceLevel:
crton.met = CheckForResourceLevel(crton);
break;
case CriterionType.MinResourceCapacity:
crton.met = CheckForResourceCapacity(crton);
break;
case CriterionType.CrewMember:
crton.met = CheckForCrewMember(crton);
break;
}
item.criteria[i] = crton;
}
if (!item.allRequired)
{
if (item.criteria.TrueForAll(c => !c.met))
item.state = false;
}
else if (item.criteria.Any(c => !c.met))
item.state = false;
activeChecklist.items[j] = item;
continue;
}
}
示例5: OnLoad
private void OnLoad(ShipConstruct data0, CraftBrowser.LoadType data1)
{
if(data1 == CraftBrowser.LoadType.Normal)
{
ShipConcerns.Clear();
SectionConcerns.Clear();
}
}
示例6: EditorLoad
private void EditorLoad(ShipConstruct data0, CraftBrowser.LoadType data1)
{
switch (data1)
{
case CraftBrowser.LoadType.Merge:
RenameSections(data0);
break;
}
}
示例7: LoadConstruct
public bool LoadConstruct()
{
UnloadConstruct();
construct = new ShipConstruct();
if(!construct.LoadShip(vessel_node))
{
UnloadConstruct();
return false;
}
return true;
}
示例8: HackStruts
public static void HackStruts(ShipConstruct ship, int part_base)
{
var all_struts = ship.parts.OfType<StrutConnector>();
var struts = all_struts.Where (p => p.customPartData != "");
foreach (Part part in struts) {
HackStrutCData (ship, part, part_base);
}
var all_fuelLines = ship.parts.OfType<FuelLine>();
var fuelLines = all_fuelLines.Where (p => p.customPartData != "");
foreach (Part part in fuelLines) {
HackStrutCData (ship, part, part_base);
}
}
示例9: KCT_BuildListVessel
public KCT_BuildListVessel(String name, String ls, double bP, String flagURL, float spentFunds)
{
ship = new ShipConstruct();
launchSite = ls;
shipName = name;
buildPoints = bP;
progress = 0;
flag = flagURL;
if (launchSite == "LaunchPad")
type = ListType.VAB;
else
type = ListType.SPH;
InventoryParts = new List<string>();
cannotEarnScience = false;
cost = spentFunds;
}
示例10: GetAABB
// Thanks to taniwha's Extraplanetary launchpads!
public Bounds GetAABB(ShipConstruct a_Ship)
{
PartHeightQuery partHeight = null;
Bounds aabb = new Bounds();
bool initialize = true;
for (int i = 0; i < a_Ship.parts.Count; i++)
{
Part currentPart = a_Ship[i];
Collider[] colliders = currentPart.transform.FindChild("model").GetComponentsInChildren<Collider>();
for (int j = 0; j < colliders.Length; j++)
{
Collider currentCollider = colliders[j];
if (currentCollider.gameObject.layer != 21 && currentCollider.enabled) // Not sure where the 21 is coming from, have to ask taniwha
{
if (initialize)
{
initialize = false;
aabb = currentCollider.bounds;
}
else
{
aabb.Add(currentCollider.bounds);
}
float lowest = currentCollider.bounds.min.y;
if(partHeight == null)
{
partHeight = new PartHeightQuery(lowest);
}
partHeight.lowestPoint = Mathf.Min(partHeight.lowestPoint, lowest);
if(partHeight.lowestOnParts.ContainsKey(currentPart))
{
partHeight.lowestOnParts[currentPart] = Mathf.Min(partHeight.lowestOnParts[currentPart], lowest);
}
}
}
}
for(int i = 0; i < a_Ship.parts.Count; i++)
{
a_Ship[i].SendMessage("OnPutToGround", partHeight, SendMessageOptions.DontRequireReceiver);
}
return new Bounds();
}
示例11: PlaceShip
public Transform PlaceShip(ShipConstruct a_Ship, Bounds a_Bounds)
{
Transform launchTransform = GetLaunchTransform();
float angle;
Vector3 axis;
launchTransform.rotation.ToAngleAxis(out angle, out axis);
Part rootPart = a_Ship.parts[0].localRoot;
Vector3 pos = rootPart.transform.position;
Vector3 shift = new Vector3(-pos.x, -a_Bounds.min.y, -pos.z);
shift += launchTransform.position;
rootPart.transform.Translate(shift, Space.World);
rootPart.transform.RotateAround(launchTransform.position, axis, angle);
return launchTransform;
}
示例12: OnEditorShipModified
private void OnEditorShipModified(ShipConstruct shipConstruct)
{
if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX || ResearchAndDevelopment.Instance == null)
return;
int maxParts = maxPartCount();
if (shipConstruct.Parts.Count > maxParts)
{
warningMsg = "This vessel has too many parts to be built and launched at the current tech level.\nCurrent maximum is " + maxParts + ", this vessel has " + shipConstruct.Parts.Count + " parts.";
//ScreenMessages.PostScreenMessage(warningMsg, 15F, ScreenMessageStyle.UPPER_CENTER);
lockLaunchButton = true;
} else {
warningMsg = "";
if (shipConstruct.Parts.Count > 0)
lockLaunchButton = false;
else
lockLaunchButton = true;
}
}
示例13: KCT_BuildListVessel
public KCT_BuildListVessel(ShipConstruct s, String ls, double bP, String flagURL)
{
ship = s;
shipNode = s.SaveShip();
shipName = s.shipName;
//Get total ship cost
float fuel;
cost = s.GetShipCosts(out emptyCost, out fuel);
TotalMass = s.GetShipMass(out emptyMass, out fuel);
launchSite = ls;
buildPoints = bP;
progress = 0;
flag = flagURL;
if (s.shipFacility == EditorFacility.VAB)
type = ListType.VAB;
else if (s.shipFacility == EditorFacility.SPH)
type = ListType.SPH;
else
type = ListType.None;
InventoryParts = new Dictionary<string, int>();
id = Guid.NewGuid();
cannotEarnScience = false;
}
示例14: WaitAndRebuildList
private IEnumerator WaitAndRebuildList (ShipConstruct ship)
{
yield return null;
buildCost = null;
parts_count = 0;
if (ship == null || ship.parts == null || ship.parts.Count < 1
|| ship.parts[0] == null) {
yield break;
}
if (ship.parts.Count > 0) {
Part root = ship.parts[0].localRoot;
buildCost = new BuildCost ();
addPart (root);
foreach (Part p in root.GetComponentsInChildren<Part>()) {
if (p != root) {
addPart (p);
}
}
}
}
示例15: onEditorVesselModified
/// <summary>
/// Event callback for when vessel is modified in the editor. Used to know when the gui-fields for this module have been updated.
/// </summary>
/// <param name="ship"></param>
public void onEditorVesselModified(ShipConstruct ship)
{
if (!HighLogic.LoadedSceneIsEditor) { return; }
bool updated = false;
if (prevEditorTankHeightAdjust != editorTankHeightAdjust)
{
prevEditorTankHeightAdjust = editorTankHeightAdjust;
float newHeight = editorTankHeight + (tankHeightIncrement * editorTankHeightAdjust);
newHeight *= (currentTankDiameter / defaultTankDiameter);
updateTankHeightFromEditor(newHeight, true);
updated = true;
}
if (prevEditorTankDiameterAdjust != editorTankDiameterAdjust)
{
prevEditorTankDiameterAdjust = editorTankDiameterAdjust;
float newDiameter = editorTankDiameter + (editorTankDiameterAdjust * tankDiameterIncrement);
setTankDiameterFromEditor(newDiameter, true);
updated = true;
}
if (!updated)
{
updateNodePositions(true);
}
}