예제 #1
0
        public Program()
        {
            // Load state if state was saved previously.
            int savedState;

            if (int.TryParse(Storage, out savedState))
            {
                state = (State)savedState;
            }
            else
            {
                state = State.WaitingForPayload;
            }

            // Find all needed blocks.
            blocks = new ExpectedBlocks(GridTerminalSystem);
            blocks.FindBlock <IMyTextPanel>(CRANE_ARM_STATUS_PANEL);
            blocks.FindBlock <IMyPistonBase>(CRANE_ARM_PISTON);
            blocks.FindBlock <IMyMotorStator>(CRANE_ARM_ROTOR);
            blocks.FindBlocks <IMyThrust>(CRANE_ARM_THRUSTER, 6);
            blocks.FindBlocks <IMyShipConnector>(CRANE_ARM_CONNECTOR, 3);
            blocks.FindBlocks <IMyPistonBase>(CRANE_LIFT_PISTON, 2);

            // Initialize other utility classes.
            thrustControl                = new ThrustControl(blocks);
            payloadPickupStateMachine    = new PayloadPickupStateMachine(blocks);
            payloadTransportStateMachine = new PayloadTransportStateMachine(blocks, thrustControl);
            craneArmResetStateMachine    = new CraneArmResetStateMachine(blocks, thrustControl);

            // Start update loop.
            Runtime.UpdateFrequency |= UpdateFrequency.Update1;
        }
 public Program()
 {
     blocks = new ExpectedBlocks(GridTerminalSystem);
     blocks.FindBlocks <IMyLightingBlock>("Interior Light", -1);
     blocks.FindBlocks <IMyLightingBlock>("Corner Light", -1);
 }
 public Program()
 {
     blocks = new ExpectedBlocks(GridTerminalSystem);
     blocks.FindBlocks <IMyPistonBase>(PISTON_DOOR, 2);
     blocks.FindBlocks <IMyMotorStator>(ROTOR_DOOR_POWER, 2);
 }