Пример #1
0
        public override MyObjectBuilder_CubeBlock GetObjectBuilderCubeBlock(bool copy = false)
        {
            MyObjectBuilder_AdvancedDoor objectBuilderCubeBlock = (MyObjectBuilder_AdvancedDoor)base.GetObjectBuilderCubeBlock(copy);

            objectBuilderCubeBlock.Open = (bool)base.m_open;
            return(objectBuilderCubeBlock);
        }
Пример #2
0
        public override void Init(MyObjectBuilder_CubeBlock builder, MyCubeGrid cubeGrid)
        {
            MyResourceSinkComponent component = new MyResourceSinkComponent(1);

            component.Init(this.BlockDefinition.ResourceSinkGroup, this.BlockDefinition.PowerConsumptionMoving, new Func <float>(this.UpdatePowerInput));
            base.ResourceSink = component;
            base.Init(builder, cubeGrid);
            MyObjectBuilder_AdvancedDoor door = (MyObjectBuilder_AdvancedDoor)builder;

            base.m_open.SetLocalValue(door.Open);
            component.IsPoweredChanged += new Action(this.Receiver_IsPoweredChanged);
            component.Update();
            if (!base.Enabled || !base.ResourceSink.IsPoweredByType(MyResourceDistributorComponent.ElectricityId))
            {
                this.UpdateDoorPosition();
            }
            this.OnStateChange();
            if (base.m_open != null)
            {
                this.UpdateDoorPosition();
            }
            base.SlimBlock.ComponentStack.IsFunctionalChanged += new Action(this.ComponentStack_IsFunctionalChanged);
            base.ResourceSink.Update();
        }