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

  <vEye> {0.0, 5.0, 0.0, 0.0} </vEye>
  <vCamOffset>{0.0, 5.0, 0.0}</vCamOffset>
  <vForward> {0.0, 0.0, 1.0} </vForward>
  <vRight> {1.0, 0.0, 0.0} </vRight>
  <vUp> {0.0, 1.0, 0.0} </vUp>
  
  <iFlashScreen> 0 </iFlashScreen> 
  <iFrameCount> 0 </iFrameCount>
  <sCgFile> Ambient.cg </sCgFile>

  <pSprite> 0 </pSprite>
	
	<!-- This is only used in CleanXML.xml -->
  	<vForward2> {1 0 0 0} </vForward2>

  <iGameRunning> 0 </iGameRunning>
  <iGameOver> 0 </iGameOver>
    
  <tCamera prototype="Entity">
    <vTarget> {0.0, 5.0, 0.0} </vTarget>
    <fHeading> 0.0 </fHeading>
    <!-- degrees -->
    <fPitch> 0.0 </fPitch>
    <!-- degrees -->
    <!-- <fZoom> 10.0 </fZoom> -->

    <fPitchIncrement> 5.0 </fPitchIncrement>
    <fHeadingIncrement> 5.0 </fHeadingIncrement>
    <vForwardIncrement>{1.0, 1.0, 1.0}</vForwardIncrement>
    <!-- <fZoomIncrement> 0.25 </fZoomIncrement> -->

    <vViewport> {0.0, 0.0, 640.0, 480.0} </vViewport>
    <fFOV> 75.0 </fFOV>
    <!-- horizontal -->
    <fClipNear> 0.1 </fClipNear>
    <fClipFar> 10000.0 </fClipFar>

    <Init>
    <iCond> 0 </iCond>
    <expr> iCond = ( iSinglePlayer == 1 ) </expr>
    <if>
        <rCondition>iCond</rCondition>
        <then>
            <expr> iGameRunning = 1</expr>
        </then>
    </if>
      <!-- Unload audio system if previously loaded -->
      <tUnloadAudioSystem prototype="ActionUnloadAudio"></tUnloadAudioSystem>
      
      <!-- Create audio listener -->
	  <tSetListener prototype="ActionSetAudioListener">
		<rListenerPos> vEye </rListenerPos>
		<rListenerUp> vUp </rListenerUp>
		<rListenerFrwd> vForward </rListenerFrwd>
      </tSetListener>

      <!-- Load audio files -->      
      <tLoadVehicleSound prototype="ActionLoadAudio">
        <sFilename> vehicle.wav </sFilename>
        <iLooping> 1 </iLooping>
        <i3D> 1 </i3D>
        <fMinDistance> 5.0 </fMinDistance>
        <fMaxDistance> 50.0 </fMaxDistance>
      </tLoadVehicleSound>
      
      <tLoadDrumSound prototype="ActionLoadAudio">
        <sFilename> drums.wav </sFilename>
        <iLooping> 1 </iLooping>
        <i3D> 0 </i3D>
      </tLoadDrumSound>
      
      <tLoadGoalSound prototype="ActionLoadAudio">
        <sFilename> goal.wav </sFilename>
        <iLooping> 0 </iLooping>
        <i3D> 0 </i3D>
      </tLoadGoalSound>
      
      <tLoadKickSound prototype="ActionLoadAudio">
        <sFilename> shoot.wav </sFilename>
        <iLooping> 0 </iLooping>
        <i3D> 1 </i3D>
        <fMinDistance> 5.0 </fMinDistance>
        <fMaxDistance> 25.0 </fMaxDistance>
      </tLoadKickSound>
      
      <tLoadWinSound prototype="ActionLoadAudio">
        <sFilename> win.wav </sFilename>
        <iLooping> 0 </iLooping>
        <i3D> 0 </i3D>
      </tLoadWinSound>
      
      <tPlayDrumLoop prototype="ActionPlaySound">
        <sFilename> drums.wav </sFilename>
      </tPlayDrumLoop>
      
      <tInitFPCam prototype="ActionSetFPCamera">
        <rEye> vEye </rEye>
        <rTarget> vTarget </rTarget>
        <rForward> vForward </rForward>
        <rRight> vRight </rRight>
        <rUp> vUp </rUp>
        <rHeading> fHeading </rHeading>
        <rPitch> fPitch </rPitch>
      </tInitFPCam>
      <tInitCameras prototype="ActionSetCamera">
        <rViewport> vViewport </rViewport>
        <rEye> vEye </rEye>
        <rTarget> vTarget </rTarget>
        <rUp> vUp </rUp>
        <rFOV> fFOV </rFOV>
        <!-- horizontal -->
        <rClipNear> fClipNear </rClipNear>
        <rClipFar> fClipFar </rClipFar>
      </tInitCameras>
    </Init>

    <Update>
      <tUpdateListener prototype="ActionUpdateAudio"></tUpdateListener>
      
      <tRefreshFPCam prototype="ActionSetFPCamera">
        <rEye> vEye </rEye>
        <rTarget> vTarget </rTarget>
        <rForward> vForward </rForward>
        <rRight> vRight </rRight>
        <rUp> vUp </rUp>
        <rHeading> fHeading </rHeading>
        <rPitch> fPitch </rPitch>
        <!-- <rZoom> fZoom </rZoom> -->
      </tRefreshFPCam>
      <tRefreshCamera prototype="ActionSetCamera">
        <rEye> vEye </rEye>
        <rTarget> vTarget </rTarget>
        <rUp> vUp </rUp>
      </tRefreshCamera>
    </Update>

    <!-- Camera Controls -->

    <tReactionLeft prototype="ReactionInput">
      <iSoughtInputs>btlt</iSoughtInputs>
      <iMask>-1</iMask>

      <expr> fHeading = fHeading - fHeadingIncrement </expr>
    </tReactionLeft>


    <tReactionRight prototype="ReactionInput">
      <iSoughtInputs>btrt</iSoughtInputs>
      <iMask>-1</iMask>

      <expr> fHeading = fHeading + fHeadingIncrement </expr>
    </tReactionRight>
  </tCamera>

  <tPlayer prototype="EntityCollidable">
    <iPlayer>1</iPlayer>
    <pVertexBuffer>NULL</pVertexBuffer>
    <pIndexBuffer>NULL</pIndexBuffer>
    <pMaterial>NULL</pMaterial>
    <pTexture>NULL</pTexture>
    <pVertexShader>NULL</pVertexShader>
    <pPixelShader>NULL</pPixelShader>
    <sFilename>player.obj</sFilename>
    <iNumVertices>0</iNumVertices>
    <iNumFaces>0</iNumFaces>
    <iUseIndexBuffer>true</iUseIndexBuffer>
    <iHasNormals>false</iHasNormals>
    <!-- set by ActionCreateGeometryBuffers -->
    <iHasTexCoords>false</iHasTexCoords>
    <!-- set by ActionCreateGeometryBuffers -->
    <vScale> {3.0, 3.0, 3.0} </vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 0.0, 1.0, 0.0} </vRotate>
    <vTranslate> {0.0, 10.0, -425.0} </vTranslate>
    <vStartingTranslate> {0 0 0 0} </vStartingTranslate>
	<fStartingHeading> 0.0 </fStartingHeading>
    <!--meters-->
    <!-- Physics related -->
    <vOrientation> {0 0 0 0} </vOrientation>
    <vAngMomentum> {0 0 0 0} </vAngMomentum>
    <vAngVelocity> {0 0 0 0} </vAngVelocity>
    <vMomentum> {0 0 0 0} </vMomentum>
    <vVelocity> {0 0 0 0} </vVelocity>
    <vForce> {0 0 0 0} </vForce>
    <!-- Drag Force -->
    <vForce index="1"> {0 0 0 0} </vForce>
    <!-- Forward Force -->
    <vForce index="2"> {0 0 0 0} </vForce>
    <!-- Reverse Force -->
    <vForce index="3"> {0 0 0 0} </vForce>
    <!-- Left Force -->
    <vForce index="4"> {0 0 0 0} </vForce>
    <!-- Right Force -->
    <vPosOfForce> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="1"> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="2"> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="3"> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="4"> {0 0 0 0} </vPosOfForce>
    <!-- Collidable Entity Prescribed Attributes -->
    <fMassInverse> 1.0 </fMassInverse>
    <fMass> 1.0 </fMass>
    <vCenterOfMass> {0 0 0 0} </vCenterOfMass>
    <fElasticity> 0.9 </fElasticity>
    <fBoundingRadius> 6 </fBoundingRadius>
    <iBoundingVolumeType>SPHR</iBoundingVolumeType>
    <rPosition> vTranslate </rPosition>
    <rVelocity> vVelocity </rVelocity>
    <rMomentum> vMomentum </rMomentum>
    <rForce> vForce </rForce>
    <rPosOfForce> vPosOfForce </rPosOfForce>
    <rOrientation> xRotate </rOrientation>
    <rAngMomentum> vAngMomentum </rAngMomentum>
    <rAngVelocity> vAngVelocity </rAngVelocity>
    <fCoeffDrag> 0.5 </fCoeffDrag>
    <fCrossSectionalArea> 3.14159 </fCrossSectionalArea>
    <fVelocityMagnitude> 0.0 </fVelocityMagnitude>
    <fForceConstant> 100.0 </fForceConstant>
    <fMinVelocity> 0.0 </fMinVelocity>
    <fMaxVelocity> 50.0 </fMaxVelocity>
    <Init>
      <!-- Do not create Geometry because we are "player one" -->
      <expr> vEye = vTranslate </expr>
      <expr> vStartingTranslate = vTranslate </expr>
    </Init>

    <Update>
      <tUpdateIfGameRunning prototype="ActionListIf">
        <rCondition> iGameRunning </rCondition>
        <then>
		  <fHeading> fStartingHeading </fHeading>
		  <expr> fHeading = tCamera . fHeading </expr>
          <expr> fVelocityMagnitude = sqrt ( sqrt ( vVelocity * vVelocity ) ) </expr>
          <expr> fVelocityMagnitude = fVelocityMagnitude * fCrossSectionalArea </expr>
          <expr> fVelocityMagnitude = fVelocityMagnitude * fCoeffDrag </expr>
          <expr> vForce [ 0 ] = vVelocity * ( - fVelocityMagnitude ) </expr>
          <tUpdateDynamics prototype="ActionUpdateDynamics">
            <rPosition> vTranslate </rPosition>
            <rVelocity> vVelocity </rVelocity>
            <rForce> vForce </rForce>
            <rMomentum> vMomentum </rMomentum>
            <rRadius>fBoundingRadius</rRadius>
            <rOrientation>xRotate</rOrientation>
            <rAngMomentum>vAngMomentum</rAngMomentum>
            <rPosOfForce>vPosOfForce</rPosOfForce>
            <rAngVelocity>vAngVelocity</rAngVelocity>
            <rMass>fMass</rMass>
            <rMassInverse>fMassInverse</rMassInverse>
            <rCenterOfMass>vCenterOfMass</rCenterOfMass>
          </tUpdateDynamics>
          <tClampVelocity prototype="ActionClampVector">
            <rVectorToClamp> vVelocity </rVectorToClamp>
            <rUpperBound> fMaxVelocity </rUpperBound>
          </tClampVelocity>
          <expr> vEye = vTranslate + vCamOffset </expr>
		  <tUpdateOrientation prototype="ActionUpdateOrientation">
			<rOrientation> xRotate </rOrientation>
		    <rHeading> fHeading </rHeading>
		  </tUpdateOrientation>
        </then>
        <else>

        </else>
      </tUpdateIfGameRunning>
    </Update>

    <Render>
    </Render>
        <!-- Input Reactions -->
        <tReactionAccelerateForward prototype="ReactionInput">
            <iSoughtInputs>btnw</iSoughtInputs>
            <iMask>-1</iMask>
            <tDetermineForwardForce prototype="ActionList">
                <expr> vForce [ 1 ] = fForceConstant * vForward </expr>
            </tDetermineForwardForce>
        </tReactionAccelerateForward>

        <tReactionAccelerateBackward prototype="ReactionInput">
            <iSoughtInputs>btns</iSoughtInputs>
            <iMask>-1</iMask>
            <tDetermineBackwardForce prototype="ActionList">
                <expr> vForce [ 2 ] = ( - fForceConstant ) * vForward </expr>
            </tDetermineBackwardForce>
        </tReactionAccelerateBackward>

        <tReactionAccelerateLeft prototype="ReactionInput">
            <iSoughtInputs>btna</iSoughtInputs>
            <iMask>-1</iMask>
            <tDetermineLeftForce prototype="ActionList">
                <expr> vForce [ 3 ] = ( - fForceConstant ) * vRight </expr>
            </tDetermineLeftForce>
        </tReactionAccelerateLeft>

        <tReactionAccelerateRight prototype="ReactionInput">
            <iSoughtInputs>btnd</iSoughtInputs>
            <iMask>-1</iMask>
            <tDetermineRightForce prototype="ActionList">
                <expr> vForce [ 4 ] = fForceConstant * vRight </expr>
            </tDetermineRightForce>
        </tReactionAccelerateRight>
        
        <tReactionEscape prototype="ReactionInput">
            <iSoughtInputs>escp</iSoughtInputs>
            <iMask>-1</iMask>
            
            <!-- Open exit menu -->
            <tActionLoadExit prototype="ActionLoad">
                <sFilename> ExitMenu.xml </sFilename>
            </tActionLoadExit>
            
        </tReactionEscape>

    <tReactionStop prototype="ReactionAttributed" iSynchronous="0">
      <iMatch> stop </iMatch>
      <iMask>-1</iMask>
      <expr> vTranslate = vStartingTranslate </expr>
      <expr> vEye = vTranslate </expr>
	  <expr> tCamera . fHeading = fStartingHeading </expr>
    </tReactionStop>
  </tPlayer>

  <tOtherPlayer prototype="EntityCollidable">
    <iPlayer>2</iPlayer>
    <pVertexBuffer>NULL</pVertexBuffer>
    <pIndexBuffer>NULL</pIndexBuffer>
    <pMaterial>NULL</pMaterial>
    <pTexture>NULL</pTexture>
    <pVertexShader>NULL</pVertexShader>
    <pPixelShader>NULL</pPixelShader>
    <sFilename>player.obj</sFilename>
    <iNumVertices>0</iNumVertices>
    <iNumFaces>0</iNumFaces>
    <iUseIndexBuffer>true</iUseIndexBuffer>
    <iHasNormals>false</iHasNormals>
    <!-- set by ActionCreateGeometryBuffers -->
    <iHasTexCoords>false</iHasTexCoords>
    <!-- set by ActionCreateGeometryBuffers -->
    <vScale> {3.0, 3.0, 3.0} </vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 1.0, 0.0, 90.0} </vRotate>
    <vTranslate> {0.0, 10.0, 425.0} </vTranslate>
    <vStartingTranslate> {0 0 0 0} </vStartingTranslate>
    <!-- Physics related -->
    <vOrientation> {0 0 0 0} </vOrientation>
    <vAngMomentum> {0 0 0 0} </vAngMomentum>
    <vAngVelocity> {0 0 0 0} </vAngVelocity>
    <vMomentum> {0 0 0 0} </vMomentum>
    <vVelocity> {0 0 0 0} </vVelocity>
    <vForce> {0 0 0 0} </vForce>
    <!-- Drag Force -->
    <vForce index="1"> {0 0 0 0} </vForce>
    <!-- Forward Force -->
    <vForce index="2"> {0 0 0 0} </vForce>
    <!-- Reverse Force -->
    <vForce index="3"> {0 0 0 0} </vForce>
    <!-- Left Force -->
    <vForce index="4"> {0 0 0 0} </vForce>
    <!-- Right Force -->
    <vPosOfForce> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="1"> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="2"> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="3"> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="4"> {0 0 0 0} </vPosOfForce>
    <!-- Collidable Entity Prescribed Attributes -->
    <!-- Collidable Entity Prescribed Attributes -->
    <fMassInverse> 1.0 </fMassInverse>
    <fMass> 1.0 </fMass>
    <vCenterOfMass> {0 0 0 0} </vCenterOfMass>
    <fElasticity> 0.9 </fElasticity>
    <fBoundingRadius> 6 </fBoundingRadius>
    <iBoundingVolumeType>SPHR</iBoundingVolumeType>
    <rPosition> vTranslate </rPosition>
    <rVelocity> vVelocity </rVelocity>
    <rMomentum> vMomentum </rMomentum>
    <rForce> vForce </rForce>
    <rPosOfForce> vPosOfForce </rPosOfForce>
    <rOrientation> xRotate </rOrientation>
    <rAngMomentum> vAngMomentum </rAngMomentum>
    <rAngVelocity> vAngVelocity </rAngVelocity>
    <fCoeffDrag> 0.5 </fCoeffDrag>
    <fCrossSectionalArea> 3.14159 </fCrossSectionalArea>
    <fVelocityMagnitude> 0.0 </fVelocityMagnitude>
    <fForceConstant> 100.0 </fForceConstant>
    <fMinVelocity> 0.0 </fMinVelocity>
    <fMaxVelocity> 50.0 </fMaxVelocity>
    <Init>
      <!-- Audio for sounds coming from tPlayer -->
      <tPlayerSound prototype="ActionPlaySound">
        <sFilename> vehicle.wav </sFilename>
        <rPosition> vTranslate </rPosition>
        <rVelocity> vVelocity </rVelocity>
      </tPlayerSound>

      <tCreateGeometry prototype="ActionCreateGeometryBuffers">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
      </tCreateGeometry>
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
		<vDiffuse> {0.3, 0.3, 0.3} </vDiffuse> 
		<vAmbient> {0.6, 0.3, 0.0} </vAmbient>
        <sTextureFile> orangeTexture.dds </sTextureFile>
        <sVertexShader> C5E2v_fragmentLighting.cg </sVertexShader>
        <sPixelShader> PerPixelLight.cg </sPixelShader>
      </tSetMaterial>
      <expr> vStartingTranslate = vTranslate </expr>
    </Init>
    <Render>
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
		<vAmbient> {0.6, 0.3, 0.0} </vAmbient>
      </tSetMaterial>
      <tRenderGeometry prototype="ActionRenderGeometry">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
        <rScale>vScale</rScale>
        <rOrientation>xRotate</rOrientation>
        <rRotate>vRotate</rRotate>
        <rTranslate>vTranslate</rTranslate>
      </tRenderGeometry>
    </Render>

    <tReactionStop prototype="ReactionAttributed" iSynchronous="0">
      <iMatch> stop </iMatch>
      <iMask>-1</iMask>
      <expr> vTranslate = vStartingTranslate </expr>
    </tReactionStop>
  </tOtherPlayer>
  
  <!--tBall-->
  <tBall prototype="EntityCollidable">
    <iPlayer>BALL</iPlayer>
    <iOwner>BALL</iOwner>
    <pVertexBuffer>NULL</pVertexBuffer>
    <pIndexBuffer>NULL</pIndexBuffer>
	
    <pMaterial>NULL</pMaterial>
	<pVertexShader>NULL</pVertexShader>
    <pPixelShader>NULL</pPixelShader>
	<pTexture>NULL</pTexture>
    
	<sFilename>sphere.obj</sFilename>
    <iNumVertices>0</iNumVertices>
    <iNumFaces>0</iNumFaces>
    <iUseIndexBuffer>true</iUseIndexBuffer>
    <iHasNormals>false</iHasNormals>
    <!-- set by ActionCreateGeometryBuffers -->
    <iHasTexCoords>false</iHasTexCoords>
    <!-- set by ActionCreateGeometryBuffers -->
    <vScale> {3.0, 3.0, 3.0} </vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 0.0, 1.0, 0.0} </vRotate>
    <vTranslate> {0.0, 10.0, 0.0, 1.0} </vTranslate>
    <vStartingTranslate> {0.0, 10.0, 0.0, 1.0} </vStartingTranslate>
    <vAngVelocity> {0 0 0 0} </vAngVelocity>
    <vAngMomentum> {0 0 0 0} </vAngMomentum>
    <vMomentum> {0 0 0 0} </vMomentum>
    <vVelocity> {0 0 0 0} </vVelocity>
    <vForce> {0 0 0 0} </vForce>
    <!-- Drag Force -->
    <vForce index="1"> {0 0 0 0} </vForce>
    <!-- Forward Force -->
    <vForce index="2"> {0 0 0 0} </vForce>
    <!-- Reverse Force -->
    <vForce index="3"> {0 0 0 0} </vForce>
    <!-- Left Force -->
    <vForce index="4"> {0 0 0 0} </vForce>
    <!-- Right Force -->
    <vPosOfForce> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="1"> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="2"> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="3"> {0 0 0 0} </vPosOfForce>
    <vPosOfForce index="4"> {0 0 0 0} </vPosOfForce>
    <!-- Collidable Entity Prescribed Attributes -->
    <fMassInverse> 1.0 </fMassInverse>
    <fMass> 1.0 </fMass>
    <vCenterOfMass> {0 0 0 0} </vCenterOfMass>
    <fElasticity> 0.95 </fElasticity>
    <fBoundingRadius> 1 </fBoundingRadius>
    <iBoundingVolumeType>SPHR</iBoundingVolumeType>
    <rPosition> vTranslate </rPosition>
    <rVelocity> vVelocity </rVelocity>
    <rMomentum> vMomentum </rMomentum>
    <rForce> vForce </rForce>
    <rPosOfForce> vPosOfForce </rPosOfForce>
    <rOrientation> xRotate </rOrientation>
    <rAngMomentum> vAngMomentum </rAngMomentum>
    <rAngVelocity> vAngVelocity </rAngVelocity>
    <fCoeffDrag> 0.002 </fCoeffDrag>
    <fCrossSectionalArea> 3.14159 </fCrossSectionalArea>
    <fVelocityMagnitude> 0.0 </fVelocityMagnitude>
    <fForceConstant> 200.0 </fForceConstant>
    <fMinVelocity> 0.0 </fMinVelocity>
    <fMaxVelocity> 9000.0 </fMaxVelocity>

    <iBall> BALL </iBall>
    <iP2WantsToShoot>0</iP2WantsToShoot>
    
    <Init>
      <tCreateGeometry prototype="ActionCreateGeometryBuffers">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
      </tCreateGeometry>
	  
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
        <vDiffuse> {0.2, 0.2, 0.2, 1.0} </vDiffuse>
        <vEmissive>{0.0, 0.0, 0.0}</vEmissive>
		<vAmbient> {0.0, 0.0, 0.0} </vAmbient>
