Esempio n. 1
0
    private void TEngine(Vector3D output)
    {
        //TODO	六向常规推力
        foreach (IMyThrust Thrust in Thrusts)
        {
            switch (Directions[Thrust])
            {
            case Base6Directions.Direction.Forward:
                Thrust.ApplyAction((output.Z > 0)?"OnOff_On":"OnOff_Off");
                Thrust.SetValue("Override", Convert.ToSingle((output.Z > 0)?output.Z:0f));
                break;

            case Base6Directions.Direction.Backward:
                Thrust.ApplyAction((output.Z < 0)?"OnOff_On":"OnOff_Off");
                Thrust.SetValue("Override", Convert.ToSingle((output.Z < 0)?-output.Z:0f));
                break;

            case Base6Directions.Direction.Left:
                Thrust.ApplyAction((output.X > 0)?"OnOff_On":"OnOff_Off");
                Thrust.SetValue("Override", Convert.ToSingle((output.X > 0)?output.X:0f));
                break;

            case Base6Directions.Direction.Right:
                Thrust.ApplyAction((output.X < 0)?"OnOff_On":"OnOff_Off");
                Thrust.SetValue("Override", Convert.ToSingle((output.X < 0)?-output.X:0f));
                break;

            case Base6Directions.Direction.Down:
                Thrust.ApplyAction((output.Y > 0)?"OnOff_On":"OnOff_Off");
                Thrust.SetValue("Override", Convert.ToSingle((output.Y > 0)?output.Y:0f));
                break;

            case Base6Directions.Direction.Up:
                Thrust.ApplyAction((output.Y < 0)?"OnOff_On":"OnOff_Off");
                Thrust.SetValue("Override", Convert.ToSingle((output.Y < 0)?-output.Y:0f));
                break;
            }
        }
    }