• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MyObjectBuilder_CubeGrid类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetBattlePoints

        public static ulong GetBattlePoints(MyObjectBuilder_CubeGrid[] grids)
        {
            ulong pts = 0;
            foreach (var grid in grids)
                pts += GetBattlePoints(grid);

            return pts;
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:8,代码来源:MyBattleHelper.cs


示例2: ProcessCubeGrid

 public void ProcessCubeGrid(MyObjectBuilder_CubeGrid gridBuilder)
 {
     gridBuilder.IsStatic = false;
     // To prevent exploits
     gridBuilder.DestructibleBlocks = false;
     foreach (var block in gridBuilder.CubeBlocks)
     {
         var functionalBlock = block as MyObjectBuilder_FunctionalBlock;
         if (functionalBlock != null)
         {
             functionalBlock.Enabled = false;
         }
     }
 }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:14,代码来源:MyProjectorClipboard.cs


示例3: CubeGridEntity

        public CubeGridEntity( MyObjectBuilder_CubeGrid definition )
            : base(definition)
        {
            _cubeBlockManager = new CubeBlockManager( this );
            List<CubeBlockEntity> cubeBlockList = new List<CubeBlockEntity>( );
            foreach ( MyObjectBuilder_CubeBlock cubeBlock in definition.CubeBlocks )
            {
                cubeBlock.EntityId = 0;
                cubeBlockList.Add( new CubeBlockEntity( this, cubeBlock ) );
            }
            _cubeBlockManager.Load( cubeBlockList );

            _lastNameRefresh = DateTime.Now;
            _name = "Cube Grid";
        }
开发者ID:rexxar-tc,项目名称:SEServerExtender,代码行数:15,代码来源:CubeGridEntity.cs


示例4: Init

        public virtual void Init(MyObjectBuilder_CubeGrid builder)
        {
	        var thrustComp = CubeGrid.Components.Get<MyEntityThrustComponent>();
			if(thrustComp != null)
				thrustComp.DampenersEnabled = builder.DampenersEnabled;

            if (WheelSystem != null)
                m_cubeGrid.SetHandbrakeRequest(builder.Handbrake);

            if (MySession.Static.Settings.EnableOxygen)
            {
                GasSystem.Init(builder.OxygenAmount);
            }

            if (MyPerGameSettings.EnableJumpDrive)
            {
                JumpSystem.Init(builder.JumpDriveDirection, builder.JumpRemainingTime);
            }

            var thrustComponent = CubeGrid.Components.Get<MyEntityThrustComponent>();
            if (thrustComponent != null)
                thrustComponent.MergeAllGroupsDirty();
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:23,代码来源:MyCubeGridSystems.cs


示例5: SetGridFromBuilderInternal

        private void SetGridFromBuilderInternal(MyObjectBuilder_CubeGrid grid, Vector3 offset)
        {
            BeforeCreateGrid(grid);

            m_copiedGrids.Add(grid);
            m_copiedGridOffsets.Add(offset);
            RemovePilots(grid);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:8,代码来源:MyGridClipboard.cs


示例6: BeforeCreateGrid

        protected void BeforeCreateGrid(MyObjectBuilder_CubeGrid grid)
        {
            Debug.Assert(grid.CubeBlocks.Count > 0, "The grid does not contain any blocks");

            foreach (var block in grid.CubeBlocks)
            {
                var defId = block.GetId();
                MyCubeBlockDefinition blockDef = null;
                MyDefinitionManager.Static.TryGetCubeBlockDefinition(defId, out blockDef);
                if (blockDef == null) continue;

                MyCubeBuilder.BuildComponent.BeforeCreateBlock(blockDef, GetClipboardBuilder(), block, buildAsAdmin: MySession.Static.IsAdminModeEnabled(Sync.MyId));
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:14,代码来源:MyGridClipboard.cs


示例7: BeforeBlockDeserialization

 public virtual void BeforeBlockDeserialization(MyObjectBuilder_CubeGrid builder)
 {
     ConveyorSystem.BeforeBlockDeserialization(builder.ConveyorLines);
 }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:4,代码来源:MyCubeGridSystems.cs


示例8: GetBigOwners

		// might not work? -- updated, needs testing
		public static List<long> GetBigOwners( MyObjectBuilder_CubeGrid grid )
		{
			Dictionary<long, int> ownerList = new Dictionary<long, int>( );
			foreach ( MyObjectBuilder_CubeBlock block in grid.CubeBlocks )
			{
				if ( block.Owner == 0 )
					continue;

				if ( ownerList.ContainsKey( block.Owner ) )
					ownerList[ block.Owner ] = ownerList[ block.Owner ] + 1;
				else
					ownerList.Add( block.Owner, 1 );
			}

			int count = ownerList.OrderBy( x => x.Value ).Select( x => x.Value ).FirstOrDefault( );
			return ownerList.OrderBy( x => x.Value ).Where( x => x.Value == count ).Select( x => x.Key ).ToList( );
		}
开发者ID:dodexahedron,项目名称:EssentialsPlugin,代码行数:18,代码来源:CubeGrid.cs


示例9: OnBlueprintScreen_Closed

        void OnBlueprintScreen_Closed(MyGuiScreenBase source)
        {
            ResourceSink.Update();
            UpdateIsWorking();
            if (m_clipboard.CopiedGrids.Count == 0 || !IsWorking)
            {
                RemoveProjection(false);
                return;
            }
            if (m_clipboard.GridSize != CubeGrid.GridSize)
            {
                RemoveProjection(false);
                ShowNotification(MySpaceTexts.NotificationProjectorGridSize);
                return;
            }
            if (m_clipboard.CopiedGrids.Count > 1)
            {
                ShowNotification(MySpaceTexts.NotificationProjectorMultipleGrids);
            }

            int largestGridIndex = -1;
            int largestGridBlockCount = -1;
            for (int i = 0; i < m_clipboard.CopiedGrids.Count; i++)
            {
                int currentGridBlockCount = m_clipboard.CopiedGrids[i].CubeBlocks.Count;
                if (currentGridBlockCount > largestGridBlockCount)
                {
                    largestGridBlockCount = currentGridBlockCount;
                    largestGridIndex = i;
                }
            }

            ParallelTasks.Parallel.Start(delegate()
            {
                m_originalGridBuilder = (MyObjectBuilder_CubeGrid)m_clipboard.CopiedGrids[largestGridIndex].Clone();
                m_clipboard.ProcessCubeGrid(m_clipboard.CopiedGrids[largestGridIndex]);
                MyEntities.RemapObjectBuilder(m_originalGridBuilder);
            }, 
            delegate()
            {
                SendNewBlueprint(m_originalGridBuilder);
            });
        }
开发者ID:Rynchodon,项目名称:SpaceEngineers,代码行数:43,代码来源:MyProjectorBase.cs


示例10: UpdateOnceBeforeFrame

        public override void UpdateOnceBeforeFrame()
        {
            base.UpdateOnceBeforeFrame();

            //Only create projections from real projectors
            if (CubeGrid.Physics != null && m_savedProjection != null)
            {
                var clone = (MyObjectBuilder_CubeGrid)m_savedProjection.Clone();
                MyEntities.RemapObjectBuilder(clone);
                m_clipboard.ProcessCubeGrid(clone);

                m_clipboard.SetGridFromBuilder(clone, Vector3.Zero, 0f);
                m_originalGridBuilder = m_savedProjection;
                m_savedProjection = null;
                InitializeClipboard();
                
                //This will just issue the request
                //It will only remove it only if conditions are not met a few frames later
                RequestRemoveProjection();
            }
            UpdateEmissivity();
        }
开发者ID:Rynchodon,项目名称:SpaceEngineers,代码行数:22,代码来源:MyProjectorBase.cs


示例11: SetNewBlueprint

        internal void SetNewBlueprint(MyObjectBuilder_CubeGrid gridBuilder)
        {
            m_originalGridBuilder = gridBuilder;

            var clone = m_originalGridBuilder;//(MyObjectBuilder_CubeGrid)gridBuilder.Clone();

            //MyEntities.RemapObjectBuilder(clone);
            //m_clipboard.ProcessCubeGrid(clone);

            m_clipboard.SetGridFromBuilder(clone, Vector3.Zero, 0f);

            if (m_instantBuildingEnabled)
            {
                ResetRotation();
                var boundingBox = clone.CalculateBoundingBox();
                // Add 1 to get the center out of the bounds and another 1 for a gap
                m_projectionOffset.Y = Math.Abs((int)(boundingBox.Min.Y / MyDefinitionManager.Static.GetCubeSize(clone.GridSizeEnum))) + 2;
            }

            InitializeClipboard();
        }
开发者ID:Rynchodon,项目名称:SpaceEngineers,代码行数:21,代码来源:MyProjectorBase.cs


示例12: OnNewBlueprintSuccess

 private void OnNewBlueprintSuccess(MyObjectBuilder_CubeGrid projectedGrid)
 {
     if (MyEventContext.Current.IsLocallyInvoked == false)
     {
         SetNewBlueprint(projectedGrid);
     }
 }
开发者ID:Rynchodon,项目名称:SpaceEngineers,代码行数:7,代码来源:MyProjectorBase.cs


示例13: PlacePrefabToWorld

        public static void PlacePrefabToWorld(MyObjectBuilder_CubeGrid[] currentPrefab, Vector3D position, List<MyCubeGrid> createdGrids = null)
        {        
            Vector3D newPosition = Vector3D.Zero;
            Vector3D positionOffset = Vector3D.Zero;
            bool firstIteration = true;
            MyEntities.RemapObjectBuilderCollection(currentPrefab);
            foreach (var gridBuilder in currentPrefab)
            {
                if (gridBuilder.PositionAndOrientation.HasValue)
                {
                    if (firstIteration)
                    {
                        positionOffset = position - gridBuilder.PositionAndOrientation.Value.Position;
                        firstIteration = false;
                        newPosition = position;
                    }
                    else
                    {
                        newPosition = gridBuilder.PositionAndOrientation.Value.Position + positionOffset;
                    }
                }

                MyPositionAndOrientation originalPos = gridBuilder.PositionAndOrientation.Value;
                originalPos.Position = newPosition;
                gridBuilder.PositionAndOrientation = originalPos; 

                MyCubeGrid currentGrid = MyEntities.CreateFromObjectBuilder(gridBuilder) as MyCubeGrid;

                if (currentGrid != null)
                {                
                    currentGrid.ClearSymmetries();
                    currentGrid.Physics.LinearVelocity = Vector3D.Zero;
                    currentGrid.Physics.AngularVelocity = Vector3D.Zero;
                    if (createdGrids != null)
                    {
                        createdGrids.Add(currentGrid);
                    }
                    MyEntities.Add(currentGrid, true);
                }
            }  
        }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:41,代码来源:MyCubeGrid.Static.cs


示例14: DoesGridHavePowerSupply

		public static bool DoesGridHavePowerSupply( MyObjectBuilder_CubeGrid grid )
		{
			return grid.CubeBlocks.Any( DoesBlockSupplyPower );
		}
开发者ID:dodexahedron,项目名称:EssentialsPlugin,代码行数:4,代码来源:CubeGrid.cs


示例15: HasOwner

		public static bool HasOwner( MyObjectBuilder_CubeGrid grid )
		{
			foreach ( MyObjectBuilder_CubeBlock block in grid.CubeBlocks )
			{
				if ( !( block is MyObjectBuilder_TerminalBlock ) )
					continue;

				MyObjectBuilder_TerminalBlock functional = (MyObjectBuilder_TerminalBlock)block;
				if ( functional.Owner != 0 )
					return true;
			}

			return false;
		}
开发者ID:dodexahedron,项目名称:EssentialsPlugin,代码行数:14,代码来源:CubeGrid.cs


示例16: HasCustomName

		public static bool HasCustomName( MyObjectBuilder_CubeGrid grid, string name, bool exact )
		{
			foreach ( MyObjectBuilder_CubeBlock block in grid.CubeBlocks )
			{
				MyObjectBuilder_TerminalBlock termBlock = block as MyObjectBuilder_TerminalBlock;
				if ( termBlock != null )
				{
					if ( exact )
					{
						if ( termBlock.CustomName != null && termBlock.CustomName == name )
						{
							return true;
						}
					}
					else
					{
						if ( termBlock.CustomName != null && termBlock.CustomName.Contains( name ) )
						{
							return true;
						}
					}
				}
			}

			return false;
		}
开发者ID:dodexahedron,项目名称:EssentialsPlugin,代码行数:26,代码来源:CubeGrid.cs


示例17: GetAllOwners

		public static List<long> GetAllOwners( MyObjectBuilder_CubeGrid grid )
		{
			Dictionary<long, int> ownerList = new Dictionary<long, int>( );
			foreach ( MyObjectBuilder_CubeBlock block in grid.CubeBlocks )
			{
				if ( block.Owner == 0 )
					continue;

				if ( ownerList.ContainsKey( block.Owner ) )
					ownerList[ block.Owner ] = ownerList[ block.Owner ] + 1;
				else
					ownerList.Add( block.Owner, 1 );
			}

			return ownerList.Select( x => x.Key ).ToList( );
		}
开发者ID:dodexahedron,项目名称:EssentialsPlugin,代码行数:16,代码来源:CubeGrid.cs


示例18: GetBoundingSphereForGrids

 private static BoundingSphere GetBoundingSphereForGrids(MyObjectBuilder_CubeGrid[] currentPrefab)
 {
     BoundingSphere boundingSphere = new BoundingSphere(Vector3.Zero, float.MinValue);
     foreach (var gridBuilder in currentPrefab)
     {
         BoundingSphere localSphere = gridBuilder.CalculateBoundingSphere();
         MatrixD gridTransform = gridBuilder.PositionAndOrientation.HasValue ? gridBuilder.PositionAndOrientation.Value.GetMatrix() : MatrixD.Identity;
         boundingSphere.Include(localSphere.Transform(gridTransform));
     }
     return boundingSphere;
 }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:11,代码来源:MyCubeGrid.Static.cs


示例19: GetGridSpawnMaterials

        public override void GetGridSpawnMaterials(MyObjectBuilder_CubeGrid grid)
        {
            ClearRequiredMaterials();

            foreach (var block in grid.CubeBlocks)
            {
                MyComponentStack.GetMountedComponents(m_materialList, block);
                if (block.ConstructionStockpile != null)
                {
                    foreach (var item in block.ConstructionStockpile.Items)
                    {
                        if (item.PhysicalContent != null)
                        {
                            var itemId = item.PhysicalContent.GetId();
                            m_materialList.AddMaterial(itemId, item.Amount, item.Amount, addToDisplayList: false);
                        }
                    }
                }
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:20,代码来源:MySpaceBuildComponent.cs


示例20: SendNewBlueprint

 private void SendNewBlueprint(MyObjectBuilder_CubeGrid projectedGrid)
 {
     SetNewBlueprint(projectedGrid);
     MyMultiplayer.RaiseEvent(this, x => x.OnNewBlueprintSuccess, projectedGrid);
 }
开发者ID:Rynchodon,项目名称:SpaceEngineers,代码行数:5,代码来源:MyProjectorBase.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MyObjectBuilder_DefinitionBase类代码示例发布时间:2022-05-24
下一篇:
C# MyObjectBuilder_CubeBlock类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap