本文整理汇总了C#中MyCubeBlock类的典型用法代码示例。如果您正苦于以下问题:C# MyCubeBlock类的具体用法?C# MyCubeBlock怎么用?C# MyCubeBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyCubeBlock类属于命名空间,在下文中一共展示了MyCubeBlock类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MyUseObjectCryoChamberDoor
public MyUseObjectCryoChamberDoor(MyCubeBlock owner, string dummyName, MyModelDummy dummyData, int key)
{
CryoChamber = owner as MyCryoChamber;
Debug.Assert(CryoChamber != null, "MyUseObjectCryoChamberDoor should only be used with MyCryoChamber blocks!");
LocalMatrix = dummyData.Matrix;
}
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:7,代码来源:MyUseObjectCryoChamberDoor.cs
示例2: CubeBlock_IsWorkingChanged
void CubeBlock_IsWorkingChanged(MyCubeBlock obj)
{
if (IsWorking)
OnStartWorking();
else
OnStopWorking();
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyFunctionalBlock.cs
示例3: CreateUseObject
public static IMyUseObject CreateUseObject(string detectorName, MyCubeBlock owner, string dummyName, MyModelDummy dummyData, int shapeKey)
{
Type type;
if (!m_useObjectTypesByDummyName.TryGetValue(detectorName, out type) || type == null)
return null;
return (IMyUseObject)Activator.CreateInstance(type, owner, dummyName, dummyData, shapeKey);
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:8,代码来源:MyUseObjectFactory.cs
示例4: MyUseObjectPanelButton
public MyUseObjectPanelButton(MyCubeBlock owner, string dummyName, MyModelDummy dummyData, int key)
{
m_buttonPanel = owner as MyButtonPanel;
m_localMatrix = dummyData.Matrix;
int orderNumber = 0;
var parts = dummyName.Split('_');
int.TryParse(parts[parts.Length - 1], out orderNumber);
m_index = orderNumber - 1;
if (m_index >= m_buttonPanel.BlockDefinition.ButtonCount)
{
MyLog.Default.WriteLine(string.Format("{0} Button index higher than defined count.", m_buttonPanel.BlockDefinition.Id.SubtypeName));
Debug.Fail(string.Format("{0} Button index higher than defined count.", m_buttonPanel.BlockDefinition.Id.SubtypeName));
m_index = m_buttonPanel.BlockDefinition.ButtonCount - 1;
}
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:16,代码来源:MyUseObjectPanelButton.cs
示例5: MyProgrammableBlock_IsWorkingChanged
void MyProgrammableBlock_IsWorkingChanged(MyCubeBlock obj)
{
UpdateEmissivity();
}
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:4,代码来源:MyProgrammableBlock.cs
示例6: RegisterInSystems
public virtual void RegisterInSystems(MyCubeBlock block)
{
if (ResourceDistributor != null)
{
var powerProducer = block.Components.Get<MyResourceSourceComponent>();
if (powerProducer != null)
ResourceDistributor.AddSource(powerProducer);
var powerConsumer = block.Components.Get<MyResourceSinkComponent>();
if (powerConsumer != null)
ResourceDistributor.AddSink(powerConsumer);
var socketOwner = block as IMyRechargeSocketOwner;
if (socketOwner != null)
socketOwner.RechargeSocket.ResourceDistributor = ResourceDistributor;
}
if (WeaponSystem != null)
{
var weapon = block as IMyGunObject<MyDeviceBase>;
if (weapon != null)
WeaponSystem.Register(weapon);
}
if (TerminalSystem != null)
{
var functionalBlock = block as MyTerminalBlock;
if (functionalBlock != null)
TerminalSystem.Add(functionalBlock);
}
// CH: We probably don't need to register controller blocks here. Block that's being added to a grid should not have a controller set
var controllableBlock = block as MyShipController;
Debug.Assert(controllableBlock == null || controllableBlock.ControllerInfo.Controller == null, "Controller of added block is not null. Call Cestmir");
/*if (ControlSystem != null)
{
var controllableBlock = block as MyShipController;
if (controllableBlock != null && controllableBlock.ControllerInfo.Controller != null)
ControlSystem.AddControllerBlock(controllableBlock);
}*/
var inventoryBlock = (block != null && block.HasInventory) ? block : null;
if (inventoryBlock != null)
ConveyorSystem.Add(inventoryBlock);
var conveyorBlock = block as IMyConveyorEndpointBlock;
if (conveyorBlock != null)
{
conveyorBlock.InitializeConveyorEndpoint();
ConveyorSystem.AddConveyorBlock(conveyorBlock);
}
var segmentBlock = block as IMyConveyorSegmentBlock;
if (segmentBlock != null)
{
segmentBlock.InitializeConveyorSegment();
ConveyorSystem.AddSegmentBlock(segmentBlock);
}
var reflectorLight = block as MyReflectorLight;
if (reflectorLight != null)
ReflectorLightSystem.Register(reflectorLight);
if (MyFakes.ENABLE_WHEEL_CONTROLS_IN_COCKPIT)
{
var wheel = block as MyMotorSuspension;
if (wheel != null)
WheelSystem.Register(wheel);
}
var landingGear = block as IMyLandingGear;
if (landingGear != null)
LandingSystem.Register(landingGear);
var gyro = block as MyGyro;
if (gyro != null)
GyroSystem.Register(gyro);
var camera = block as MyCameraBlock;
if (camera != null)
CameraSystem.Register(camera);
block.OnRegisteredToGridSystems();
}
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:84,代码来源:MyCubeGridSystems.cs
示例7: MyUseObjectTextPanel
public MyUseObjectTextPanel(MyCubeBlock owner, string dummyName, MyModelDummy dummyData, int key)
{
m_textPanel = (MyTextPanel)owner;
m_localMatrix = dummyData.Matrix;
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:5,代码来源:MyUseObjectTextPanel.cs
示例8: MyWheel_IsWorkingChanged
void MyWheel_IsWorkingChanged(MyCubeBlock obj)
{
if(Stator != null)
Stator.UpdateIsWorking();
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:5,代码来源:MyWheel.cs
示例9: UpdateVisual
public void UpdateVisual()
{
UpdateShowParts();
if (!ShowParts)
{
if (FatBlock == null)
{
FatBlock = new MyCubeBlock();
FatBlock.SlimBlock = this;
FatBlock.Init();
CubeGrid.Hierarchy.AddChild(FatBlock);
m_soundEmitter.Entity = FatBlock;
m_soundEmitter.SetPosition(null);
}
else
{
FatBlock.UpdateVisual();
}
}
else if (FatBlock != null)
{
var pos = FatBlock.WorldMatrix.Translation;
CubeGrid.Hierarchy.RemoveChild(FatBlock);
FatBlock.Close();
FatBlock = null;
m_soundEmitter.Entity = null;
}
CubeGrid.SetBlockDirty(this);
if (CubeGrid.Physics != null)
{
CubeGrid.Physics.AddDirtyArea(Min, Max);
}
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:34,代码来源:MySlimBlock.cs
示例10: AddEffectToBlock
private void AddEffectToBlock(MyCubeBlock block)
{
foreach (var upgrade in m_upgrades)
{
float val;
if (block.UpgradeValues.TryGetValue(upgrade.UpgradeType, out val))
{
if (upgrade.ModifierType == MyUpgradeModifierType.Additive)
{
val += upgrade.Modifier;
}
else
{
val *= upgrade.Modifier;
}
block.UpgradeValues[upgrade.UpgradeType] = val;
}
}
block.CommitUpgradeValues();
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:21,代码来源:MyUpgradeModule.cs
示例11: ChangeBlockOwnership
public void ChangeBlockOwnership(MyCubeBlock block, long oldOwner, long newOwner)
{
DecreaseValue(ref PlayerOwnedBlocks, oldOwner);
IncreaseValue(ref PlayerOwnedBlocks, newOwner);
if (IsValidBlock(block))
{
DecreaseValue(ref PlayerOwnedValidBlocks, oldOwner);
IncreaseValue(ref PlayerOwnedValidBlocks, newOwner);
}
NeedRecalculateOwners = true;
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:12,代码来源:MyCubeGridOwnershipManager.cs
示例12: CanAffectBlock
private bool CanAffectBlock(MyCubeBlock block)
{
foreach (var upgrade in m_upgrades)
{
if (block.UpgradeValues.ContainsKey(upgrade.UpgradeType))
{
return true;
}
}
return false;
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:12,代码来源:MyUpgradeModule.cs
示例13: RemoveEffectFromBlock
private void RemoveEffectFromBlock(MyCubeBlock block)
{
foreach (var upgrade in m_upgrades)
{
float val;
if (block.UpgradeValues.TryGetValue(upgrade.UpgradeType, out val))
{
if (upgrade.ModifierType == MyUpgradeModifierType.Additive)
{
val -= upgrade.Modifier;
if (val < 0f)
{
val = 0f;
Debug.Fail("Additive modifier cannot be negative!");
}
}
else
{
val /= upgrade.Modifier;
if (val < 1f)
{
val = 1f;
Debug.Fail("Multiplicative modifier cannot be < 1.0f!");
}
}
block.UpgradeValues[upgrade.UpgradeType] = val;
}
}
block.CommitUpgradeValues();
}
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:32,代码来源:MyUpgradeModule.cs
示例14: CubeBlock_OnWorkingChanged
private void CubeBlock_OnWorkingChanged(MyCubeBlock block)
{
m_positionDirty = true;
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:4,代码来源:MyLightingBlock.cs
示例15: CubeBlock_IsWorkingChanged
private void CubeBlock_IsWorkingChanged(MyCubeBlock block)
{
if (IsWorking)
{
MyCubeBlock.UpdateEmissiveParts(Render.RenderObjectIDs[0], 1.0f, Color.Green, Color.White);
if (IsProducing)
OnStartProducing();
}
else
{
MyCubeBlock.UpdateEmissiveParts(Render.RenderObjectIDs[0], 0.0f, Color.Red, Color.White);
}
}
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:13,代码来源:MyProductionBlock.cs
示例16: MyShipMergeBlock_IsWorkingChanged
private void MyShipMergeBlock_IsWorkingChanged(MyCubeBlock obj)
{
Debug.Assert(Physics != null || !InScene);
if (Physics != null)
Physics.Enabled = this.IsWorking;
if (!this.IsWorking)
{
var otherBlock = GetOtherMergeBlock();
if (otherBlock != null)
{
}
else if (InConstraint)
RemoveConstraintInBoth();
}
CheckConnectionAllowed = !this.IsWorking;
CubeGrid.UpdateBlockNeighbours(this.SlimBlock);
CheckEmissivity();
}
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:22,代码来源:MyShipMergeBlock.cs
示例17: UpdateVisual
public void UpdateVisual(bool updatePhysics = true)
{
UpdateShowParts();
if (!ShowParts)
{
if (FatBlock == null)
{
FatBlock = new MyCubeBlock();
FatBlock.SlimBlock = this;
FatBlock.Init();
CubeGrid.Hierarchy.AddChild(FatBlock);
}
else
{
FatBlock.UpdateVisual();
}
}
else if (FatBlock != null)
{
var pos = FatBlock.WorldMatrix.Translation;
CubeGrid.Hierarchy.RemoveChild(FatBlock);
FatBlock.Close();
FatBlock = null;
}
CubeGrid.SetBlockDirty(this);
if (updatePhysics && CubeGrid.Physics != null)
{
CubeGrid.Physics.AddDirtyArea(Min, Max);
}
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:31,代码来源:MySlimBlock.cs
示例18: MyUseObjectTerminal
public MyUseObjectTerminal(IMyEntity owner, string dummyName, MyModelDummy dummyData, uint key)
{
Block = owner as MyCubeBlock;
LocalMatrix = dummyData.Matrix;
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:5,代码来源:MyUseObjectTerminal.cs
示例19: IsValidBlock
private bool IsValidBlock(MyCubeBlock block)
{
return block.IsFunctional;
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:4,代码来源:MyCubeGridOwnershipManager.cs
示例20: MyProjector_IsWorkingChanged
void MyProjector_IsWorkingChanged(MyCubeBlock obj)
{
if (!IsWorking && IsProjecting())
{
RequestRemoveProjection();
}
else
{
if (IsWorking && !IsProjecting())
{
if (m_clipboard.HasCopiedGrids())
{
InitializeClipboard();
}
}
UpdateEmissivity();
}
}
开发者ID:Rynchodon,项目名称:SpaceEngineers,代码行数:19,代码来源:MyProjectorBase.cs
注:本文中的MyCubeBlock类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论