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


C# MyObjectBuilder_CubeGrid类代码示例

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


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


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