本文整理汇总了C#中CelestialBody.is_root方法的典型用法代码示例。如果您正苦于以下问题:C# CelestialBody.is_root方法的具体用法?C# CelestialBody.is_root怎么用?C# CelestialBody.is_root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CelestialBody
的用法示例。
在下文中一共展示了CelestialBody.is_root方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Name
public static String Name(FrameType type, CelestialBody selected) {
switch (type) {
case FrameType.BODY_CENTRED_NON_ROTATING:
return selected.name + "-Centred Inertial";
case FrameType.BARYCENTRIC_ROTATING:
if (selected.is_root()) {
throw Log.Fatal("Naming barycentric rotating frame of root body");
} else {
return selected.referenceBody.name + "-" + selected.name +
" Barycentric";
}
case FrameType.BODY_CENTRED_PARENT_DIRECTION:
if (selected.is_root()) {
throw Log.Fatal(
"Naming parent-direction rotating frame of root body");
} else {
// TODO(egg): find a proper name...
return selected.name + "-Centred " + selected.referenceBody.name +
"-Fixed";
}
case FrameType.BODY_SURFACE:
return selected.name + "-Centred " + selected.name + "-Fixed";
default:
throw Log.Fatal("Unexpected type " + type.ToString());
}
}
示例2: Name
public static String Name(FrameType type, CelestialBody selected) {
switch (type) {
case FrameType.BODY_CENTRED_NON_ROTATING:
return selected.name + "-Centred Inertial";
case FrameType.BARYCENTRIC_ROTATING:
if (selected.is_root()) {
throw Log.Fatal("Naming barycentric rotating frame of root body");
} else {
return selected.referenceBody.name + "-" + selected.name +
" Barycentric";
}
default:
throw Log.Fatal("Unexpected type " + type.ToString());
}
}
示例3: RenderSubtree
private void RenderSubtree(CelestialBody celestial, int depth) {
// Horizontal offset between a node and its children.
const int offset = 20;
UnityEngine.GUILayout.BeginHorizontal();
if (!celestial.is_root()) {
UnityEngine.GUILayout.Label(
"",
UnityEngine.GUILayout.Width(offset * (depth - 1)));
string button_text;
if (celestial.is_leaf()) {
button_text = "";
} else if (expanded_[celestial]) {
button_text = "-";
} else {
button_text = "+";
}
if (UnityEngine.GUILayout.Button(button_text,
UnityEngine.GUILayout.Width(offset))) {
Shrink();
expanded_[celestial] = !expanded_[celestial];
}
}
if (UnityEngine.GUILayout.Toggle(selected_celestial_ == celestial,
celestial.name)) {
if (selected_celestial_ != celestial) {
selected_celestial_ = celestial;
on_change_(FrameParameters());
}
}
UnityEngine.GUILayout.EndHorizontal();
if (celestial.is_root() || (!celestial.is_leaf() && expanded_[celestial])) {
foreach (CelestialBody child in celestial.orbitingBodies) {
RenderSubtree(child, depth + 1);
}
}
}
示例4: Description
public static String Description(FrameType type, CelestialBody selected) {
switch (type) {
case FrameType.BODY_CENTRED_NON_ROTATING:
return "Non-rotating reference frame fixing the centre of " +
selected.theName;
case FrameType.BARYCENTRIC_ROTATING:
if (selected.is_root()) {
throw Log.Fatal("Describing barycentric rotating frame of root body");
} else {
return "Reference frame fixing the barycentre of " +
selected.theName + " and " + selected.referenceBody.theName +
", the plane in which they move about the barycentre, and" +
" the line between them";
}
default:
throw Log.Fatal("Unexpected type " + type.ToString());
}
}
示例5: ShortName
public static String ShortName(FrameType type, CelestialBody selected) {
switch (type) {
case FrameType.BODY_CENTRED_NON_ROTATING:
return selected.name[0] + "CI";
case FrameType.BARYCENTRIC_ROTATING:
if (selected.is_root()) {
throw Log.Fatal(
"Naming parent-direction rotating frame of root body");
} else {
return selected.referenceBody.name[0] + (selected.name[0] + "B");
}
case FrameType.BODY_CENTRED_PARENT_DIRECTION:
if (selected.is_root()) {
throw Log.Fatal("Naming barycentric rotating frame of root body");
} else {
return selected.name[0] + "C" + selected.referenceBody.name[0] +
"F";
}
case FrameType.BODY_SURFACE:
return selected.name[0] + "C" + selected.name[0] + "F";
default:
throw Log.Fatal("Unexpected type " + type.ToString());
}
}