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


C# MyObjectBuilder_CubeBlock类代码示例

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


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

示例1: Init

 public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
 {
     base.Init(objectBuilder, cubeGrid);
     MyObjectBuilder_UserControllableGun builder = (objectBuilder as MyObjectBuilder_UserControllableGun);
     m_shootingSaved = builder.IsLargeTurret ? builder.IsShootingFromTerminal : builder.IsShooting;
     NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;      
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:7,代码来源:MyUserControllableGun.cs

示例2: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            base.Init(objectBuilder, cubeGrid);

            m_cargoDefinition = (MyCargoContainerDefinition)MyDefinitionManager.Static.GetCubeBlockDefinition(objectBuilder.GetId());
            var cargoBuilder = (MyObjectBuilder_CargoContainer)objectBuilder;
            m_containerType = cargoBuilder.ContainerType;

            if (MyFakes.ENABLE_INVENTORY_FIX)
            {
                FixSingleInventory();
            }

            // Backward compatibility - inventory component not defined in definition files and in entity container
            if (this.GetInventory() == null)
            {
                MyInventory inventory = new MyInventory(m_cargoDefinition.InventorySize.Volume, m_cargoDefinition.InventorySize, MyInventoryFlags.CanSend | MyInventoryFlags.CanReceive);
                Components.Add<MyInventoryBase>(inventory);
                
                if (m_containerType != null && MyFakes.RANDOM_CARGO_PLACEMENT && (cargoBuilder.Inventory == null || cargoBuilder.Inventory.Items.Count == 0))
                    SpawnRandomCargo();
            }

            //Backward compatibility
            if (cargoBuilder.Inventory != null && cargoBuilder.Inventory.Items.Count > 0)
                this.GetInventory().Init(cargoBuilder.Inventory);

            Debug.Assert(this.GetInventory().Owner == this, "Ownership was not set!");
            this.GetInventory().SetFlags(MyInventoryFlags.CanSend | MyInventoryFlags.CanReceive);
            m_conveyorEndpoint = new MyMultilineConveyorEndpoint(this);
            AddDebugRenderComponent(new Components.MyDebugRenderComponentDrawConveyorEndpoint(m_conveyorEndpoint));
            UpdateIsWorking();
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:33,代码来源:MyCargoContainer.cs

示例3: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            InitializeSinkComponent();
            base.Init(objectBuilder, cubeGrid);
            if (CubeGrid.CreatePhysics)
            {
            	// Put on my fake, because it does performance issues
                if (MyFakes.ENABLE_GRAVITY_PHANTOM)
                {
                        var shape = CreateFieldShape();
                        Physics = new Engine.Physics.MyPhysicsBody(this, RigidBodyFlag.RBF_KINEMATIC);
                        Physics.IsPhantom = true;
                        Physics.CreateFromCollisionObject(shape, PositionComp.LocalVolume.Center, WorldMatrix, null, Sandbox.Engine.Physics.MyPhysics.CollisionLayers.GravityPhantomLayer);
                        shape.Base.RemoveReference();
                        Physics.Enabled = IsWorking;
                }
                NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;

                SlimBlock.ComponentStack.IsFunctionalChanged += ComponentStack_IsFunctionalChanged;
                ResourceSink.Update();
            }
            m_soundEmitter = new MyEntity3DSoundEmitter(this);
            m_baseIdleSound.Init("BlockGravityGen");
			
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:25,代码来源:MyGravityGeneratorBase.cs

示例4: Init

 public override void Init(MyObjectBuilder_CubeBlock builder, MyCubeGrid cubeGrid)
 {
     base.Init(builder, cubeGrid);
     this.NeedsUpdate = MyEntityUpdateEnum.EACH_100TH_FRAME;
     m_emissivitySet = false;
     AddDebugRenderComponent(new Components.MyDebugRenderComponentDrawConveyorSegment(m_segment));
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyConveyorConnector.cs

示例5: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            ResourceSink = new MyResourceSinkComponent();
            ResourceSink.Init(
                BlockDefinition.ResourceSinkGroup,
                BlockDefinition.RequiredPowerInput,
                this.CalculateRequiredPowerInput);

            base.Init(objectBuilder, cubeGrid);

            ResourceSink.IsPoweredChanged += Receiver_IsPoweredChanged;
            ResourceSink.Update();

            if (Physics != null)
            {
                Physics.Close();
            }

            var detectorShape = new HkBoxShape(new Vector3(cubeGrid.GridSize / 3.0f));
            var massProperties = HkInertiaTensorComputer.ComputeBoxVolumeMassProperties(detectorShape.HalfExtents, BlockDefinition.VirtualMass);
            Physics = new Sandbox.Engine.Physics.MyPhysicsBody(this, RigidBodyFlag.RBF_DEFAULT);
            Physics.IsPhantom = false;
            Physics.CreateFromCollisionObject(detectorShape, Vector3.Zero, WorldMatrix, massProperties, MyPhysics.CollisionLayers.VirtualMassLayer);
            Physics.Enabled = IsWorking && cubeGrid.Physics != null && cubeGrid.Physics.Enabled;
            Physics.RigidBody.Activate();
            detectorShape.Base.RemoveReference();

            UpdateText();

            NeedsUpdate |= MyEntityUpdateEnum.EACH_FRAME;

            SlimBlock.ComponentStack.IsFunctionalChanged += ComponentStack_IsFunctionalChanged;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:33,代码来源:MyVirtualMass.cs

示例6: Init

        public override void Init(MyObjectBuilder_CubeBlock builder, MyCubeGrid cubeGrid)
        {
            ResourceSink = new MyResourceSinkComponent();
            ResourceSink.Init(
                MyStringHash.GetOrCompute(BlockDefinition.ResourceSinkGroup),
                BlockDefinition.PowerConsumptionMoving,
                UpdatePowerInput);

            base.Init(builder, cubeGrid);

            var ob = (MyObjectBuilder_AirtightDoorGeneric)builder;
            m_open.Value = ob.Open;
            m_currOpening = ob.CurrOpening;

            m_openingSpeed = BlockDefinition.OpeningSpeed;
            m_sound = new MySoundPair(BlockDefinition.Sound);
            m_subpartMovementDistance = BlockDefinition.SubpartMovementDistance;
	
			if (!Enabled || !ResourceSink.IsPoweredByType(MyResourceDistributorComponent.ElectricityId))
                UpdateDoorPosition();

            OnStateChange();

            ResourceSink.IsPoweredChanged += Receiver_IsPoweredChanged;
            ResourceSink.Update();
            SlimBlock.ComponentStack.IsFunctionalChanged += ComponentStack_IsFunctionalChanged;
			ResourceSink.Update();
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:28,代码来源:MyAirtightDoorGeneric.cs

示例7: Init

        public override void Init(MyObjectBuilder_CubeBlock builder, MyCubeGrid cubeGrid)
        {
            var rotorOb = builder as MyObjectBuilder_MotorRotor;

            base.Init(builder, cubeGrid);

            LoadDummies();
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:8,代码来源:MyMotorRotor.cs

示例8: CreateCubeBlock

 public static object CreateCubeBlock(MyObjectBuilder_CubeBlock builder)
 {
     var obj = m_objectFactory.CreateInstance(builder.TypeId);
     var entity = obj as MyEntity; // Some are SlimBlocks
     if (entity != null)
     {
         MyEntityFactory.AddScriptGameLogic(entity, builder.TypeId, builder.SubtypeName);
     }
     return obj;
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:10,代码来源:MyCubeBlockFactory.cs

示例9: Init

 public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
 {
     base.Init(objectBuilder, cubeGrid);
     if (CubeGrid.GridSizeEnum == MyCubeSize.Large)
     {
         IDLE_SOUND.Init("ToolLrgGrindIdle");
         METAL_SOUND.Init("ToolLrgGrindMetal");
     }
     m_rotationSpeed = 0.0f;
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:10,代码来源:MyShipGrinder.cs

示例10: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            base.Init(objectBuilder, cubeGrid);
            if (CubeGrid.GridSizeEnum == MyCubeSize.Large)
            {
                IDLE_SOUND.Init("ToolLrgGrindIdle");
                METAL_SOUND.Init("ToolLrgGrindMetal");
            }
            m_rotationSpeed = 0.0f;

            HeatUpFrames = MyShipGrinderConstants.GRINDER_HEATUP_FRAMES;
        }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:12,代码来源:MyShipGrinder.cs

示例11: 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;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:12,代码来源:MyFunctionalBlock.cs

示例12: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            SyncFlag = true;

            base.Init(objectBuilder, cubeGrid);

            m_missingComponents = new Dictionary<string, int>();

            var builder = (MyObjectBuilder_ShipWelder)objectBuilder;
            m_helpOthers.Value = builder.HelpOthers;

        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:12,代码来源:MyShipWelder.cs

示例13: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            MyDebug.AssertDebug(BlockDefinition.Id.TypeId == typeof(MyObjectBuilder_Reactor));
            m_reactorDefinition = BlockDefinition as MyReactorDefinition;
            MyDebug.AssertDebug(m_reactorDefinition != null);

            SourceComp.Init(
                m_reactorDefinition.ResourceSourceGroup,
                new MyResourceSourceInfo
                {
                    ResourceTypeId = MyResourceDistributorComponent.ElectricityId,
                    DefinedOutput = m_reactorDefinition.MaxPowerOutput,
                    ProductionToCapacityMultiplier = 60 * 60
                });
            SourceComp.HasCapacityRemainingChanged += (id, source) => UpdateIsWorking();
            SourceComp.OutputChanged += Source_OnOutputChanged;
            SourceComp.ProductionEnabledChanged += Source_ProductionEnabledChanged;
            SourceComp.Enabled = Enabled;

            base.Init(objectBuilder, cubeGrid);
         
            var obGenerator = (MyObjectBuilder_Reactor)objectBuilder;

            if (MyFakes.ENABLE_INVENTORY_FIX)
            {
                FixSingleInventory();
            }

            if (this.GetInventory() == null)
            {
                MyInventory inventory = new MyInventory(m_reactorDefinition.InventoryMaxVolume, m_reactorDefinition.InventorySize, MyInventoryFlags.CanReceive);
                Components.Add<MyInventoryBase>(inventory);
                inventory.Init(obGenerator.Inventory);
            }
            Debug.Assert(this.GetInventory().Owner == this, "Ownership was not set!");

            this.GetInventory().Constraint = m_reactorDefinition.InventoryConstraint;

            if (Sync.IsServer)
            {
                RefreshRemainingCapacity();
            }
            
            UpdateText();

            SlimBlock.ComponentStack.IsFunctionalChanged += ComponentStack_IsFunctionalChanged;

            NeedsUpdate |= MyEntityUpdateEnum.EACH_100TH_FRAME;

            m_useConveyorSystem.Value = obGenerator.UseConveyorSystem;
			UpdateMaxOutputAndEmissivity();
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:52,代码来源:MyReactor.cs

示例14: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            base.Init(objectBuilder, cubeGrid);

            // User settings:
            m_randomStandbyChangeConst_ms = MyUtils.GetRandomInt(3500, 4500);

            if (m_gunBase.HasAmmoMagazines)
                m_shootingCueEnum = m_gunBase.ShootSound;
            m_rotatingCueEnum.Init("WepTurretInteriorRotate");

            Render.NeedsDraw = true;
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:13,代码来源:MyLargeInteriorTurret.cs

示例15: Init

        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
          
            base.Init(objectBuilder, cubeGrid);

            //var boxshape = new HkBoxShape((LocalAABB.Max - LocalAABB.Min) / 2);
            //var boxshape = new HkBoxShape(new Vector3(0.43f, MyDefinitionManager.Static.GetCubeSize(MyCubeSize.Large) / 2.0f, 0.43f));
            //Physics = new MyPhysicsBody(this, RigidBodyFlag.RBF_DISABLE_COLLISION_RESPONSE);
            //Physics.CreateFromCollisionObject((HkShape)boxshape, Vector3.Zero, WorldMatrix);
            //Physics.Enabled = true;
            //boxshape.Base.RemoveReference();
            AddDebugRenderComponent(new MyDebugRenderComponentLadder(this));
         
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:14,代码来源:MyLadder.cs


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