<?xml version="1.0" encoding="UTF-8"?>

<PropertyList>

  <path>dhc1.ac</path>

  <nasal>
    <load>
      var livery_update = aircraft.livery_update.new("Aircraft/dhc1/Models/Liveries", 10);

      var self = cmdarg();

      var float_0 = self.getNode("sim/multiplay/generic/float[0]", 1);
      var float_1 = self.getNode("sim/multiplay/generic/float[1]", 1);
      
      var crew_door = self.getNode("instrumentation/doors/crew/position-norm", 1);
      var passenger_door = self.getNode("instrumentation/doors/passenger/position-norm", 1);
    
      crew_door.alias(float_0);
      passenger_door.alias(float_1);
    </load>

    <unload>
      livery_update.stop();
      crew_door.unalias();
      passenger_door.unalias();
    </unload>
  </nasal>

  <animation>
    <!-- Objets opaques -->
    <object-name>fuselage</object-name>
    <object-name>direction</object-name>
    <object-name>ailes</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>voletG</object-name>
    <object-name>voletD</object-name>
    <object-name>ailes2</object-name>
    <object-name>profondeur</object-name>
    <object-name>bol</object-name>
    <object-name>helice</object-name>
    <object-name>tourverriere</object-name>
    <object-name>air</object-name>

    <object-name>roueG</object-name>
    <object-name>axeG</object-name>
    <object-name>roueD</object-name>
    <object-name>axeD</object-name>
    <object-name>roueA</object-name>
    <object-name>axes</object-name>
    <object-name>trous</object-name>

    <!-- Objets transparents -->
    <object-name>vitres</object-name>
    <object-name>verriere</object-name>
    <object-name>propdisc</object-name>
    <object-name>propblur</object-name>
  </animation>

  <animation>
    <type>material</type>
    <object-name>fuselage</object-name>
    <object-name>direction</object-name>
    <object-name>ailes</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>voletG</object-name>
    <object-name>voletD</object-name>
    <object-name>ailes2</object-name>
    <object-name>profondeur</object-name>
    <object-name>bol</object-name>
    <object-name>helice</object-name>
    <object-name>tourverriere</object-name>
    <object-name>air</object-name>

    <object-name>roueG</object-name>
    <object-name>axeG</object-name>
    <object-name>roueD</object-name>
    <object-name>axeD</object-name>
    <object-name>roueA</object-name>
    <object-name>axes</object-name>
    <object-name>trous</object-name>

    <property-base>sim/model/livery</property-base>
    <texture-prop>texture</texture-prop>
    <texture>texture.png</texture>
<!--
    <diffuse>
      <red-prop>diffuse/red</red-prop>
      <green-prop>diffuse/green</green-prop>
      <blue-prop>diffuse/blue</blue-prop>
    </diffuse>

    <ambient>
      <red-prop>ambient/red</red-prop>
      <green-prop>ambient/green</green-prop>
      <blue-prop>ambient/blue</blue-prop>
    </ambient>
-->
    <specular>
      <red-prop>specular/red</red-prop>
      <green-prop>specular/green</green-prop>
      <blue-prop>specular/blue</blue-prop>
    </specular>

    <emission>
      <red-prop>emission/red</red-prop>
      <green-prop>emission/green</green-prop>
      <blue-prop>emission/blue</blue-prop>
    </emission>
<!--
    <shininess>
      <shininess-prop>shininess</shininess-prop>
    </shininess>
