Exemplo n.º 1
0
 protected void SetMeshFile(string filename)
 {
     if (Mesh != null)
     {
         Mesh.Dispose();
         Mesh = null;
     }
     if (!string.IsNullOrEmpty(filename))
     {
         Mesh = new XMesh(filename, airplaneControl.AircraftParameters.FolderName);
         XMesh xMesh = (XMesh)(this.Mesh);
         xMesh.ComputeBoundingBox();
     }
 }
Exemplo n.º 2
0
        public AirplaneModel(IAirplaneControl airplaneControl)
        {
            this.airplaneControl = airplaneControl;
            if (!string.IsNullOrEmpty(airplaneControl.AircraftParameters.FixedMesh))
            {
                this.Mesh = new XMesh(airplaneControl.AircraftParameters.FixedMesh, airplaneControl.AircraftParameters.FolderName);
                XMesh xMesh = (XMesh)(this.Mesh);
                xMesh.ComputeBoundingBox();
            }
            this.Scale    = new Vector3(airplaneControl.AircraftParameters.Scale, airplaneControl.AircraftParameters.Scale, airplaneControl.AircraftParameters.Scale);
            this.Position = new Vector3(0.0f, 10.0f, 0.0f);

            foreach (AircraftParameters.ControlSurface controlSurfaceDef in airplaneControl.AircraftParameters.ControlSurfaces)
            {
                ControlSurface surface = new ControlSurface(controlSurfaceDef, airplaneControl);
                AddChild(surface);
            }

            engineMinFreq = airplaneControl.AircraftParameters.EngineMinFrequency;
            engineMaxFreq = airplaneControl.AircraftParameters.EngineMaxFrequency;
            if (!string.IsNullOrEmpty(airplaneControl.AircraftParameters.EngineSound))
            {
                engineSound = new SoundControllable(airplaneControl.AircraftParameters.EngineSound, airplaneControl.AircraftParameters.FolderName);
            }
            if ((airplaneControl.AircraftParameters.FlightModelType == AircraftParameters.FlightModelTypeEnum.Helicopter) &&
                (airplaneControl.AircraftParameters.RotorSound != null))
            {
                if (!string.IsNullOrEmpty(airplaneControl.AircraftParameters.RotorSound))
                {
                    rotorSound = new SoundControllable(airplaneControl.AircraftParameters.RotorSound, airplaneControl.AircraftParameters.FolderName);
                }
            }

            crashSound = new SoundControllable("data\\crash.wav");

            if (!(airplaneControl is RecordedFlight))
            {
                Birds.ScareCrow = this;
            }
        }