本文整理汇总了C#中MyCubeGrid类的典型用法代码示例。如果您正苦于以下问题:C# MyCubeGrid类的具体用法?C# MyCubeGrid怎么用?C# MyCubeGrid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyCubeGrid类属于命名空间,在下文中一共展示了MyCubeGrid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MyGridShape
public MyGridShape(MyCubeGrid grid)
{
m_grid = grid;
if (MyPerGameSettings.Destruction)
return;
if (MyPerGameSettings.UseGridSegmenter)
m_segmenter = new MyVoxelSegmentation();
if (!grid.IsStatic)
{
m_massElements = new Dictionary<Vector3I, HkMassElement>();
}
try
{
m_blockCollector.Collect(grid, m_segmenter, MyVoxelSegmentationType.Simple, m_massElements);
m_root = new HkGridShape(m_grid.GridSize, HkReferencePolicy.None);
AddShapesFromCollector();
if (!m_grid.IsStatic)
{
UpdateMassProperties();
}
}
finally
{
m_blockCollector.Clear();
}
}
示例2: Init
public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
{
base.Init(objectBuilder, cubeGrid);
var def = BlockDefinition as MyPoweredCargoContainerDefinition;
var ob = objectBuilder as MyObjectBuilder_Collector;
m_inventory = new MyInventory(def.InventorySize.Volume, def.InventorySize, MyInventoryFlags.CanSend, this);
m_inventory.Init(ob.Inventory);
m_inventory.ContentsChanged += Inventory_ContentChangedCallback;
if (Sync.IsServer && CubeGrid.CreatePhysics)
LoadDummies();
var sinkComp = new MyResourceSinkComponent();
sinkComp.Init(
MyStringHash.GetOrCompute(def.ResourceSinkGroup),
MyEnergyConstants.MAX_REQUIRED_POWER_COLLECTOR,
() => base.CheckIsWorking() ? ResourceSink.MaxRequiredInput : 0f);
ResourceSink = sinkComp;
ResourceSink.Update();
ResourceSink.IsPoweredChanged += Receiver_IsPoweredChanged;
AddDebugRenderComponent(new Components.MyDebugRenderComponentDrawPowerReciever(ResourceSink,this));
SlimBlock.ComponentStack.IsFunctionalChanged += UpdateReceiver;
base.EnabledChanged += UpdateReceiver;
m_useConveyorSystem = ob.UseConveyorSystem;
}
示例3: MyCubeGridSystems
public MyCubeGridSystems(MyCubeGrid grid)
{
m_cubeGrid = grid;
m_terminalSystem_GroupAdded = TerminalSystem_GroupAdded;
m_terminalSystem_GroupRemoved = TerminalSystem_GroupRemoved;
ThrustSystem = new MyGridThrustSystem(m_cubeGrid);
GyroSystem = new MyGridGyroSystem(m_cubeGrid);
WeaponSystem = new MyGridWeaponSystem();
ReflectorLightSystem = new MyGridReflectorLightSystem(m_cubeGrid);
if (MyFakes.ENABLE_WHEEL_CONTROLS_IN_COCKPIT)
{
WheelSystem = new MyGridWheelSystem(m_cubeGrid);
}
ConveyorSystem = new MyGridConveyorSystem(m_cubeGrid);
LandingSystem = new MyGridLandingSystem();
ControlSystem = new MyGroupControlSystem();
CameraSystem = new MyGridCameraSystem(m_cubeGrid);
if (MySession.Static.Settings.EnableOxygen)
{
OxygenSystem = new MyGridOxygenSystem(m_cubeGrid);
}
JumpSystem = new MyGridJumpDriveSystem(m_cubeGrid);
m_cubeGrid.SyncObject.PowerProducerStateChanged += SyncObject_PowerProducerStateChanged;
m_blocksRegistered = true;
}
示例4: Init
public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
{
m_cameraDummy = Matrix.Identity;
m_characterDummy = Matrix.Identity;
base.Init(objectBuilder, cubeGrid);
var chamberOb = objectBuilder as MyObjectBuilder_CryoChamber;
if (chamberOb.SteamId != null && chamberOb.SerialId != null)
{
m_currentPlayerId = new MyPlayer.PlayerId(chamberOb.SteamId.Value, chamberOb.SerialId.Value);
}
else
{
m_currentPlayerId = null;
}
var overlayTexture = BlockDefinition.OverlayTexture;
if (!string.IsNullOrEmpty(overlayTexture))
{
m_overlayTextureName = overlayTexture;
}
var sinkComp = new MyResourceSinkComponent();
sinkComp.Init(
MyStringHash.GetOrCompute(BlockDefinition.ResourceSinkGroup),
BlockDefinition.IdlePowerConsumption,
this.CalculateRequiredPowerInput);
sinkComp.IsPoweredChanged += Receiver_IsPoweredChanged;
ResourceSink = sinkComp;
NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
}
示例5: Init
public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
{
m_cameraDummy = Matrix.Identity;
m_characterDummy = Matrix.Identity;
base.Init(objectBuilder, cubeGrid);
var chamberOb = objectBuilder as MyObjectBuilder_CryoChamber;
if (chamberOb.SteamId != null && chamberOb.SerialId != null)
{
m_currentPlayerId = new MyPlayer.PlayerId(chamberOb.SteamId.Value, chamberOb.SerialId.Value);
}
else
{
m_currentPlayerId = null;
}
var overlayTexture = BlockDefinition.OverlayTexture;
if (!string.IsNullOrEmpty(overlayTexture))
{
m_overlayTextureName = overlayTexture;
}
PowerReceiver = new MyPowerReceiver(
MyConsumerGroupEnum.Utility,
false,
BlockDefinition.IdlePowerConsumption,
this.CalculateRequiredPowerInput);
PowerReceiver.IsPoweredChanged += Receiver_IsPoweredChanged;
NeedsUpdate |= Common.MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
}
示例6: Init
public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
{
base.Init(objectBuilder, cubeGrid);
MyDebug.AssertDebug(BlockDefinition is MyRefineryDefinition);
m_refineryDef = BlockDefinition as MyRefineryDefinition;
InputInventory.Constraint = m_refineryDef.InputInventoryConstraint;
bool removed = InputInventory.FilterItemsUsingConstraint();
Debug.Assert(!removed, "Inventory filter removed items which were present in the object builder.");
InputInventory.ContentsChanged += inventory_OnContentsChanged;
OutputInventory.Constraint = m_refineryDef.OutputInventoryConstraint;
removed = OutputInventory.FilterItemsUsingConstraint();
Debug.Assert(!removed, "Inventory filter removed items which were present in the object builder.");
OutputInventory.ContentsChanged += inventory_OnContentsChanged;
m_queueNeedsRebuild = true;
UpgradeValues.Add("Productivity", 0f);
UpgradeValues.Add("Effectiveness", 1f);
UpgradeValues.Add("PowerEfficiency", 1f);
PowerReceiver.RequiredInputChanged += PowerReceiver_RequiredInputChanged;
OnUpgradeValuesChanged += UpdateDetailedInfo;
UpdateDetailedInfo();
}
示例7: MyCubeGridSystems
public MyCubeGridSystems(MyCubeGrid grid)
{
m_cubeGrid = grid;
m_terminalSystem_GroupAdded = TerminalSystem_GroupAdded;
m_terminalSystem_GroupRemoved = TerminalSystem_GroupRemoved;
GyroSystem = new MyGridGyroSystem(m_cubeGrid);
WeaponSystem = new MyGridWeaponSystem();
ReflectorLightSystem = new MyGridReflectorLightSystem(m_cubeGrid);
if (MyFakes.ENABLE_WHEEL_CONTROLS_IN_COCKPIT)
{
WheelSystem = new MyGridWheelSystem(m_cubeGrid);
}
ConveyorSystem = new MyGridConveyorSystem(m_cubeGrid);
LandingSystem = new MyGridLandingSystem();
ControlSystem = new MyGroupControlSystem();
CameraSystem = new MyGridCameraSystem(m_cubeGrid);
if (MySession.Static.Settings.EnableOxygen)
{
GasSystem = new MyGridGasSystem(m_cubeGrid);
}
if (MyPerGameSettings.EnableJumpDrive)
{
JumpSystem = new MyGridJumpDriveSystem(m_cubeGrid);
}
if (MyPerGameSettings.EnableShipSoundSystem && (MyFakes.ENABLE_NEW_SMALL_SHIP_SOUNDS || MyFakes.ENABLE_NEW_LARGE_SHIP_SOUNDS) && MySandboxGame.IsDedicated == false)
{
ShipSoundComponent = new MyShipSoundComponent();
}
m_blocksRegistered = true;
}
示例8: MyCubeGridSystems
public MyCubeGridSystems(MyCubeGrid grid)
{
m_cubeGrid = grid;
m_terminalSystem_GroupAdded = TerminalSystem_GroupAdded;
m_terminalSystem_GroupRemoved = TerminalSystem_GroupRemoved;
GyroSystem = new MyGridGyroSystem(m_cubeGrid);
WeaponSystem = new MyGridWeaponSystem();
ReflectorLightSystem = new MyGridReflectorLightSystem(m_cubeGrid);
if (MyFakes.ENABLE_WHEEL_CONTROLS_IN_COCKPIT)
{
WheelSystem = new MyGridWheelSystem(m_cubeGrid);
}
ConveyorSystem = new MyGridConveyorSystem(m_cubeGrid);
LandingSystem = new MyGridLandingSystem();
ControlSystem = new MyGroupControlSystem();
CameraSystem = new MyGridCameraSystem(m_cubeGrid);
if (MySession.Static.Settings.EnableOxygen)
{
GasSystem = new MyGridGasSystem(m_cubeGrid);
}
if (MyPerGameSettings.EnableJumpDrive)
{
JumpSystem = new MyGridJumpDriveSystem(m_cubeGrid);
}
m_blocksRegistered = true;
}
示例9: CubeGrid_OnGridSplit
protected void CubeGrid_OnGridSplit(MyCubeGrid grid1, MyCubeGrid grid2)
{
if (m_statorBlock != null)
{
m_statorBlock.OnGridSplit();
}
}
示例10: Init
public override void Init(MyObjectBuilder_CubeBlock builder, MyCubeGrid cubeGrid)
{
base.Init(builder, cubeGrid);
var ob = builder as MyObjectBuilder_PistonTop;
m_pistonBlockId = ob.PistonBlockId;
NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
}
示例11: Init
public override void Init(MyObjectBuilder_CubeBlock builder, MyCubeGrid cubeGrid)
{
var rotorOb = builder as MyObjectBuilder_MotorRotor;
base.Init(builder, cubeGrid);
LoadDummies();
}
示例12: Init
public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
{
base.Init(objectBuilder, cubeGrid);
var ob = (MyObjectBuilder_FunctionalBlock)objectBuilder;
m_enabled = ob.Enabled;
IsWorkingChanged += CubeBlock_IsWorkingChanged;
}
示例13: MyGridContactInfo
public MyGridContactInfo(ref HkContactPointEvent evnt, MyCubeGrid grid)
{
Event = evnt;
ContactPosition = grid.Physics.ClusterToWorld(evnt.ContactPoint.Position);
m_currentEntity = grid;
m_collidingEntity = Event.GetOtherEntity(grid) as MyEntity;
m_currentBlock = null;
m_otherBlock = null;
ImpulseMultiplier = 1;
}
示例14: Init
public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
{
base.Init(objectBuilder, cubeGrid);
var ob = (MyObjectBuilder_FunctionalBlock)objectBuilder;
m_enabled = ob.Enabled;
IsWorkingChanged += CubeBlock_IsWorkingChanged;
m_baseIdleSound = BlockDefinition.PrimarySound;
m_actionSound = BlockDefinition.ActionSound;
}
示例15: Init
public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
{
base.Init(objectBuilder, cubeGrid);
var ob = (MyObjectBuilder_FunctionalBlock)objectBuilder;
m_soundEmitter = new MyEntity3DSoundEmitter(this, true);
m_enabled.Value = ob.Enabled;
IsWorkingChanged += CubeBlock_IsWorkingChanged;
m_baseIdleSound = BlockDefinition.PrimarySound;
m_actionSound = BlockDefinition.ActionSound;
}