当前位置: 首页>>代码示例>>C#>>正文


C# Entities.MyCubeBlock类代码示例

本文整理汇总了C#中Sandbox.Game.Entities.MyCubeBlock的典型用法代码示例。如果您正苦于以下问题:C# MyCubeBlock类的具体用法?C# MyCubeBlock怎么用?C# MyCubeBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MyCubeBlock类属于Sandbox.Game.Entities命名空间,在下文中一共展示了MyCubeBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        public void Init(MyCubeBlock myBlock, ConveyorLinePosition a, ConveyorLinePosition b, MyObjectBuilder_ConveyorLine.LineType type, MyObjectBuilder_ConveyorLine.LineConductivity conductivity = MyObjectBuilder_ConveyorLine.LineConductivity.FULL)
        {
            CubeBlock = myBlock;
            ConnectingPosition1 = a;
            ConnectingPosition2 = b;

            // Neighbour grid position of one of the connecting positions is inside this block
            var linePosition = (myBlock as IMyConveyorSegmentBlock).ConveyorSegment.ConnectingPosition1.NeighbourGridPosition;

            ConveyorLine = myBlock.CubeGrid.GridSystems.ConveyorSystem.GetDeserializingLine(linePosition);
            if (ConveyorLine == null)
            {
                ConveyorLine = new MyConveyorLine();
                if (IsCorner)
                    ConveyorLine.Init(a, b, myBlock.CubeGrid, type, conductivity, CalculateCornerPosition());
                else
                    ConveyorLine.Init(a, b, myBlock.CubeGrid, type, conductivity, (Vector3I?)null);
            }
            else
            {
                Debug.Assert(ConveyorLine.Type == type, "Conveyor line type mismatch on segment deserialization");
            }

            myBlock.SlimBlock.ComponentStack.IsFunctionalChanged += CubeBlock_IsFunctionalChanged;
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:25,代码来源:IMyConveyorSegmentBlock.cs

示例2: MyUpgradableBlockComponent

        public MyUpgradableBlockComponent(MyCubeBlock parent)
        {
            Debug.Assert(parent != null);

            ConnectionPositions = new HashSet<ConveyorLinePosition>();
            Refresh(parent);
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyUpgradableBlockComponent.cs

示例3: RemoveGenerated

 private static bool RemoveGenerated(HkdBreakableBody b, MyCubeBlock block)
 {
     if (MyFakes.REMOVE_GENERATED_BLOCK_FRACTURES && ContainsGenerated(block))
     {
         if (b.BreakableShape.IsCompound())
         {
             b.BreakableShape.GetChildren(m_tmpInfos);
             for (int i = 0; i < m_tmpInfos.Count; i++)
             {
                 if (DontCreateFracture(m_tmpInfos[i].Shape))
                 {
                     m_tmpInfos.RemoveAt(i);
                     i--;
                 }
             }
             if (m_tmpInfos.Count == 0)
             {
                 return true;
             }
             m_tmpInfos.Clear();
         }
         else if (DontCreateFracture(b.BreakableShape))
         {
             return true;
         }
     }
     return false;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:28,代码来源:MyDestructionHelper.cs

示例4: Refresh

 public void Refresh(MyCubeBlock parent)
 {
     ConnectionPositions.Clear();
     var positions = MyMultilineConveyorEndpoint.GetLinePositions(parent, "detector_upgrade");
     foreach (var position in positions)
     {
         ConnectionPositions.Add(MyMultilineConveyorEndpoint.PositionToGridCoords(position, parent));
     }
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:9,代码来源:MyUpgradableBlockComponent.cs

示例5: MyGuiScreenCubeBuilder

        public MyGuiScreenCubeBuilder(int scrollOffset = 0, MyCubeBlock owner = null)
            : base(scrollOffset, owner)
        {
            MySandboxGame.Log.WriteLine("MyGuiScreenCubeBuilder.ctor START");

            Static = this;

            m_scrollOffset = scrollOffset / 6.5f;
            m_size = new Vector2(1, 1);
            m_canShareInput = true;
            m_drawEvenWithoutFocus = true;
            EnabledBackgroundFade = true;
            m_screenOwner = owner;
            RecreateControls(true);

            MySandboxGame.Log.WriteLine("MyGuiScreenCubeBuilder.ctor END");
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:17,代码来源:MyGuiScreenCubeBuilder.cs

示例6: CreateFracturePiece

        public static MyFracturedPiece CreateFracturePiece(HkdBreakableBody b, ref MatrixD worldMatrix, List<MyDefinitionId> originalBlocks, MyCubeBlock block = null, bool sync = true)        
        {
            System.Diagnostics.Debug.Assert(Sync.IsServer, "Only on server");

            if (block != null)
            {
                if (RemoveGenerated(b, block))
                {
                    return null;
                }
            }

            ProfilerShort.Begin("CreateFracturePiece");
            var fracturedPiece = MyFracturedPiecesManager.Static.GetPieceFromPool(0);
            fracturedPiece.InitFromBreakableBody(b, worldMatrix, block);
            fracturedPiece.NeedsUpdate |= Common.MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
            //fracturedPiece.Physics.RigidBody.ContactPointCallbackDelay = 0;
            //fracturedPiece.Physics.RigidBody.ContactPointCallbackEnabled = true;
            ProfilerShort.End();

            ProfilerShort.Begin("MyEntities.Add");
            MyEntities.Add(fracturedPiece);
            ProfilerShort.End();

            if (block == null)
            {
                fracturedPiece.OriginalBlocks.Clear();
                fracturedPiece.OriginalBlocks.AddRange(originalBlocks);

                MyPhysicalModelDefinition def;
                if(MyDefinitionManager.Static.TryGetDefinition<MyPhysicalModelDefinition>(originalBlocks[0], out def))
                    fracturedPiece.Physics.MaterialType = def.PhysicalMaterial.Id.SubtypeId;
            }

            if (sync)
                MySyncDestructions.CreateFracturePiece((Sandbox.Common.ObjectBuilders.MyObjectBuilder_FracturedPiece)fracturedPiece.GetObjectBuilder());

            return fracturedPiece;
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:39,代码来源:MyDestructionHelper.cs

示例7: CreateFracturePiece

        public static MyFracturedPiece CreateFracturePiece(HkdBreakableBody b, ref MatrixD worldMatrix, List<MyDefinitionId> originalBlocks, MyCubeBlock block = null, bool sync = true)
        {
            System.Diagnostics.Debug.Assert(Sync.IsServer, "Only on server");

            if (IsBodyWithoutGeneratedFracturedPieces(b, block))
                return null;

            ProfilerShort.Begin("CreateFracturePiece");
            var fracturedPiece = MyFracturedPiecesManager.Static.GetPieceFromPool(0);
            fracturedPiece.InitFromBreakableBody(b, worldMatrix, block);
            fracturedPiece.NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
            //fracturedPiece.Physics.RigidBody.ContactPointCallbackDelay = 0;
            //fracturedPiece.Physics.RigidBody.ContactPointCallbackEnabled = true;
            ProfilerShort.End();

            if (originalBlocks != null && originalBlocks.Count != 0)
            {
                fracturedPiece.OriginalBlocks.Clear();
                fracturedPiece.OriginalBlocks.AddRange(originalBlocks);

                MyPhysicalModelDefinition def;
                if (MyDefinitionManager.Static.TryGetDefinition<MyPhysicalModelDefinition>(originalBlocks[0], out def))
                    fracturedPiece.Physics.MaterialType = def.PhysicalMaterial.Id.SubtypeId;
            }

            // Check valid shapes from block definitions.
            if (MyFakes.ENABLE_FRACTURE_PIECE_SHAPE_CHECK)
                fracturedPiece.DebugCheckValidShapes();

            ProfilerShort.Begin("MyEntities.Add");
            MyEntities.RaiseEntityCreated(fracturedPiece);
            MyEntities.Add(fracturedPiece);
            ProfilerShort.End();

            return fracturedPiece;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:36,代码来源:MyDestructionHelper.cs

示例8: MyUseObjectWardrobe

 public MyUseObjectWardrobe(IMyEntity owner, string dummyName, MyModelDummy dummyData, uint key)
     : base(owner, dummyData)
 {
     Block = owner as MyCubeBlock;
     LocalMatrix = dummyData.Matrix;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:6,代码来源:MyUseObjectWardrobe.cs

示例9: OnAddedToContainer

 public override void OnAddedToContainer()
 {
     base.OnAddedToContainer();
     m_cubeBlock = Container.Entity as MyCubeBlock;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:5,代码来源:MyRenderComponentCubeBlock.cs

示例10: ConveyorSystem_BlockRemoved

        private void ConveyorSystem_BlockRemoved(MyCubeBlock obj)
        {
            m_interactedGridOwners.Remove(obj);
            if (m_leftShowsGrid) LeftTypeGroup_SelectedChanged(m_leftTypeGroup);
            if (m_rightShowsGrid) RightTypeGroup_SelectedChanged(m_rightTypeGroup);

            if (m_dragAndDropInfo != null)
            {
                ClearDisabledControls();
                DisableInvalidWhileDragging();
            }
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:12,代码来源:MyTerminalInventoryController.cs

示例11: MyBatteryBlock_IsWorkingChanged

        void MyBatteryBlock_IsWorkingChanged(MyCubeBlock obj)
        {
            UpdateMaxOutputAndEmissivity();
			ResourceSink.Update();
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:5,代码来源:MyBatteryBlock.cs

示例12: Add

        public void Add(MyCubeBlock block)
        {
            bool added = m_inventoryBlocks.Add(block);
            System.Diagnostics.Debug.Assert(added, "Double add");

            var handler = BlockAdded;
            if (handler != null) handler(block);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:8,代码来源:MyGridConveyorSystem.cs

示例13: MyUpgradeModule_IsWorkingChanged

 void MyUpgradeModule_IsWorkingChanged(MyCubeBlock obj)
 {
     RefreshEffects();
     UpdateEmissivity();
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:5,代码来源:MyUpgradeModule.cs

示例14: ContainsBlockWithoutGeneratedFracturedPieces

        /// <summary>
        /// Returns true if the block (or any block in compound) does not generate generate fractured pieces.
        /// </summary>
        private static bool ContainsBlockWithoutGeneratedFracturedPieces(MyCubeBlock block)
        {
            if (!block.BlockDefinition.CreateFracturedPieces)
                return true;

            if (block is MyCompoundCubeBlock)
            {
                foreach (var b in (block as MyCompoundCubeBlock).GetBlocks())
                    if (!b.BlockDefinition.CreateFracturedPieces)
                        return true;
            }

            if (block is MyFracturedBlock)
            {
                foreach (var def in (block as MyFracturedBlock).OriginalBlocks)
                    if (!MyDefinitionManager.Static.GetCubeBlockDefinition(def).CreateFracturedPieces)
                        return true;
            }
            return false;
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:23,代码来源:MyDestructionHelper.cs

示例15: ContainsGenerated

        private static bool ContainsGenerated(MyCubeBlock block)
        {
            if (block.BlockDefinition.IsGeneratedBlock)
                return true;

            if (block is MyCompoundCubeBlock)
            {
                foreach (var b in (block as MyCompoundCubeBlock).GetBlocks())
                    if (b.BlockDefinition.IsGeneratedBlock)
                        return true;
            }

            if (block is MyFracturedBlock)
            {
                foreach (var def in (block as MyFracturedBlock).OriginalBlocks)
                    if (MyDefinitionManager.Static.GetCubeBlockDefinition(def).IsGeneratedBlock)
                        return true;
            }
            return false;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:20,代码来源:MyDestructionHelper.cs


注:本文中的Sandbox.Game.Entities.MyCubeBlock类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。