Esempio n. 1
0
        public void Main(string argument, UpdateType updateSource)
        {
            float offset = 0;

            // Rotor
            if (argument.Equals("start"))
            {
                rotor.SetValueFloat("Velocity", 0.4f);
                rotor.SetValueFloat("UpperLimit", 45 + offset);
                rotor.SetValueFloat("LowerLimit", -45 + offset);
                rotor.SetValueBool("RotorLock", false);
                rotor.SetValueBool("ShareInertiaTensor", false);

                cranePistons.ForEach(piston => ((IMyPistonBase)piston).SetValueFloat("Velocity", -0.3f));
                horizontal1.SetValueFloat("UpperLimit", 1);
            }
            else if (argument.Equals("piston-half"))
            {
                vertical1.SetValueFloat("UpperLimit", 1);
            }
            else if (argument.Equals("piston-half-low"))
            {
                vertical1.SetValueFloat("LowerLimit", 1);
            }
            else if (argument.Equals("piston-full"))
            {
                vertical1.SetValueFloat("UpperLimit", 2);
            }
            else if (argument.Equals("piston-full-low"))
            {
                vertical1.SetValueFloat("LowerLimit", 2);
            }
            else if (argument.Equals("phase-two"))
            {
                rotor.SetValueFloat("Velocity", -0.5f);
                rotor.SetValueFloat("LowerLimit", -90 + offset);
            }
            else if (argument.Equals("rotor-phase-two-finish"))
            {
                rotor.SetValueFloat("UpperLimit", 90 + offset);
            }
            else if (argument.Equals("rotor-phase-three"))
            {
                rotor.SetValueFloat("Velocity", -0.5f);
                rotor.SetValueFloat("LowerLimit", -45 + offset);
            }
            else if (argument.Equals("rotor-phase-three-finish"))
            {
                rotor.SetValueFloat("UpperLimit", 45 + offset);
            }
            else if (argument.Equals("reset"))
            {
                if (rotor.GetValueFloat("Velocity") < 0)
                {
                    rotor.SetValueFloat("UpperLimit", 0 + offset);
                    rotor.SetValueFloat("Velocity", 1f);
                }
                else
                {
                    rotor.SetValueFloat("LowerLimit", 0 + offset);
                    rotor.SetValueFloat("Velocity", -1f);
                }
                horizontal1.SetValueFloat("LowerLimit", 0.2063f);
            }
            else if (argument.Equals("rotor-end"))
            {
                rotor.SetValueFloat("Velocity", 0);
                rotor.SetValueBool("RotorLock", true);
                rotor.SetValueBool("ShareInertiaTensor", true);

                // Pistons
            }
            else if (argument.Equals("piston-start"))
            {
            }
        }