Example #1
0
        /*
         * protected void AddChildren(GameObject gameObject, TreeNode treeNode)
         * {
         *  foreach (GameObject child in gameObject.Children)
         *  {
         *      ControlSurface surface = child as ControlSurface;
         *      if (surface != null)
         *      {
         *          TreeNode node = new TreeNode(surface.Name);
         *          node.Tag = surface;
         *          AddChildren(surface, node);
         *          treeNode.Nodes.Add(node);
         *      }
         *  }
         * }
         */
        #endregion

        #region Public methods
        public void Reset()
        {
            iFlightModel.Reset();
            iFlightModel.Z = 5f;
            if (iFlightModel.AircraftParameters.HandLaunched)
            {
                iFlightModel.HandLaunch(-pilotPosition.Z, -pilotPosition.X, -pilotPosition.Y);
            }
            airplaneModel.StartEngine();
        }
Example #2
0
        /// <summary>
        /// Resets the position of the airplane
        /// </summary>
        public void Reset()
        {
            iFlightModel.Reset();
            iFlightModel.Throttle     = 0;
            iFlightModel.CableEnabled = false;
            crashTime = 0;
            if (AircraftParameters.HandLaunched)
            {
                if (variometer != null)
                {
                    variometer.Play(true);
                }
                iFlightModel.HandLaunch(-owner.PilotPosition.Z, -owner.PilotPosition.X, -owner.PilotPosition.Y);
            }
            else if (AircraftParameters.HasFloats && TakeOffFromWater)
            {
                iFlightModel.X = -waterStartPosition.Z;
                iFlightModel.Y = -waterStartPosition.X;
                iFlightModel.Z = -waterStartPosition.Y;
                if (AircraftParameters.HasRetracts)
                {
                    iFlightModel.GearExtended = false;
                }
            }
            else
            {
                iFlightModel.X = -defaultStartPosition.Z;
                iFlightModel.Y = -defaultStartPosition.X;
                iFlightModel.Z = -defaultStartPosition.Y;
            }
            if ((owner != null) && (owner.InputManager != null))
            {
                prevFlapsChannel = owner.InputManager.GetAxisValue("flaps");
                prevGearChannel  = owner.InputManager.GetAxisValue("gear");
            }

            airplane.StartEngine();

            prevPos = new Vector3(-iFlightModel.Y, -iFlightModel.Z, -iFlightModel.X);
        }