<!-- 		<vSpecular> {0.5, 0.0, 0.0} </vSpecular>
		<fPower> 80.0 </fPower> -->
        <sTextureFile> checker.dds </sTextureFile>
        <sVertexShader> BasicLight.cg </sVertexShader>
        <sPixelShader> C3E3f_texture.cg </sPixelShader>
      </tSetMaterial>

	  <tSetLight prototype="ActionSetLight">
        <iType>1</iType>
        <!-- 1 = point, 2 = spot, 3 = directional -->
        <iName>0</iName>
        <vColorDiffuse> { 1.0, 1.0, 1.0, 1.0 } </vColorDiffuse>
        <vColorEmissive> { 1.0, 1.0, 1.0, 1.0 } </vColorEmissive>
        <!-- <vColorSpecular> { 1.0, 1.0, 1.0, 1.0 } </vColorSpecular> -->
        <vPosition> {0.0, 40.0, 0.0, 1.0} </vPosition> 
        <!-- <vDirection> {0.0, 0.0, 1.0, 1.0 } </vDirection> -->
        <fRange> 10000.0 </fRange> 
        <fAttenuation0> 0.01 </fAttenuation0> 
        <!-- <fTheta> 5.0 </fTheta> -->
        <!-- <fPhi> 10.0 </fPhi> -->
      </tSetLight>
      <expr> vStartingTranslate = vTranslate </expr>
    </Init>
    
    <Update>
		<!-- The host controls the ball, so he does the logic that is
			missing from Player2.xml -->
        <expr> fVelocityMagnitude = sqrt ( vVelocity * vVelocity ) </expr>
        <expr> fVelocityMagnitude = fVelocityMagnitude * fCrossSectionalArea </expr>
        <expr> fVelocityMagnitude = fVelocityMagnitude * fCoeffDrag </expr>
        <expr> vForce [ 0 ] = vVelocity * ( - fVelocityMagnitude ) </expr>
    	  
	    <iCond>0</iCond>
    	  
	    <expr> iCond = ( iOwner != iBall ) </expr>
	    <if>
		    <rCondition>iCond</rCondition>
		    <then>
			    <expr> iCond = ( iOwner == 1 ) </expr>
			    <if>
				    <rCondition>iCond</rCondition>
				    <then>
					    <expr> vTranslate = ( vForward * 35 ) </expr>
					    <expr> vTranslate = vTranslate + tPlayer . vTranslate </expr>
					    <expr> tPlayer . fForceConstant = 150.0 </expr>
					    <expr> tOtherPlayer . fForceConstant = 350.0 </expr>

				    </then>
				    <else>
					    <expr> vTranslate = ( vForward2 * 35 ) </expr>
					    <expr> vTranslate = vTranslate + tOtherPlayer . vTranslate </expr>
					    <expr> tPlayer . fForceConstant = 350.0 </expr>
					    <expr> tOtherPlayer . fForceConstant = 150.0 </expr>

					    <!-- P2 has the ball.  Also see if they want to
					        shoot it. -->
					    <expr> iCond = ( ( iP2WantsToShoot == 1 ) AND ( iGameRunning == 1 ) ) </expr>
					    <if>
					        <rCondition>iCond</rCondition>
					        <then>
					            <!-- Shoot for Player 2. -->
			                    <iForwardForceIndex> 1 </iForwardForceIndex>
			                    <fKickMultiplier> 4000.0 </fKickMultiplier>
			                    <vKickerVelocity> {0,0,0,0} </vKickerVelocity>
			                    <vKickForceOutput> {0,0,0,0} </vKickForceOutput>
			                    <vBallPosition> {0,0,0,0} </vBallPosition>
                        		
			                    <expr> vKickerVelocity = tOtherPlayer . vVelocity </expr>
			                    <expr> tBall . iOwner = iBall </expr>
			                    <expr> vBallPosition = tBall . vTranslate </expr>
			                    <tKickAciton prototype="ActionKick">
				                    <rvKickDirection> vForward2 </rvKickDirection>
				                    <rvBallPosition> vBallPosition </rvBallPosition>
				                    <rvKickerVelocity> vKickerVelocity </rvKickerVelocity>
				                    <rfKickMultiplier> fKickMultiplier </rfKickMultiplier>
				                    <rvKickForce> vKickForceOutput </rvKickForce>
			                    </tKickAciton>
			                    
			                    <tPlayKickSound prototype="ActionPlaySound">
			                      <sFilename> shoot.wav </sFilename>
                                  <rPosition> vBallPosition </rPosition>
                                  <rVelocity> vKickerVelocity </rVelocity>
			                    </tPlayKickSound>
                        		
			                    <expr> tBall . vForce [ iForwardForceIndex ] = vKickForceOutput </expr>
					        </then>
					    </if>
				    </else>
			    </if>
		    </then>
		    <else>
			    <expr> tPlayer . fForceConstant = 350.0 </expr>
			    <expr> tOtherPlayer . fForceConstant = 350.0 </expr>
		    </else>
	    </if>

        <tUpdateDynamics prototype="ActionUpdateDynamics">
            <rPosition> vTranslate </rPosition>
            <rVelocity> vVelocity </rVelocity>
            <rForce> vForce </rForce>
            <rMomentum> vMomentum </rMomentum>
            <rRadius>fBoundingRadius</rRadius>
            <rOrientation>xRotate</rOrientation>
            <rAngMomentum>vAngMomentum</rAngMomentum>
            <rPosOfForce>vPosOfForce</rPosOfForce>
            <rAngVelocity>vAngVelocity</rAngVelocity>
            <rMass>fMass</rMass>
            <rMassInverse>fMassInverse</rMassInverse>
            <rCenterOfMass>vCenterOfMass</rCenterOfMass>
        </tUpdateDynamics>
        <tClampVelocity prototype="ActionClampVector">
            <rVectorToClamp> vVelocity </rVectorToClamp>
            <rUpperBound> fMaxVelocity </rUpperBound>
        </tClampVelocity>
        <tClampMomentum prototype="ActionClampVector">
            <rVectorToClamp> vMomentum </rVectorToClamp>
            <rUpperBound> fMaxVelocity </rUpperBound>
        </tClampMomentum>
    </Update>
    
    <Render>
	  <expr> iFrameCount = iFrameCount + 1 </expr>
	
	  <iBallIsOwned> 0 </iBallIsOwned>
	  <expr> iBallIsOwned = ( iOwner != iBall ) </expr>
	  <if>
	  	<rCondition> iBallIsOwned </rCondition>
		<then>
			<iP1OwnsBall> 0 </iP1OwnsBall>
			<expr> iP1OwnsBall = ( iOwner == tPlayer . iPlayer ) </expr>
			<if>
				<rCondition> iP1OwnsBall </rCondition>
				<then>
		  		  <tSetBlueMaterial prototype="ActionSetMaterial">
		        	<rMaterialPointer>pMaterial</rMaterialPointer>
        			<rTexturePointer>pTexture</rTexturePointer>
		        	<rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
    			    <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
 					<vAmbient> {0.0, 0.0, 0.6} </vAmbient>
			      </tSetBlueMaterial>
				</then>
				<else>
				  <tSetOrangeMaterial prototype="ActionSetMaterial">
		        	<rMaterialPointer>pMaterial</rMaterialPointer>
        			<rTexturePointer>pTexture</rTexturePointer>
		        	<rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
    			    <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
					<vAmbient> {0.6, 0.3, 0.0} </vAmbient>					
			      </tSetOrangeMaterial>
				</else>
			</if>
		</then>
		<else>
		  <iCondition> 0 </iCondition>
		  <expr> iCondition = ( ( iFrameCount % 30 ) GT 15 ) </expr>
			<if>
				<rCondition> iCondition </rCondition>
				<then>
		  		  <tSetWhiteMaterial prototype="ActionSetMaterial">
		        	<rMaterialPointer>pMaterial</rMaterialPointer>
        			<rTexturePointer>pTexture</rTexturePointer>
		        	<rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
    			    <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
 					<vAmbient> {0.9, 0.9, 0.9} </vAmbient>
			      </tSetWhiteMaterial>
				</then>
				<else>
				  <tSetMagentaMaterial prototype="ActionSetMaterial">
		        	<rMaterialPointer>pMaterial</rMaterialPointer>
        			<rTexturePointer>pTexture</rTexturePointer>
		        	<rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
    			    <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
					<vAmbient> {0.9, 0.0, 0.9} </vAmbient>					
			      </tSetMagentaMaterial>
				</else>
			</if>
		</else>
	  </if>
	
      <tRenderGeometry prototype="ActionRenderGeometry">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
        <rScale>vScale</rScale>
        <rOrientation>xRotate</rOrientation>
        <rRotate>vRotate</rRotate>
        <rTranslate>vTranslate</rTranslate>
      </tRenderGeometry>
    </Render>

	<tReactionCollide prototype="ReactionCollision" iSynchronous="1">
		<tCollide prototype="ActionHandleCollision">
			<rOwner>iOwner</rOwner>
		</tCollide>
    </tReactionCollide>
	
    <tReactionKick prototype="ReactionInput">
        <iSoughtInputs>spce</iSoughtInputs>
        <iMask>-1</iMask>
        <tKick prototype="ActionList">
          <if>
            <rCondition> iGameRunning </rCondition>
            <then>
              <iHasball> 0 </iHasball>
              <expr> iHasball = ( ( tBall . iOwner ) == ( tPlayer . iPlayer ) ) </expr>
              <if>
                <rCondition> iHasball </rCondition>
                <then>
                  <iForwardForceIndex> 1 </iForwardForceIndex>
                  <fKickMultiplier> 4000.0 </fKickMultiplier>
                  <vKickerVelocity> {0,0,0,0} </vKickerVelocity>
                  <vKickForceOutput> {0,0,0,0} </vKickForceOutput>
                  <vBallPosition> {0,0,0,0} </vBallPosition>

                  <expr> vKickerVelocity = tPlayer . vVelocity </expr>
                  <expr> tBall . iOwner = iBall </expr>
                  <expr> vBallPosition = tBall . vTranslate </expr>
                  <tKickAciton prototype="ActionKick">
                    <rvKickDirection> vForward </rvKickDirection>
                    <rvBallPosition> vBallPosition </rvBallPosition>
                    <rvKickerVelocity> vKickerVelocity </rvKickerVelocity>
                    <rfKickMultiplier> fKickMultiplier </rfKickMultiplier>
                    <rvKickForce> vKickForceOutput </rvKickForce>
                  </tKickAciton>

                  <tPlayKickSound prototype="ActionPlaySound">
                    <sFilename> shoot.wav </sFilename>
                    <rPosition> vBallPosition </rPosition>
                    <rVelocity> vKickerVelocity </rVelocity>
                  </tPlayKickSound>

                  <expr> tBall . vForce [ iForwardForceIndex ] = vKickForceOutput </expr>
                </then>
              </if>
            </then>
          </if>
	        
        </tKick>
    </tReactionKick>

    <tReactionStop prototype="ReactionAttributed" iSynchronous="1">
      <iMatch> paus </iMatch>
      <iMask>-1</iMask>
      <expr> vTranslate = vStartingTranslate </expr>
      <expr> vVelocity = {0,0,0,0} </expr>
      <expr> vMomentum = {0,0,0,0} </expr>
      <expr> vAngVelocity = {0,0,0,0} </expr>
      <expr> vAngMomentum = {0,0,0,0} </expr>
      <expr> vForce [ 0 ] = {0,0,0,0} </expr>
      <expr> vForce [ 1 ] = {0,0,0,0} </expr>
      <expr> iOwner = iBall </expr>
    </tReactionStop>
    
  </tBall>
  
  <!--tSkyBox-->
  <tSkyBox prototype="Entity">
    <!--Graphics related-->
    <pVertexBuffer>NULL</pVertexBuffer>
    <pIndexBuffer>NULL</pIndexBuffer>
    <sFilename>skybox.obj</sFilename>
    <iNumVertices>0</iNumVertices>
    <iNumFaces>0</iNumFaces>
    <iUseIndexBuffer>true</iUseIndexBuffer>
    <iHasNormals>false</iHasNormals>
    <!-- set by ActionCreateGeometryBuffers -->
    <iHasTexCoords>false</iHasTexCoords>
    <!-- set by ActionCreateGeometryBuffers -->
    <vScale> {100.0, 100.0, 100.0} </vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 0.0, 1.0, 0.0} </vRotate>
    <vTranslate> {0.0, 0.0, 0.0} </vTranslate>
    <!--meters-->
    <pMaterial>NULL</pMaterial>
    <pTexture>NULL</pTexture>
    <pVertexShader>NULL</pVertexShader>
    <pPixelShader>NULL</pPixelShader>
    <Init>
      <tCreateGeometry prototype="ActionCreateGeometryBuffers">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
      </tCreateGeometry>
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
        <vDiffuse> {1.0, 1.0, 1.0, 1.0} </vDiffuse>
        <sTextureFile> skybox.dds </sTextureFile>
        <sVertexShader> C3E2v_varying.cg </sVertexShader> 
        <sPixelShader> sinFlash.cg </sPixelShader> 
        <vAmbient> {1.0, 1.0, 1.0, 1.0} </vAmbient>
        <vSpecular> {1.0, 1.0, 1.0, 1.0} </vSpecular>
        <vEmissive> {1.0, 1.0, 1.0, 1.0} </vEmissive>
        <fPower>1.0</fPower>
      </tSetMaterial>
    </Init>
    <Render>
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
      </tSetMaterial>
      <tRenderGeometry prototype="ActionRenderGeometry">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
        <rScale>vScale</rScale>
        <rOrientation>xRotate</rOrientation>
        <rRotate>vRotate</rRotate>
        <rTranslate>vTranslate</rTranslate>
      </tRenderGeometry>
    </Render>
	</tSkyBox>
	
  <!--tPlane-->
  <tPlane prototype="Entity">
    <pVertexBuffer>NULL</pVertexBuffer>
    <pIndexBuffer>NULL</pIndexBuffer>
    <pMaterial>NULL</pMaterial>
    <pTexture>NULL</pTexture>
    <pVertexShader>NULL</pVertexShader>
    <pPixelShader>NULL</pPixelShader>
    <sFilename>plane.obj</sFilename>
    <iNumVertices>0</iNumVertices>
    <iNumFaces>0</iNumFaces>
    <iUseIndexBuffer>true</iUseIndexBuffer>
    <iHasNormals>false</iHasNormals>
    <!-- set by ActionCreateGeometryBuffers -->
    <iHasTexCoords>false</iHasTexCoords>
    <!-- set by ActionCreateGeometryBuffers -->
    <vScale> {5.0, 5.0, 5.0} </vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 0.0, 1.0, 0.0} </vRotate>
    <vTranslate> {0.0, 0.0, 0.0} </vTranslate>
    <!--meters-->


    <Init>
      <tCreateGeometry prototype="ActionCreateGeometryBuffers">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
      </tCreateGeometry>
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
        <vDiffuse> {1.0, 1.0, 1.0, 1.0} </vDiffuse>
        <sTextureFile> checker.dds </sTextureFile>
        <sVertexShader> C3E2v_varying.cg </sVertexShader>  
        <sPixelShader> GreenTint.cg </sPixelShader>  
        <vAmbient> {1.0, 1.0, 1.0, 1.0} </vAmbient>
        <vSpecular> {1.0, 1.0, 1.0, 1.0} </vSpecular>
        <vEmissive> {1.0, 1.0, 1.0, 1.0} </vEmissive>
        <fPower>1.0</fPower>
      </tSetMaterial>
    </Init>
    <Render>
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
      </tSetMaterial>
      <tRenderGeometry prototype="ActionRenderGeometry">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
        <rScale>vScale</rScale>
        <rOrientation>xRotate</rOrientation>
        <rRotate>vRotate</rRotate>
        <rTranslate>vTranslate</rTranslate>
      </tRenderGeometry>
    </Render>
  </tPlane>

  <tNorthGoal prototype="EntityCollidable">
    <iPlayer>NGOL</iPlayer>
    <pVertexBuffer>NULL</pVertexBuffer>
    <pIndexBuffer>NULL</pIndexBuffer>
    <pMaterial>NULL</pMaterial>
    <pTexture>NULL</pTexture>
    <pVertexShader>NULL</pVertexShader>
    <pPixelShader>NULL</pPixelShader>
    <sFilename>goalPost.obj</sFilename>
    <iNumVertices>0</iNumVertices>
    <iNumFaces>0</iNumFaces>
    <iUseIndexBuffer>true</iUseIndexBuffer>
    <iHasNormals>false</iHasNormals>
    <!-- set by ActionCreateGeometryBuffers -->
    <iHasTexCoords>false</iHasTexCoords>
    <!-- set by ActionCreateGeometryBuffers -->
    <vScale> {5.0, 5.0, 5.0} </vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 0.0, 1.0, 0.0} </vRotate>
    
    <!-- This begins the values used to update goal size and placement -->
    <!-- Vector value representing goal position -->
    <vTranslate> {0.0, 25.0, 445} </vTranslate>
    <!-- Vector value representing offset distance that post is rendered at from goal center -->
    <vPostOffset> {100.0, 0.0, 0.0} </vPostOffset>
    <fElasticity>0</fElasticity>
    <fBoundingRadius>100.0</fBoundingRadius>
    <iBoundingVolumeType>PLNE</iBoundingVolumeType>
    <vConvHull index="0"> {0, 0, -1, 0}</vConvHull>
    <rConvexHull> vConvHull </rConvexHull>
    <fMassInverse>0.0</fMassInverse>
    <!-- Float value representing size increment that goal grows/shrinks by on score changes -->
    <fGoalInc> 10.0 </fGoalInc>
    <!-- Float value representing x bounds for goal posts-->
    <fGoalBound> 445 </fGoalBound>
    <!-- Int value used to indicate direction goal is moving - 1 right 0 left-->
    <iGoalDir> 1 </iGoalDir>
    <!-- Vec value representing fixed velocity of goal -->
    <vGoalVel> {3.0, 0.0, 0.0}</vGoalVel>
    <!-- Vec value representing position of right goal post-->
    <vRightTranslate> {100.0, 2.5, 445} </vRightTranslate>
    <!-- Vec value representing position of left goal post-->
    <vLeftTranslate> {-100.0, 2.5, 445} </vLeftTranslate>
    <iGoalDiff> 0 </iGoalDiff>
    <!-- End of Values related to updating goal size and placement-->

    <Init>
      <tCreateGeometry prototype="ActionCreateGeometryBuffers">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
      </tCreateGeometry>
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
        <vDiffuse> {1.0, 1.0, 1.0, 1.0} </vDiffuse>
        <sTextureFile> blueTexture.dds </sTextureFile>
        <sVertexShader> C3E2v_varying.cg </sVertexShader> 
        <sPixelShader> DefaultShader.cg </sPixelShader> 
        <vAmbient> {1.0, 1.0, 1.0, 1.0} </vAmbient>
        <vSpecular> {1.0, 1.0, 1.0, 1.0} </vSpecular>
        <vEmissive> {1.0, 1.0, 1.0, 1.0} </vEmissive>
        <fPower>1.0</fPower>
      </tSetMaterial>
    </Init>

    <Update>
      <tUpdateGoal prototype ="ActionUpdateGoal">
        <rVecGoalPos> vTranslate </rVecGoalPos>
        <rVecPostOffset> vPostOffset </rVecPostOffset>
        <rFloatGoalBound> fGoalBound </rFloatGoalBound>
        <rIntGoalDir> iGoalDir </rIntGoalDir>
        <rIntGoalDiff> iGoalDiff </rIntGoalDiff>
        <rVecGoalVel> vGoalVel </rVecGoalVel>
        <rFloatGoalInc> fGoalInc </rFloatGoalInc>
        <rVecRightPost> vRightTranslate </rVecRightPost>
        <rVecLeftPost> vLeftTranslate </rVecLeftPost>
        <rFloatRadius> fBoundingRadius </rFloatRadius>
      </tUpdateGoal>
    </Update>

    <Render>
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
      </tSetMaterial>
      <tRenderRightPost prototype="ActionRenderGeometry">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
        <rScale>vScale</rScale>
        <rOrientation>xRotate</rOrientation>
        <rRotate>vRotate</rRotate>
        <rTranslate>vRightTranslate</rTranslate>
      </tRenderRightPost>

      <tRenderLeftPost prototype="ActionRenderGeometry">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
        <rScale>vScale</rScale>
        <rOrientation>xRotate</rOrientation>
        <rRotate>vRotate</rRotate>
        <rTranslate>vLeftTranslate</rTranslate>
      </tRenderLeftPost>
    </Render>
    
  </tNorthGoal>
  
  <tSouthGoal prototype="EntityCollidable">
    <iPlayer>SGOL</iPlayer>
    <pVertexBuffer>NULL</pVertexBuffer>
    <pIndexBuffer>NULL</pIndexBuffer>
    <pMaterial>NULL</pMaterial>
    <pTexture>NULL</pTexture>
    <pVertexShader>NULL</pVertexShader>
    <pPixelShader>NULL</pPixelShader>
    <sFilename>goalPost.obj</sFilename>
    <iNumVertices>0</iNumVertices>
    <iNumFaces>0</iNumFaces>
    <iUseIndexBuffer>true</iUseIndexBuffer>
    <iHasNormals>false</iHasNormals>
    <!-- set by ActionCreateGeometryBuffers -->
    <iHasTexCoords>false</iHasTexCoords>
    <!-- set by ActionCreateGeometryBuffers -->
    <vScale> {5.0, 5.0, 5.0} </vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 0.0, 1.0, 0.0} </vRotate>
    <fElasticity>0</fElasticity>
    <fBoundingRadius>100.0</fBoundingRadius>
    <iBoundingVolumeType>PLNE</iBoundingVolumeType>
    <vConvHull index="0"> {0, 0, 1, 0}</vConvHull>
    <rConvexHull> vConvHull </rConvexHull>
    <fMassInverse>0.0</fMassInverse>
    <!-- This begins the values used to update goal size and placement -->
    <!-- Vector value representing goal position -->
    <vTranslate> {0.0, 25.0, -445} </vTranslate>
    <!-- Vector value representing offset distance that post is rendered at from goal center -->
    <vPostOffset> {100.0, 0.0, 0.0} </vPostOffset>
    <!-- Float value representing size increment that goal grows/shrinks by on score changes -->
    <fGoalInc> 10.0 </fGoalInc>
    <!-- Float value representing x bounds for goal posts-->
    <fGoalBound> 445 </fGoalBound>
    <!-- Int value used to indicate direction goal is moving - 1 right 0 left-->
    <iGoalDir> 1 </iGoalDir>
    <!-- Vec value representing fixed velocity of goal -->
    <vGoalVel> {3.0, 0.0, 0.0}</vGoalVel>
    <!-- Vec value representing position of right goal post-->
    <vRightTranslate> {100.0, 2.5, -445} </vRightTranslate>
    <!-- Vec value representing position of left goal post-->
    <vLeftTranslate> {-100.0, 2.5, -445} </vLeftTranslate>
    <iGoalDiff> 0 </iGoalDiff>
    <!-- End of Values related to updating goal size and placement-->

    <Init>
      <tCreateGeometry prototype="ActionCreateGeometryBuffers">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
      </tCreateGeometry>
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
        <vDiffuse> {1.0, 1.0, 1.0, 1.0} </vDiffuse>
        <sTextureFile> orangeTexture.dds </sTextureFile>
        <sVertexShader> C3E2v_varying.cg </sVertexShader>
        <sPixelShader> DefaultShader.cg </sPixelShader>
        <vAmbient> {1.0, 1.0, 1.0, 1.0} </vAmbient>
        <vSpecular> {1.0, 1.0, 1.0, 1.0} </vSpecular>
        <vEmissive> {1.0, 1.0, 1.0, 1.0} </vEmissive>
        <fPower>1.0</fPower>
      </tSetMaterial>
    </Init>

    <Update>
      <tUpdateGoal prototype ="ActionUpdateGoal">
        <rVecGoalPos> vTranslate </rVecGoalPos>
        <rVecPostOffset> vPostOffset </rVecPostOffset>
        <rFloatGoalBound> fGoalBound </rFloatGoalBound>
        <rIntGoalDir> iGoalDir </rIntGoalDir>
        <rVecGoalVel> vGoalVel </rVecGoalVel>
        <rFloatGoalInc> fGoalInc </rFloatGoalInc>
        <rIntGoalDiff> iGoalDiff </rIntGoalDiff>
        <rVecRightPost> vRightTranslate </rVecRightPost>
        <rVecLeftPost> vLeftTranslate </rVecLeftPost>
        <rFloatRadius> fBoundingRadius </rFloatRadius>
      </tUpdateGoal>
    </Update>

    <Render>
      <tSetMaterial prototype="ActionSetMaterial">
        <rMaterialPointer>pMaterial</rMaterialPointer>
        <rTexturePointer>pTexture</rTexturePointer>
        <rVertexShaderPointer>pVertexShader</rVertexShaderPointer>
        <rPixelShaderPointer>pPixelShader</rPixelShaderPointer>
        <rRightPost> vRightTranslate </rRightPost>
        <rLeftPost> vLeftTranslate </rLeftPost>
      </tSetMaterial>
      
      <tRenderRightPost prototype="ActionRenderGeometry">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
        <rScale>vScale</rScale>
        <rOrientation>xRotate</rOrientation>
        <rRotate>vRotate</rRotate>
        <rTranslate>vRightTranslate</rTranslate>
      </tRenderRightPost>

      <tRenderLeftPost prototype="ActionRenderGeometry">
        <rVertexBuffer>pVertexBuffer</rVertexBuffer>
        <rIndexBuffer>pIndexBuffer</rIndexBuffer>
        <rFilename>sFilename</rFilename>
        <rNumVertices>iNumVertices</rNumVertices>
        <rNumFaces>iNumFaces</rNumFaces>
        <rUseIndexBuffer>iUseIndexBuffer</rUseIndexBuffer>
        <rHasNormals>iHasNormals</rHasNormals>
        <rHasTexCoords>iHasTexCoords</rHasTexCoords>
        <rScale>vScale</rScale>
        <rOrientation>xRotate</rOrientation>
        <rRotate>vRotate</rRotate>
        <rTranslate>vLeftTranslate</rTranslate>
      </tRenderLeftPost>
    </Render>
  </tSouthGoal>
  
  <tNorthWall prototype="EntityCollidable">
    <!-- Nothing is rendered, only collided -->
    <iPlayer>WALL</iPlayer>
    <fElasticity>1</fElasticity>
    <fBoundingRadius>550.0</fBoundingRadius>
    <iBoundingVolumeType>PLNE</iBoundingVolumeType>
    <vConvHull index="0"> {0, 0, -1, -316.2278}</vConvHull>
    <rConvexHull> vConvHull </rConvexHull>
    <fMassInverse>0.0</fMassInverse>
    <vTranslate>{0.0, 0.0, 766.2278}</vTranslate>
    <vScale>{1.0, 1.0, 1.0 }</vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 0.0, 1.0, 0.0} </vRotate>
  </tNorthWall>

  <tSouthWall prototype="EntityCollidable">
    <!-- Nothing is rendered, only collided -->
    <iPlayer>WALL</iPlayer>
    <fElasticity>1</fElasticity>
    <fBoundingRadius>550.0</fBoundingRadius>
    <iBoundingVolumeType>PLNE</iBoundingVolumeType>
    <vConvHull index="0"> {0, 0, 1, -316.2278}</vConvHull>
    <rConvexHull> vConvHull </rConvexHull>
    <fMassInverse>0.0</fMassInverse>
    <vTranslate>{0.0, 0.0, -766.2278}</vTranslate>
    <vScale>{1.0, 1.0, 1.0 }</vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 0.0, 1.0, 0.0} </vRotate>
  </tSouthWall>

  <tEastWall prototype="EntityCollidable">
    <!-- Nothing is rendered, only collided -->
    <iPlayer>WALL</iPlayer>
    <fElasticity>1</fElasticity>
    <fBoundingRadius>550.0</fBoundingRadius>
    <iBoundingVolumeType>PLNE</iBoundingVolumeType>
    <vConvHull index="0"> {1, 0, 0, -316.2278}</vConvHull>
    <rConvexHull> vConvHull </rConvexHull>
    <fMassInverse>0.0</fMassInverse>
    <vTranslate>{-766.2278, 0.0, 0.0}</vTranslate>
    <vScale>{1.0, 1.0, 1.0 }</vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 0.0, 1.0, 0.0} </vRotate>
  </tEastWall>

  <tWestWall prototype="EntityCollidable">
    <!-- Nothing is rendered, only collided -->
    <iPlayer>WALL</iPlayer>
    <fElasticity>1</fElasticity>
    <fBoundingRadius>550.0</fBoundingRadius>
    <iBoundingVolumeType>PLNE</iBoundingVolumeType>
    <vConvHull index="0"> {-1, 0, 0, -316.2278}</vConvHull>
    <rConvexHull> vConvHull </rConvexHull>
    <fMassInverse>0.0</fMassInverse>
    <vTranslate>{766.2278, 0.0, 0.0}</vTranslate>
    <vScale>{1.0, 1.0, 1.0 }</vScale>
    <xRotate> {1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1} </xRotate>
    <vRotate> {0.0, 0.0, 1.0, 0.0} </vRotate>
  </tWestWall>

  <tTimer prototype="Entity">
    <fTime>  </fTime>
    <fStartingTime> 300.0 </fStartingTime>
    <sTimeString> 300.0 </sTimeString>
    <Init>
      <expr> fTime = fStartingTime </expr>
    </Init>
        
    <Update>
        <!-- If the game is active -->
        <tUpdateIfGameRunning prototype="ActionListIf">
            <rCondition> iGameRunning </rCondition>
            <then>
                <!-- Decrement timer. -->
                <tDecTimer prototype="ActionDecrementTimer">
                    <rTime> fTime </rTime>
                    <rTimeString> sTimeString </rTimeString>
                </tDecTimer>
                <!-- If time is less than zero, pause the game-->
                <iCondition> </iCondition>
                <expr> iCondition = fTime LTE 0.0 </expr>
                <tCheckEnd prototype="ActionListIf">
                    <rCondition> iCondition </rCondition>
                    <then>
                        <expr> iGameRunning = 0 </expr>
                        <expr> iGameOver = 1 </expr>
                        <expr> fTime = 0.0</expr>

                        <tThrowPauseGame prototype="ActionEvent">
                          <iSubtype>paus</iSubtype>
                          <fDelay>0.0</fDelay>
                        </tThrowPauseGame>
                          
                        <tActionUnloadKeyBoard prototype="ActionUnloadSector">
                            <sSectorName>GeneralInput</sSectorName>
                        </tActionUnloadKeyBoard>
                        
                        <tStopVehicleSound prototype="ActionStopSound">
                          <sFilename> vehicle.wav </sFilename>
                        </tStopVehicleSound>
                        
                        <tStopDrumLoop prototype="ActionStopSound">
                          <sFilename> drums.wav </sFilename>
                        </tStopDrumLoop>
                        
                        <tPlayWinSound prototype="ActionPlaySound">
                          <sFilename> win.wav </sFilename>
                        </tPlayWinSound>

                        <tActionLoad prototype ="ActionLoad">
                          <sFilename>GameOver.xml</sFilename>
                        </tActionLoad>

                        <tThrowEndGame prototype="ActionEvent">
                            <iSubtype>over</iSubtype>
                            <fDelay>8.0</fDelay>
                        </tThrowEndGame>
                    </then>
                </tCheckEnd>
            </then>
        </tUpdateIfGameRunning>
    </Update>
        
    <Render>
      <vColor> {1,1,1,1} </vColor>
      <sFont> Courier New </sFont>
      <iSize> 20 </iSize>
      <vPosition> {400,0,0,0} </vPosition>
      <tRenderTimer prototype="ActionRenderText">
        <rText> sTimeString </rText>
        <rPosition> vPosition </rPosition>
        <rColor> vColor </rColor>
        <rFont> sFont </rFont>
        <rSize> iSize </rSize>
      </tRenderTimer>
    </Render>
  </tTimer>
  
  <tReactGameStart prototype="ReactionAttributed" iSynchronous="0">
    <iMatch> strt </iMatch>
    <iMask> -1 </iMask>
    <tActionList prototype="ActionList">
      <expr> iGameRunning = 1 </expr>
    </tActionList>

  </tReactGameStart>
  <tReactGamePause prototype="ReactionAttributed" iSynchronous="0">
    <iMatch> paus </iMatch>
    <iMask> -1 </iMask>
    <tActionList prototype="ActionList">
      <expr> iGameRunning = 0 </expr>
    </tActionList>
  </tReactGamePause>
  <tReactGameStop prototype="ReactionAttributed" iSynchronous="0">
    <iMatch> stop </iMatch>
    <iMask> -1 </iMask>
    <tActionList prototype="ActionList">
      <expr> iGameRunning = 0 </expr>
    </tActionList>
  </tReactGameStop>

  <tReactGameOver prototype="ReactionAttributed" iSynchronous="0">
    <iMatch>over</iMatch>
    <iMask>-1</iMask>
    <tActionList prototype="ActionList">
    
      <!-- Sets timer to zero so player two's game will be ended as well -->
      <expr> tTimer . fTime = 0 </expr>

      <tActionUnloadGameOver prototype="ActionUnloadSector">
        <sSectorName>GameOver</sSectorName>
      </tActionUnloadGameOver>
      
      <tActionUnloadCleanXML prototype="ActionUnloadSector">
        <sSectorName>CleanXML</sSectorName>
      </tActionUnloadCleanXML>
      
      <tActionMenu prototype="ActionLoad">
          <sFilename>MenuScreen.xml</sFilename>
      </tActionMenu>

      <tActionKeyboard prototype="ActionLoad">
          <sFilename>VirtualKeyboard.xml</sFilename>
      </tActionKeyboard>
      
    </tActionList>
  </tReactGameOver>

  <tScoreboard prototype="Entity">

    <iPlayer1Color> 0xFF0000FF </iPlayer1Color>
    <iPlayer2Color> 0xFFFF9901 </iPlayer2Color>
    <iNeutralColor> 0xFFFFFFFF </iNeutralColor>

    <iScoreColor index ="0">0xFFFFFFFF </iScoreColor>
    <iScoreColor index ="1">0xFFFFFFFF </iScoreColor>
    <iScoreColor index ="2">0xFFFFFFFF </iScoreColor>
    <iScoreColor index ="3">0xFFFFFFFF </iScoreColor>
    <iScoreColor index ="4">0xFFFFFFFF </iScoreColor>
    <iScoreColor index ="5">0xFFFFFFFF </iScoreColor>
    <iScoreColor index ="6">0xFFFFFFFF </iScoreColor>
    <iScoreColor index ="7">0xFFFFFFFF </iScoreColor>
    <iScoreColor index ="8">0xFFFFFFFF </iScoreColor>
    <iScoreColor index ="9">0xFFFFFFFF </iScoreColor>

    <vScorePos index ="0"> {0, 25, 0, 0}  </vScorePos>
    <vScorePos index ="1"> {0, 55, 0, 0}  </vScorePos>
    <vScorePos index ="2"> {0, 85, 0, 0}  </vScorePos>
    <vScorePos index ="3"> {0, 115, 0, 0}  </vScorePos>
    <vScorePos index ="4"> {0, 145, 0, 0}  </vScorePos>
    <vScorePos index ="5"> {0, 175, 0, 0}  </vScorePos>
    <vScorePos index ="6"> {0, 205, 0, 0}  </vScorePos>
    <vScorePos index ="7"> {0, 235, 0, 0}  </vScorePos>
    <vScorePos index ="8"> {0, 265, 0, 0}  </vScorePos>
    <vScorePos index ="9"> {0, 295, 0, 0}  </vScorePos>

    <vScoreCenter index="0">{0, 0, 0, 0}</vScoreCenter>
    <vScoreCenter index="1">{0, 0, 0, 0}</vScoreCenter>
    <vScoreCenter index="2">{0, 0, 0, 0}</vScoreCenter>
    <vScoreCenter index="3">{0, 0, 0, 0}</vScoreCenter>
    <vScoreCenter index="4">{0, 0, 0, 0}</vScoreCenter>
    <vScoreCenter index="5">{0, 0, 0, 0}</vScoreCenter>
    <vScoreCenter index="6">{0, 0, 0, 0}</vScoreCenter>
    <vScoreCenter index="7">{0, 0, 0, 0}</vScoreCenter>
    <vScoreCenter index="8">{0, 0, 0, 0}</vScoreCenter>
    <vScoreCenter index="9">{0, 0, 0, 0}</vScoreCenter>

    <iNumSprites> 10 </iNumSprites>
    <iSingleFile> 1 </iSingleFile>
    
    <pRect> 0 </pRect>

    <iPlayer1Score> 0 </iPlayer1Score>
    <iPlayer2Score> 0 </iPlayer2Score>
    <iFontSize> 20 </iFontSize>
    <vPlayer1Color>{0.0, 0.0, 1.0}</vPlayer1Color>
    <vPlayer2Color>{1.0, 0.6, 0.1}</vPlayer2Color>
    <vNeutralColor>{0.4, 0.4, 0.4}</vNeutralColor>
    <sFontType>Courier New</sFontType>

    <Init>
      <sFilename> scoreball.png </sFilename>
      <tCreateSprite prototype ="ActionCreateSprite">
        <rFile> sFilename </rFile>
        <rTexture> pSprite </rTexture>
      </tCreateSprite>
    </Init>

    <Render>
      <tSpriteList prototype ="ActionRenderSpriteList">
        <rSpriteFile> pSprite </rSpriteFile>
        <rColor> iScoreColor </rColor>
        <rCenter> vScoreCenter </rCenter>
        <rTranslate> vScorePos </rTranslate>
        <rSquare> pRect </rSquare>
        <rSingleFile> iSingleFile </rSingleFile>
        <rNumSprites> iNumSprites </rNumSprites>
      </tSpriteList>
    </Render>

    <tReactUpdateGoal prototype="ReactionAttributed">
      <iMatch> GOAL </iMatch>
      <iMask> -1 </iMask>
      <tActions prototype="ActionList">
        <tUpdateScore prototype ="ActionUpdateScoreboard">
          <rIntPlayer1Score>iPlayer1Score</rIntPlayer1Score>
          <rIntPlayer2Score>iPlayer2Score</rIntPlayer2Score>
          <rScoreColor> iScoreColor </rScoreColor>
          <rIntPlayer1Color> iPlayer1Color </rIntPlayer1Color>
          <rIntPlayer2Color> iPlayer2Color </rIntPlayer2Color>
          <rIntNeutralColor> iNeutralColor </rIntNeutralColor>
        </tUpdateScore>
        
        <!-- Play goal sound -->
        <tPlayGoalSound prototype="ActionPlaySound">
          <sFilename> goal.wav </sFilename>
        </tPlayGoalSound>
		
		<expr>" sCgFile = "HyperFlash.cg" "</expr>
		<expr> iFlashScreen = 60 </expr> 
		
        <iCondition> 0 </iCondition>
        <iCondition1> 0 </iCondition1>
        <iCondition2> 0 </iCondition2>

        <expr> iCondition1 = ( iPlayer1Score == 10 ) </expr>
        <expr> iCondition2 = ( iPlayer2Score == 10 ) </expr>
        <expr> iCondition = ( iCondition1 OR iCondition2 ) </expr>

        <if>
          <rCondition> iCondition </rCondition>
          <then>
            <expr> iGameRunning = 0 </expr>
            <expr> iGameOver = 1 </expr>
            
            
            <tActionUnloadKeyBoard prototype="ActionUnloadSector">
              <sSectorName>GeneralInput</sSectorName>
            </tActionUnloadKeyBoard>
            <tThrowPauseGame prototype="ActionEvent">
              <iSubtype>paus</iSubtype>
              <fDelay>0.0</fDelay>
            </tThrowPauseGame>

            <tThrowEndGame prototype="ActionEvent">
              <iSubtype>over</iSubtype>
              <fDelay>8.0</fDelay>
            </tThrowEndGame>
            
            <tStopVehicleSound prototype="ActionStopSound">
              <sFilename> vehicle.wav </sFilename>
            </tStopVehicleSound>
            
            <tStopDrumLoop prototype="ActionStopSound">
              <sFilename> drums.wav </sFilename>
            </tStopDrumLoop>
            
            <tPlayWinSound prototype="ActionPlaySound">
              <sFilename> win.wav </sFilename>
            </tPlayWinSound>

            <tActionLoad prototype ="ActionLoad">
              <sFilename>GameOver.xml</sFilename>
            </tActionLoad>

          </then>

          <else>
            <!-- Stop the game right now -->
            <tThrowPauseGame prototype="ActionEvent">
              <iSubtype>paus</iSubtype>
              <fDelay>0.0</fDelay>
            </tThrowPauseGame>
            <tThrowStopGame prototype="ActionEvent">
              <iSubtype>stop</iSubtype>
              <fDelay>1.5</fDelay>
            </tThrowStopGame>
            <!-- Start the game in 3.0 seconds -->
            <tThrowStartGame prototype="ActionEvent">
              <iSubtype>strt</iSubtype>
              <fDelay>4.5</fDelay>
            </tThrowStartGame>
            <expr> tNorthGoal . iGoalDiff = iPlayer2Score - iPlayer1Score </expr>
            <expr> tSouthGoal . iGoalDiff = iPlayer1Score - iPlayer2Score </expr>
          </else>

        </if>
      </tActions>
    </tReactUpdateGoal>

  </tScoreboard>
  
  <tPostProcessEntity prototype="Entity">
		<Render>
		  <iCondition> 0 </iCondition>
		  <expr> iCondition = ( iFlashScreen == 0 ) </expr>
 		  <if>
			<rCondition> iCondition </rCondition>
			<then> 
				<expr>" sCgFile = "Ambient.cg" "</expr>
  			</then> 
  			<else>
				<expr> iFlashScreen = ( iFlashScreen - 1 ) </expr>
				<expr>" sCgFile = "HyperFlash.cg" "</expr>
			</else>   
		  </if> 
		  <tPostProcess prototype="ActionPostProcess">
				<rCgFile> sCgFile </rCgFile>
		  </tPostProcess>
		</Render>
	</tPostProcessEntity>
  
</sector>
