本文整理汇总了C#中KerbalKonstructs.StaticObjects.StaticObject类的典型用法代码示例。如果您正苦于以下问题:C# StaticObject类的具体用法?C# StaticObject怎么用?C# StaticObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StaticObject类属于KerbalKonstructs.StaticObjects命名空间,在下文中一共展示了StaticObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: addStatic
public void addStatic(StaticObject obj)
{
String bodyName = ((CelestialBody) obj.getSetting("CelestialBody")).bodyName;
String groupName = (string) obj.getSetting("Group");
//Debug.Log("Creating object in group " + obj.groupName);
if (!groupList.ContainsKey(bodyName))
groupList.Add(bodyName, new Dictionary<string, StaticGroup>());
if (!groupList[bodyName].ContainsKey(groupName))
{
//StaticGroup group = new StaticGroup(bodyName, groupName);
StaticGroup group = new StaticGroup(groupName, bodyName);
//Ungrouped objects get individually cached. New acts the same as Ungrouped but stores unsaved statics instead.
if (groupName == "Ungrouped")
{
group.alwaysActive = true;
//group.active = true;
}
group.active = true;
groupList[bodyName].Add(groupName, group);
}
groupList[bodyName][groupName].addStatic(obj);
}
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:28,代码来源:StaticDatabase.cs
示例2: changeGroup
public void changeGroup(StaticObject obj, string newGroup)
{
String bodyName = ((CelestialBody)obj.getSetting("CelestialBody")).bodyName;
String groupName = (string)obj.getSetting("Group");
groupList[bodyName][groupName].removeStatic(obj);
obj.setSetting("Group", newGroup);
addStatic(obj);
}
开发者ID:USAF21056,项目名称:Kerbal-Konstructs,代码行数:9,代码来源:StaticDatabase.cs
示例3: deleteObject
public void deleteObject(StaticObject obj)
{
if (selectedObject == obj)
{
deselectObject();
}
staticDB.deleteObject(obj);
}
开发者ID:USAF21056,项目名称:Kerbal-Konstructs,代码行数:9,代码来源:KerbalKonstructs.cs
示例4: CacheHangaredCraft
public static void CacheHangaredCraft(StaticObject obj)
{
string sInStorage = (string)obj.getSetting("InStorage");
string sInStorage2 = (string)obj.getSetting("TargetID");
string sInStorage3 = (string)obj.getSetting("TargetType");
foreach (Vessel vVesselStored in FlightGlobals.Vessels)
{
if (vVesselStored == null) continue;
if (!vVesselStored.loaded) continue;
if (vVesselStored.vesselType == VesselType.SpaceObject) continue;
if (vVesselStored.vesselType == VesselType.Debris) continue;
if (vVesselStored.vesselType == VesselType.EVA) continue;
if (vVesselStored.vesselType == VesselType.Flag) continue;
if (vVesselStored.vesselType == VesselType.Unknown) continue;
string sHangarSpace = "None";
// If a vessel is hangared
if (vVesselStored.id.ToString() == sInStorage)
sHangarSpace = "InStorage";
if (vVesselStored.id.ToString() == sInStorage2)
sHangarSpace = "TargetID";
if (vVesselStored.id.ToString() == sInStorage3)
sHangarSpace = "TargetType";
if (sHangarSpace != "None")
{
if (vVesselStored == FlightGlobals.ActiveVessel)
{
// Craft has been taken control
// Empty the hangar
obj.setSetting(sHangarSpace, "None");
PersistenceUtils.saveStaticPersistence(obj);
}
else
{
// Hide the vessel - it is in the hangar
if (vVesselStored != null)
{
foreach (Part p in vVesselStored.Parts)
{
if (p != null && p.gameObject != null)
p.gameObject.SetActive(false);
else
continue;
}
vVesselStored.MakeInactive();
vVesselStored.enabled = false;
if (vVesselStored.loaded)
vVesselStored.Unload();
}
}
}
}
}
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:57,代码来源:HangarGUI.cs
示例5: drawManager
public void drawManager(StaticObject obj)
{
KKWindow = new GUIStyle(GUI.skin.window);
KKWindow.padding = new RectOffset(3, 3, 5, 5);
if (obj != null)
{
if (selectedObject != obj)
EditorGUI.updateSelection(obj);
}
managerRect = GUI.Window(0xB00B1E2, managerRect, drawBaseManagerWindow, "", KKWindow);
}
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:13,代码来源:BaseBossFlight.cs
示例6: NearestBarracks
public static StaticObject NearestBarracks(StaticObject selectedFacility, bool bUnassigned = true)
{
StaticObject soNearest = null;
float fKerbals = 0f;
foreach (StaticObject obj in KerbalKonstructs.instance.getStaticDB().getAllStatics())
{
//if ((string)obj.model.getSetting("DefaultFacilityType") == "None") continue;
if ((string)obj.getSetting("FacilityType") != "Barracks")
{
if ((string)obj.model.getSetting("DefaultFacilityType") != "Barracks") continue;
}
if (obj.pqsCity.sphere == FlightGlobals.currentMainBody.pqsController)
{
var dist = Vector3.Distance(selectedFacility.gameObject.transform.position, obj.gameObject.transform.position);
if (dist > 5000f) continue;
}
else
continue;
if (bUnassigned)
{
fKerbals = (float)obj.getSetting("ProductionRateCurrent");
if (fKerbals < 1) continue;
else
{
soNearest = obj;
break;
}
}
else
{
if ((float)obj.getSetting("StaffCurrent") == 1) continue;
if (((float)obj.getSetting("StaffCurrent") -1) == (float)obj.getSetting("ProductionRateCurrent"))
continue;
else
{
soNearest = obj;
break;
}
}
}
return soNearest;
}
开发者ID:Kerbas-ad-astra,项目名称:Kerbal-Konstructs_DEV,代码行数:49,代码来源:StaffGUI.cs
示例7: StationHasLOS
public static float StationHasLOS(StaticObject soFacility, Vessel vVessel)
{
if (vVessel == null || soFacility == null)
{
Debug.Log("KK: StationHasLOS borked");
return 0f;
}
float fHasLOS = 0f;
Vector3d FacPos = soFacility.gameObject.transform.position;
Vector3d VesselPos = vVessel.gameObject.transform.position;
Vector3d vDirection = (VesselPos - FacPos);
float fAngle = Vector3.Angle(soFacility.gameObject.transform.up, vDirection);
fHasLOS = fAngle;
return fHasLOS;
}
开发者ID:ThomasKerman,项目名称:Kerbal-Konstructs_DEV,代码行数:19,代码来源:TrackingStationGUI.cs
示例8: doFuelIn
public static void doFuelIn(StaticObject selectedObject)
{
if (SelectedResource == null) return;
if (SelectedTank == null) return;
string sResource1 = getResourceAlt(selectedObject, "LiquidFuel");
string sResource2 = getResourceAlt(selectedObject, "Oxidizer");
string sResource3 = getResourceAlt(selectedObject, "Monopropellant");
if (SelectedResource.resourceName == sResource3 && !bMoFIn) return;
if (SelectedResource.resourceName == sResource1 && !bLqFIn) return;
if (SelectedResource.resourceName == sResource2 && !bOxFIn) return;
if (SelectedResource.resourceName == sResource3 && fMoFCurrent >= fMoFMax) return;
if (SelectedResource.resourceName == sResource1 && fLqFCurrent >= fLqFMax) return;
if (SelectedResource.resourceName == sResource2 && fOxFCurrent >= fOxFMax) return;
if (SelectedResource.amount <= 0) return;
float dStaticFuel;
SelectedResource.amount = SelectedResource.amount - fTransferRate;
if (SelectedResource.amount < 0) SelectedResource.amount = 0;
if (SelectedResource.resourceName == sResource3)
{
dStaticFuel = ((float)selectedObject.getSetting("MoFCurrent")) + fTransferRate;
if (dStaticFuel > fMoFMax) dStaticFuel = fMoFMax;
selectedObject.setSetting("MoFCurrent", dStaticFuel);
}
if (SelectedResource.resourceName == sResource1)
{
dStaticFuel = ((float)selectedObject.getSetting("LqFCurrent")) + fTransferRate;
if (dStaticFuel > fLqFMax) dStaticFuel = fLqFMax;
selectedObject.setSetting("LqFCurrent", dStaticFuel);
}
if (SelectedResource.resourceName == sResource2)
{
dStaticFuel = ((float)selectedObject.getSetting("OxFCurrent")) + fTransferRate;
if (dStaticFuel > fOxFMax) dStaticFuel = fOxFMax;
selectedObject.setSetting("OxFCurrent", dStaticFuel);
}
}
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:43,代码来源:FuelTanksGUI.cs
示例9: CreatePreviewInstance
public void CreatePreviewInstance(StaticModel model)
{
StaticObject obj = new StaticObject();
obj.gameObject = GameDatabase.Instance.GetModel(model.path + "/" + model.getSetting("mesh"));
obj.setSetting("RadiusOffset", (float)FlightGlobals.ActiveVessel.altitude);
obj.setSetting("CelestialBody", KerbalKonstructs.instance.getCurrentBody());
obj.setSetting("Group", "Ungrouped");
obj.setSetting("RadialPosition", KerbalKonstructs.instance.getCurrentBody().transform.InverseTransformPoint(FlightGlobals.ActiveVessel.transform.position));
obj.setSetting("RotationAngle", 0f);
obj.setSetting("Orientation", Vector3.up);
obj.setSetting("VisibilityRange", 25000f);
obj.model = model;
KerbalKonstructs.instance.getStaticDB().addStatic(obj);
obj.spawnObject(true, true);
// KerbalKonstructs.instance.selectObject(obj, false);
currPreview = obj;
}
开发者ID:ThomasKerman,项目名称:Kerbal-Konstructs_DEV,代码行数:19,代码来源:ModelInfo.cs
示例10: GetHangarSpace
public static string GetHangarSpace(StaticObject soHangar, int iMax = 2)
{
string sSpace = "None";
if ((string)soHangar.getSetting("InStorage") == "None")
{
sSpace = "InStorage";
if (iMax < 2) return sSpace;
}
else
if ((string)soHangar.getSetting("TargetID") == "None")
{
sSpace = "TargetID";
if (iMax == 2) return sSpace;
}
else
if ((string)soHangar.getSetting("TargetType") == "None")
sSpace = "TargetType";
return sSpace;
}
开发者ID:ThomasKerman,项目名称:Kerbal-Konstructs_DEV,代码行数:21,代码来源:FacilityManager.cs
示例11: DestroyPreviewInstance
public static void DestroyPreviewInstance(StaticObject soInstance)
{
if (soInstance != null)
{
if (currPreview != null)
{
if (currPreview == soInstance)
currPreview = null;
}
KerbalKonstructs.instance.deleteObject(soInstance);
}
else
{
if (currPreview != null)
{
KerbalKonstructs.instance.deleteObject(currPreview);
currPreview = null;
}
}
}
开发者ID:Kerbas-ad-astra,项目名称:Kerbal-Konstructs_DEV,代码行数:22,代码来源:ModelInfo.cs
示例12: HangarCraft
public static void HangarCraft(Vessel vVessel, StaticObject soHangar, int iMax = 2)
{
string sSpace = GetHangarSpace(soHangar, iMax);
if (sSpace == "None")
{
MiscUtils.HUDMessage("This facility is full.", 10,
3);
}
else
{
string sVesselID = vVessel.id.ToString();
soHangar.setSetting(sSpace, sVesselID);
PersistenceUtils.saveStaticPersistence(soHangar);
// Hangar the vessel - hide it
foreach (Part p in vVessel.Parts)
{
if (p != null && p.gameObject != null)
p.gameObject.SetActive(false);
else
continue;
}
vVessel.MakeInactive();
vVessel.enabled = false;
vVessel.Unload();
}
}
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:29,代码来源:HangarGUI.cs
示例13: StaffingInterface
public static void StaffingInterface(StaticObject selectedFacility)
{
LabelInfo = new GUIStyle(GUI.skin.label);
LabelInfo.normal.background = null;
LabelInfo.normal.textColor = Color.white;
LabelInfo.fontSize = 13;
LabelInfo.fontStyle = FontStyle.Bold;
LabelInfo.padding.left = 3;
LabelInfo.padding.top = 0;
LabelInfo.padding.bottom = 0;
BoxInfo = new GUIStyle(GUI.skin.box);
BoxInfo.normal.textColor = Color.cyan;
BoxInfo.fontSize = 13;
BoxInfo.padding.top = 2;
BoxInfo.padding.bottom = 1;
BoxInfo.padding.left = 5;
BoxInfo.padding.right = 5;
BoxInfo.normal.background = null;
ButtonSmallText = new GUIStyle(GUI.skin.button);
ButtonSmallText.fontSize = 12;
ButtonSmallText.fontStyle = FontStyle.Normal;
fStaff = (float)selectedFacility.getSetting("StaffCurrent");
fMaxStaff = (float)selectedFacility.getSetting("StaffMax");
bIsBarracks = false;
if ((string)selectedFacility.getSetting("FacilityType") == "Barracks")
bIsBarracks = true;
else
if ((string)selectedFacility.model.getSetting("DefaultFacilityType") == "Barracks")
bIsBarracks = true;
if (fMaxStaff < 1)
{
fMaxStaff = (float)selectedFacility.model.getSetting("DefaultStaffMax");
if (fMaxStaff < 1)
{
selectedFacility.setSetting("StaffMax", (float)0);
//PersistenceUtils.saveStaticPersistence(selectedFacility);
}
else
{
selectedFacility.setSetting("StaffMax", (float)fMaxStaff);
PersistenceUtils.saveStaticPersistence(selectedFacility);
}
}
if (fMaxStaff > 0)
{
float fHireFundCost = 5000;
float fFireRefund = 2500;
float fFireRepCost = 1;
bIsOpen = ((string)selectedFacility.getSetting("OpenCloseState") == "Open");
if (!bIsOpen)
{
iFundsOpen2 = (float)selectedFacility.model.getSetting("cost");
if (iFundsOpen2 == 0) bIsOpen = true;
}
GUILayout.Space(5);
float CountCurrent = fStaff;
float CountEmpty = fMaxStaff - fStaff;
float funassigned = (float)selectedFacility.getSetting("ProductionRateCurrent");
scrollPos = GUILayout.BeginScrollView(scrollPos, GUILayout.Height(58));
{
GUILayout.BeginHorizontal();
{
while (CountCurrent > 0)
{
GUILayout.Box(tKerbal, GUILayout.Width(23));
CountCurrent = CountCurrent - 1;
}
while (CountEmpty > 0)
{
GUILayout.Box(tNoKerbal, GUILayout.Width(23));
CountEmpty = CountEmpty - 1;
}
}
GUILayout.EndHorizontal();
}
GUILayout.EndScrollView();
GUI.enabled = bIsOpen;
if (!bIsBarracks)
{
GUILayout.Box("Assigned Staff: " + fStaff.ToString("#0") + "/" + fMaxStaff.ToString("#0"), BoxInfo);
}
if (bIsBarracks)
{
//.........这里部分代码省略.........
开发者ID:Kerbas-ad-astra,项目名称:Kerbal-Konstructs_DEV,代码行数:101,代码来源:StaffGUI.cs
示例14: UnassignToBarracks
public static void UnassignToBarracks(StaticObject selectedFacility)
{
selectedFacility.setSetting("ProductionRateCurrent", (float)selectedFacility.getSetting("ProductionRateCurrent") + 1);
}
开发者ID:Kerbas-ad-astra,项目名称:Kerbal-Konstructs_DEV,代码行数:4,代码来源:StaffGUI.cs
示例15: TotalBarracksPool
public static float TotalBarracksPool(StaticObject selectedFacility, bool bUnassigned = true)
{
float fKerbals = 0f;
foreach (StaticObject obj in KerbalKonstructs.instance.getStaticDB().getAllStatics())
{
//if ((string)obj.model.getSetting("DefaultFacilityType") == "None") continue;
if ((string)obj.getSetting("FacilityType") != "Barracks")
{
if ((string)obj.model.getSetting("DefaultFacilityType") != "Barracks") continue;
}
var dist = Vector3.Distance(selectedFacility.gameObject.transform.position, obj.gameObject.transform.position);
if (dist > 5000f) continue;
if (bUnassigned)
{
fKerbals = fKerbals + (float)obj.getSetting("ProductionRateCurrent");
}
else
{
fKerbals = fKerbals + ((float)obj.getSetting("StaffCurrent") - (float)obj.getSetting("ProductionRateCurrent"));
}
}
return fKerbals;
}
开发者ID:Kerbas-ad-astra,项目名称:Kerbal-Konstructs_DEV,代码行数:28,代码来源:StaffGUI.cs
示例16: DrawFromBarracks
public static void DrawFromBarracks(StaticObject selectedFacility)
{
selectedFacility.setSetting("ProductionRateCurrent", (float)selectedFacility.getSetting("ProductionRateCurrent") - 1);
}
开发者ID:Kerbas-ad-astra,项目名称:Kerbal-Konstructs_DEV,代码行数:4,代码来源:StaffGUI.cs
示例17: doFuelOut
public static void doFuelOut(StaticObject selectedObject)
{
if (SelectedResource == null) return;
if (SelectedTank == null) return;
if (SelectedResource.resourceName == "MonoPropellant" && !bMoFOut) return;
if (SelectedResource.resourceName == "LiquidFuel" && !bLqFOut) return;
if (SelectedResource.resourceName == "Oxidizer" && !bOxFOut) return;
if (SelectedResource.resourceName == "MonoPropellant" && fMoFCurrent <= 0) return;
if (SelectedResource.resourceName == "LiquidFuel" && fLqFCurrent <= 0) return;
if (SelectedResource.resourceName == "Oxidizer" && fOxFCurrent <= 0) return;
if (SelectedResource.amount >= SelectedResource.maxAmount) return;
float dStaticFuel;
SelectedResource.amount = SelectedResource.amount + fTransferRate;
if (SelectedResource.amount > SelectedResource.maxAmount) SelectedResource.amount = SelectedResource.maxAmount;
if (SelectedResource.resourceName == "MonoPropellant")
{
dStaticFuel = ((float)selectedObject.getSetting("MoFCurrent")) - fTransferRate;
if (dStaticFuel < 0) dStaticFuel = 0;
selectedObject.setSetting("MoFCurrent", dStaticFuel);
}
if (SelectedResource.resourceName == "LiquidFuel")
{
dStaticFuel = ((float)selectedObject.getSetting("LqFCurrent")) - fTransferRate;
if (dStaticFuel < 0) dStaticFuel = 0;
selectedObject.setSetting("LqFCurrent", dStaticFuel);
}
if (SelectedResource.resourceName == "Oxidizer")
{
dStaticFuel = ((float)selectedObject.getSetting("OxFCurrent")) - fTransferRate;
if (dStaticFuel < 0) dStaticFuel = 0;
selectedObject.setSetting("OxFCurrent", dStaticFuel);
}
}
开发者ID:ThomasKerman,项目名称:Kerbal-Konstructs_DEV,代码行数:39,代码来源:FuelTanksGUI.cs
示例18: RemoveCorrectCraft
public static void RemoveCorrectCraft(Vessel vVessel, StaticObject soHangar)
{
string sSpace = "InStorage";
string sVesselID = vVessel.id.ToString();
if (sVesselID == (string)soHangar.getSetting("TargetID"))
sSpace = "TargetID";
if (sVesselID == (string)soHangar.getSetting("TargetType"))
sSpace = "TargetType";
soHangar.setSetting(sSpace, "None");
PersistenceUtils.saveStaticPersistence(soHangar);
}
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:13,代码来源:HangarGUI.cs
示例19: HangarwayIsClear
public static Boolean HangarwayIsClear(StaticObject soHangar)
{
Boolean bIsClear = true;
foreach (Vessel vVessel in FlightGlobals.Vessels)
{
if (vVessel == null) continue;
if (!vVessel.loaded) continue;
if (vVessel.vesselType == VesselType.EVA) continue;
if (vVessel.vesselType == VesselType.Flag) continue;
if (vVessel.situation != Vessel.Situations.LANDED) continue;
var vDistToCraft = Vector3.Distance(vVessel.gameObject.transform.position, soHangar.gameObject.transform.position);
if (vDistToCraft > 260) continue;
else
bIsClear = false;
}
return bIsClear;
}
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:20,代码来源:HangarGUI.cs
示例20: selectObject
public void selectObject(StaticObject obj, bool isEditing, bool bFocus, bool bPreview)
{
if (bFocus)
{
InputLockManager.SetControlLock(ControlTypes.ALL_SHIP_CONTROLS, "KKShipLock");
InputLockManager.SetControlLock(ControlTypes.EVA_INPUT, "KKEVALock");
InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS, "KKCamControls");
InputLockManager.SetControlLock(ControlTypes.CAMERAMODES, "KKCamModes");
if (selectedObject != null)
deselectObject(true, true);
if (camControl.active)
camControl.disable();
camControl.enable(obj.gameObject);
}
else
{
if (selectedObject != null)
deselectObject(true, true);
}
//obj.preview = bPreview;
if (DebugMode) Debug.Log("KK: obj.preview is " + obj.preview.ToString());
selectedObject = obj;
if (DebugMode) Debug.Log("KK: selectedObject.preview is " + selectedObject.preview.ToString());
if (isEditing)
{
selectedObject.editing = true;
selectedObject.ToggleAllColliders(false);
}
}
开发者ID:Kerbas-ad-astra,项目名称:Kerbal-Konstructs_DEV,代码行数:35,代码来源:KerbalKonstructs.cs
注:本文中的KerbalKonstructs.StaticObjects.StaticObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论