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


C# ObjectBuilders.MyObjectBuilder_CubeGrid类代码示例

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


MyObjectBuilder_CubeGrid类属于Sandbox.Common.ObjectBuilders命名空间,在下文中一共展示了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:Krulac,项目名称:SpaceEngineers,代码行数:8,代码来源:MyBattleHelper.cs

示例2: RequestThrow

 public static void RequestThrow(MyObjectBuilder_CubeGrid grid, Vector3D position, Vector3D linearVelocity, float mass, MyStringId throwSound)
 {
     ThrowMsg msg = new ThrowMsg();
     msg.Grid = grid;
     msg.Position = position;
     msg.LinearVelocity = linearVelocity;
     msg.Mass = mass;
     msg.ThrowSound = throwSound;
     MySession.Static.SyncLayer.SendMessageToServer(ref msg);
 }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:10,代码来源:MySyncThrower.cs

示例3: ProcessCubeGrid

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

示例4: Contains

        public bool Contains(IMySlimBlock block)
        {
            if (block.CubeGrid == null)
                return false;

            // FatBlock is null for non functional blocks such as armor
            if (block.FatBlock != null)
                return Contains(block.FatBlock);

            // since some blocks aren't an entity we have to deal with them otherwise
            // we'll create an grid that acts as substitute for the block to get an entity that has a collision
            // TODO find a better suited way to get the boundings of an armor block
            var worldPosition = block.CubeGrid.GetPosition() + block.Position;

            // creating grid
            var gridBuilder = new MyObjectBuilder_CubeGrid()
            {
                PersistentFlags = MyPersistentEntityFlags2.None,
                PositionAndOrientation = new MyPositionAndOrientation(worldPosition, Vector3.Forward, Vector3.Up),
                DisplayName = "substitute",
                GridSizeEnum = block.CubeGrid.GridSizeEnum
            };

            // creating cube block
            MyObjectBuilder_CubeBlock cube = new MyObjectBuilder_CubeBlock();
            cube.Min = block.Position;
            cube.SubtypeName = block.CubeGrid.GridSizeEnum == MyCubeSize.Large ? "LargeBlockArmorBlock" : "SmallBlockArmorBlock";
            cube.BuildPercent = 0;
            gridBuilder.CubeBlocks.Add(cube);

            // add grid
            MyAPIGateway.Entities.RemapObjectBuilder(gridBuilder);
            var entity = MyAPIGateway.Entities.CreateFromObjectBuilder(gridBuilder);
            var grid = entity as IMyCubeGrid;
            var blocks = new List<IMySlimBlock>();

            // get blocks
            grid.GetBlocks(blocks, b => b != null);

            if (blocks.Count > 0)
            {
                // found block
                var cubeBlock = blocks[0].FatBlock;
                bool isInside = Contains(cubeBlock);
                grid.Close();
                return isInside;
            }

            return false;
        }
开发者ID:Intueor,项目名称:Space-Engineers-Admin-script-mod,代码行数:50,代码来源:ProtectionArea.cs

示例5: 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:LoganRickert,项目名称:SEServerExtender,代码行数:15,代码来源:CubeGridEntity.cs

示例6: Invoke

        public override bool Invoke(string messageText)
        {
            MatrixD worldMatrix;
            Vector3D position;

            if (MyAPIGateway.Session.Player.Controller.ControlledEntity.Entity.Parent == null)
            {
                worldMatrix = MyAPIGateway.Session.Player.Controller.ControlledEntity.GetHeadMatrix(true, true, false); // dead center of player cross hairs.
                position = worldMatrix.Translation + worldMatrix.Forward * 2.5f; // Spawn item 1.5m in front of player for safety.
            }
            else
            {
                worldMatrix = MyAPIGateway.Session.Player.Controller.ControlledEntity.Entity.WorldMatrix;
                position = worldMatrix.Translation + worldMatrix.Forward * 2.5f + worldMatrix.Up * 0.5f; // Spawn item 1.5m in front of player in cockpit for safety.
            }

            // TODO: multiply vector against current entity.LinearVelocity.
            Vector3 vector = worldMatrix.Forward * 300;

            var gridObjectBuilder = new MyObjectBuilder_CubeGrid()
            {
                PersistentFlags = MyPersistentEntityFlags2.CastShadows | MyPersistentEntityFlags2.InScene,
                GridSizeEnum = MyCubeSize.Large,
                IsStatic = false,
                LinearVelocity = vector,
                AngularVelocity = new SerializableVector3(0, 0, 0),
                PositionAndOrientation = new MyPositionAndOrientation(position, Vector3.Forward, Vector3.Up),
                DisplayName = "Prepare to die."
            };

            MyObjectBuilder_Warhead cube = new MyObjectBuilder_Warhead()
            {
                Min = new SerializableVector3I(0, 0, 0),
                SubtypeName = "LargeWarhead",
                ColorMaskHSV = new SerializableVector3(0, -1, 0),
                EntityId = 0,
                Owner = 0,
                BlockOrientation = new SerializableBlockOrientation(Base6Directions.Direction.Forward, Base6Directions.Direction.Up),
                ShareMode = MyOwnershipShareModeEnum.All,
                CustomName = "Hello. My name is Inigo Montoya. You killed my father. Prepare to die.",
            };

            gridObjectBuilder.CubeBlocks.Add(cube);
            var tempList = new List<MyObjectBuilder_EntityBase>();
            tempList.Add(gridObjectBuilder);
            tempList.CreateAndSyncEntities();
            return true;
        }
