Esempio n. 1
0
        /// <summary>
        /// Stop movement and rotation of the controller.
        /// </summary>
        /// <param name="enableDampeners">If true, dampeners will be enabled. If false, they will not be toggled.</param>
        public void MoveAndRotateStop(bool enableDampeners = true)
        {
            if (enableDampeners)
            {
                SetDamping(true);
            }

            if (m_stopped)
            {
                Log.TraceLog("already stopped");
                return;
            }

            Log.DebugLog("stopping movement and rotation, dampeners: " + enableDampeners);

            m_moveForceRatio = m_moveAccel = Vector3.Zero;

            StopRotate();

            MyAPIGateway.Utilities.TryInvokeOnGameThread(() => {
                Block.Controller.MoveAndRotateStopped();
                Thrust.ClearOverrides();
                //m_gyro.ClearOverrides();
            });

            m_stopped = true;
        }
Esempio n. 2
0
 public void SetControl(bool enable)
 {
     if (Block.AutopilotControl != enable)
     {
         Log.DebugLog("setting control, AutopilotControl: " + Block.AutopilotControl + ", enable: " + enable);
         MyAPIGateway.Utilities.TryInvokeOnGameThread(() => {
             if (!enable)
             {
                 Block.Controller.MoveAndRotateStopped();
                 Thrust.ClearOverrides();
                 //m_gyro.ClearOverrides();
             }
             Block.AutopilotControl = enable;
         });
     }
 }