-->
  </animation>

  <effect>
    <inherits-from>Aircraft/Generic/Effects/Fuselagereflect</inherits-from>
    <object-name>fuselage</object-name>
    <object-name>direction</object-name>
    <object-name>ailes</object-name>
    <object-name>aileronG</object-name>
    <object-name>aileronD</object-name>
    <object-name>voletG</object-name>
    <object-name>voletD</object-name>
    <object-name>ailes2</object-name>
    <object-name>profondeur</object-name>
    <object-name>bol</object-name>
    <object-name>helice</object-name>
    <object-name>tourverriere</object-name>
    <object-name>air</object-name>
  </effect>

  <animation>
    <type>shader</type>
    <shader>chrome</shader>
    <texture>Aircraft/Generic/Effects/glass_shader.png</texture>
    <object-name>vitres</object-name>
  </animation>

  <animation>
    <type>noshadow</type>
    <object-name>vitres</object-name>
    <object-name>propdisc</object-name>
    <object-name>propblur</object-name>
  </animation>

  <!-- Cranking effects -->
  <!-- Left exterior -->
  <model>
    <path>Aircraft/dhc1/Models/Effects/cranking/cranking.xml</path>
    <offsets>
      <x-m> -3.051 </x-m>
      <y-m>  0.210 </y-m>
      <z-m> -0.264 </z-m>
    </offsets>
  </model>

  <!-- Effets sur le sol -->
  <!-- Roue gauche -->
  <model>
    <path>Aircraft/dhc1/Models/Effects/ground/ground0.xml</path>
    <offsets>
      <x-m> -2.057 </x-m>
      <y-m> -1.331 </y-m>
      <z-m> -1.413 </z-m>
    </offsets>
  </model>

  <!-- Roue droite -->
  <model>
    <path>Aircraft/dhc1/Models/Effects/ground/ground1.xml</path>
    <offsets>
      <x-m> -2.057 </x-m>
      <y-m>  1.331 </y-m>
      <z-m> -1.413 </z-m>
    </offsets>
  </model>

  <!-- Roue de queue -->
  <model>
    <path>Aircraft/dhc1/Models/Effects/ground/ground2.xml</path>   
    <offsets>
      <x-m>  3.266 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.617 </z-m>
    </offsets>
  </model>

  <!-- Interieur -->
  <model>
    <path>Aircraft/dhc1/Models/Interior/interior.xml</path>
    <offsets>
      <x-m> 0 </x-m>
      <y-m> 0 </y-m>
      <z-m> 0 </z-m>
      <roll-deg>    0 </roll-deg>
      <pitch-deg>   0 </pitch-deg>
      <heading-deg> 0 </heading-deg>
    </offsets>
  </model>

  <!-- Immatriculatoin
  <model>
    <path>Aircraft/Lancair-235/Models/Immat/immat.xml</path>
    <offsets>
      <x-m> 0 </x-m>
      <y-m> 0 </y-m>
      <z-m> 0 </z-m>
      <roll-deg>    0 </roll-deg>
      <pitch-deg>   0 </pitch-deg>
      <heading-deg> 0 </heading-deg>
    </offsets>
  </model> -->

  <!-- Une ombre pour OSG -->
  <model>
    <name>shadowOSG</name>
    <path>Aircraft/dhc1/Models/shadow.xml</path>
  </model>

  <!-- L'hélice --> 
  <animation>
    <name>HeliceComplete</name>
    <object-name>propdisc</object-name>
    <object-name>propblur</object-name>
    <object-name>helice</object-name>
    <object-name>bol</object-name>
  </animation>

  <!-- Séléction de l'objet visible en fonction des rpm -->
  <animation>
    <type>select</type>
    <object-name>propdisc</object-name>
    <condition>
      <greater-than>
        <property>engines/engine[0]/rpm</property>
        <value>1500</value>
      </greater-than>
    </condition>
  </animation>

  <animation>
    <type>select</type>
    <object-name>propblur</object-name>
    <condition>
    <and>
      <greater-than>
        <property>engines/engine[0]/rpm</property>
        <value>600.000</value>
      </greater-than>
      <less-than>
        <property>engines/engine[0]/rpm</property>
        <value>1500.001</value>
      </less-than>
    </and>
    </condition>
  </animation>

  <animation>
    <type>select</type>
    <object-name>helice</object-name>
    <condition>
      <less-than>
        <property>engines/engine[0]/rpm</property>
	<value>1500</value>
      </less-than>
    </condition>
  </animation>

  <animation>
    <type>spin</type>
    <object-name>HeliceComplete</object-name>
    <property>engines/engine[0]/rpm</property>
    <factor> 1 </factor>
    <center>
      <x-m> -3.669 </x-m>
      <y-m>  0.000 </y-m>
      <z-m>  0.253 </z-m>
    </center>
    <axis>
      <x> -1 </x>
      <y>  0 </y>
      <z>  0 </z>
    </axis>
  </animation>

  <!-- Gouverne de profondeur -->
  <animation>
    <type>rotate</type>
    <object-name>profondeur</object-name>
    <property>surface-positions/elevator-pos-norm</property>
    <interpolation>
      <entry><ind> -0.75 </ind><dep> -12.0 </dep></entry>
      <entry><ind>  0.00 </ind><dep>   0.0 </dep></entry>
      <entry><ind>  0.75 </ind><dep>   9.5 </dep></entry>
    </interpolation>
    <center>
      <x-m> 3.352 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 0.081 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 1 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <!-- Gouverne de direction -->
  <animation>
    <type>rotate</type>
    <object-name>direction</object-name>
    <property>surface-positions/rudder-pos-norm</property>
    <interpolation>
      <entry><ind> -0.75 </ind><dep> -15.0 </dep></entry>
      <entry><ind>  0.00 </ind><dep>   0.0 </dep></entry>
      <entry><ind>  0.75 </ind><dep>  15.0 </dep></entry>
    </interpolation>
    <center>
      <x-m> 2.918 </x-m>
      <y-m> 0.000 </y-m>
      <z-m> 0.654 </z-m>
    </center>
    <axis>
      <x> 0 </x>
      <y> 0 </y>
      <z> 1 </z>
    </axis>
  </animation>

  <!-- Animations des ailerons -->
  <animation>
    <type>rotate</type>
    <object-name>aileronG</object-name>
    <property>surface-positions/left-aileron-pos-norm</property>
    <interpolation>
      <entry><ind> -0.75 </ind><dep>  15.0 </dep></entry>
      <entry><ind>  0.00 </ind><dep>   0.0 </dep></entry>
      <entry><ind>  0.75 </ind><dep> -10.0 </dep></entry>
    </interpolation>
    <axis>
      <x1-m> -0.702 </x1-m>
      <y1-m> -2.881 </y1-m>
      <z1-m> -0.145 </z1-m>
      <x2-m> -0.963 </x2-m>
      <y2-m> -4.938 </y2-m>
      <z2-m>  0.002 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>aileronD</object-name>
    <property>surface-positions/right-aileron-pos-norm</property>
    <interpolation>
      <entry><ind> -0.75 </ind><dep> -10.0 </dep></entry>
      <entry><ind>  0.00 </ind><dep>   0.0 </dep></entry>
      <entry><ind>  0.75 </ind><dep>  15.0 </dep></entry>
    </interpolation>
    <axis>
      <x1-m> -0.702 </x1-m>
      <y1-m>  2.881 </y1-m>
      <z1-m> -0.145 </z1-m>
      <x2-m> -0.963 </x2-m>
      <y2-m>  4.938 </y2-m>
      <z2-m>  0.002 </z2-m>
    </axis>
  </animation>

  <!-- Volets -->
  <animation>
    <type>rotate</type>
    <object-name>voletG</object-name>
    <property>surface-positions/flap-pos-norm</property>
    <factor> -25 </factor>
    <axis>
      <x1-m> -0.501 </x1-m>
      <y1-m> -0.498 </y1-m>
      <z1-m> -0.367 </z1-m>
      <x2-m> -0.744 </x2-m>
      <y2-m> -2.881 </y2-m>
      <z2-m> -0.179 </z2-m>
    </axis>
  </animation>

  <animation>
    <type>rotate</type>
    <object-name>voletD</object-name>
    <property>surface-positions/flap-pos-norm</property>
    <factor> -25 </factor>
    <axis>
      <x1-m> -0.744 </x1-m>
      <y1-m>  2.881 </y1-m>
      <z1-m> -0.179 </z1-m>
      <x2-m> -0.501 </x2-m>
      <y2-m>  0.498 </y2-m>
      <z2-m> -0.367 </z2-m>
    </axis>
  </animation>

  <!-- Compression -->
  <animation>
    <name>RoueGauche</name>
    <object-name>roueG</object-name>
    <object-name>axeG</object-name>
  </animation>

  <animation>
    <type>translate</type>
    <object-name>RoueGauche</object-name>
    <property>gear/gear[0]/compression-norm</property>
    <interpolation>
      <entry><ind> 0.0 </ind><dep>  0.04 </dep></entry>
      <entry><ind> 1.0 </ind><dep> -0.25 </dep></entry>
    </interpolation>
    <axis>
      <x> -0.071980 </x>
      <y>  0.000000 </y>
      <z> -0.221997 </z>
    </axis>
  </animation>

  <animation>
    <name>RoueDroite</name>
    <object-name>roueD</object-name>
    <object-name>axeD</object-name>
  </animation>

  <animation>
    <type>translate</type>
    <object-name>RoueDroite</object-name>
    <property>gear/gear[1]/compression-norm</property>
    <interpolation>
      <entry><ind> 0.0 </ind><dep>  0.04 </dep></entry>
      <entry><ind> 1.0 </ind><dep> -0.25 </dep></entry>
    </interpolation>
    <axis>
      <x> -0.071980 </x>
      <y>  0.000000 </y>
      <z> -0.221997 </z>
    </axis>
  </animation>

  <!-- Rotation des roues lors du roulage -->
  <animation>
    <type>spin</type>
    <object-name>roueG</object-name>
    <property>gear/gear[0]/rollspeed-ms</property>
    <factor> 30 </factor>
    <center>
      <x-m> -2.057 </x-m>
      <y-m> -1.331 </y-m>
      <z-m> -1.192 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y> -1 </y>
      <z>  0 </z>
    </axis>
  </animation>

  <animation>
    <type>spin</type>
    <object-name>roueD</object-name>
    <property>gear/gear[1]/rollspeed-ms</property>
    <factor> 30 </factor>
    <center>
      <x-m> -2.057 </x-m>
      <y-m>  1.331 </y-m>
      <z-m> -1.192 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y> -1 </y>
      <z>  0 </z>
    </axis>
  </animation>

  <animation>
    <type>spin</type>
    <object-name>roueA</object-name>
    <property>gear/gear[2]/rollspeed-ms</property>
    <factor> 30 </factor>
    <center>
      <x-m>  3.266 </x-m>
      <y-m>  0.000 </y-m>
      <z-m> -0.474 </z-m>
    </center>
    <axis>
      <x>  0 </x>
      <y> -1 </y>
      <z>  0 </z>
    </axis>
  </animation>

  <!-- Canopy -->
  <animation>
    <name>CanopyTotale</name>
    <object-name>verriere</object-name>
    <object-name>tourverriere</object-name>
  </animation>

  <animation>
    <type>translate</type>
    <object-name>CanopyTotale</object-name>
    <property>instrumentation/doors/crew/position-norm</property>
    <interpolation>
      <entry><ind> 0.00 </ind><dep> 0.00 </dep></entry>
      <entry><ind> 1.00 </ind><dep> 1.20 </dep></entry>
    </interpolation>
    <axis>
      <x> 1 </x>
      <y> 0 </y>
      <z> 0 </z>
    </axis>
  </animation>

  <!-- Ajout des effets lumineux -->
  <model>
    <path>Aircraft/dhc1/Models/light/RedLight.xml</path>
    <offsets>
      <x-m> -1.478 </x-m>
      <y-m> -5.195 </y-m>
      <z-m>  0.019 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/dhc1/Models/light/GreenLight.xml</path>
    <offsets>
      <x-m> -1.478 </x-m>
      <y-m>  5.195 </y-m>
      <z-m>  0.019 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/dhc1/Models/light/StrobeWhite.xml</path>
    <offsets>
      <x-m> -1.451 </x-m>
      <y-m> -5.200 </y-m>
      <z-m>  0.020 </z-m>
    </offsets>
  </model>

  <model>
    <path>Aircraft/dhc1/Models/light/StrobeWhite.xml</path>
    <offsets>
      <x-m> -1.451 </x-m>
      <y-m>  5.200 </y-m>
      <z-m>  0.020 </z-m>
    </offsets>
  </model>

</PropertyList>