开发者ID:zerty,项目名称:Space-Engineers-Admin-script-mod,代码行数:48,代码来源:CommandBomb.cs

示例7: Init

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

            if (WheelSystem != null)
                WheelSystem.HandBrake = builder.Handbrake;

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

            if (MyPerGameSettings.EnableJumpDrive)
            {
                JumpSystem.Init(builder.JumpDriveDirection, builder.JumpElapsedTicks);
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:19,代码来源:MyCubeGridSystems.cs

示例8: LoadFromCubeGrid

        public void LoadFromCubeGrid(IMyCubeGrid grid)
        {
            base.LoadFromEntity(grid as IMyEntity);

            IngameGrid = grid;

            //IngameGrid = grid;
            DisplayName = grid.DisplayName;
            // ToDo: get all owners instead of big (for targeting)
            BigOwners = grid.BigOwners;
            // ToDo: get real spawn owners (for spawning)
            SpawnOwners = grid.BigOwners;
            //IMyEntity entity = grid as IMyEntity;
            Builder = grid.GetObjectBuilder() as MyObjectBuilder_CubeGrid;

            if (Builder == null) {
                Log.Error("Got null builder for entity " + EntityId +
                    ". We will be unable to save it now.", "LoadFromCubeGrid");
            }
            else {
                //Log.Error("Filling builder nulls for " + EntityId, "LoadFromCubeGrid");
                //Builder.FillNullsWithDefaults();
            }
        }
开发者ID:HaoTNN,项目名称:GardenPerformance,代码行数:24,代码来源:ConcealableGrid.cs

示例9: DoesGridHaveFourBeacons

        public static bool DoesGridHaveFourBeacons( MyObjectBuilder_CubeGrid grid )
        {
            int count = 0;
            foreach ( MyObjectBuilder_CubeBlock block in grid.CubeBlocks )
            {
                if ( block is MyObjectBuilder_Beacon )
                    count++;

                if ( count >= 4 )
                    return true;
            }

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

示例10: DoesGridHavePowerSupply

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

示例11: SetNewBlueprint

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

            var clone = (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:blaho,项目名称:SpaceEngineers,代码行数:21,代码来源:MyProjector.cs

示例12: 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:caomw,项目名称:SpaceEngineers,代码行数:22,代码来源:MyProjector.cs

示例13: blueprintScreen_Closed

        void blueprintScreen_Closed(MyGuiScreenBase source)
        {
            PowerReceiver.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;
                }
            }

            m_originalGridBuilder = (MyObjectBuilder_CubeGrid)m_clipboard.CopiedGrids[largestGridIndex].Clone();

            m_clipboard.ProcessCubeGrid(m_clipboard.CopiedGrids[largestGridIndex]);

            MyEntities.RemapObjectBuilder(m_originalGridBuilder);
            SyncObject.SendNewBlueprint(m_originalGridBuilder);
        }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:39,代码来源:MyProjector.cs

示例14: SetNewBlueprint

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

            var clone = (MyObjectBuilder_CubeGrid)gridBuilder.Clone();
            MyEntities.RemapObjectBuilder(clone);
            m_clipboard.ProcessCubeGrid(clone);

            m_clipboard.SetGridFromBuilder(clone, Vector3.Zero, 0f);
            InitializeClipboard();
        }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:11,代码来源:MyProjector.cs

示例15: ActivateShipCreationClipboard

        public void ActivateShipCreationClipboard(MyObjectBuilder_CubeGrid[] grids, Vector3 centerDeltaDirection, float dragVectorLength)
        {
            if (m_shipCreationClipboard.IsActive)
                return;

            MySessionComponentVoxelHand.Static.Enabled = false;
            DeactivateMultiBlockClipboard();
            m_shipCreationClipboard.SetGridFromBuilders(grids, centerDeltaDirection, dragVectorLength);
        }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:9,代码来源:MyCubeBuilder.cs


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