<!-- TODO: Update the level's image-->

<!-- See TowerDefenseReadme.txt for Information on this file -->

<LevelInfo
 name = "Tower Defense"
 description = "Defend your Spacestation from incoming waves."
 tags = "minigame"
 screenshot = "emptylevel.png"
/>

<?lua
  include("stats.oxo")
  include("HUDTemplates3.oxo")
  include("towerdefenseHUD.oxo")
  include("templates/lodInformation.oxt")
?>

<?lua
  include("templates/spaceshipAssff.oxt")
  include("templates/spaceshipPirate.oxt")
  include("templates/tower.oxt")
?>

<!-- Specify the position of the camera -->
<Template name=centerpointmarkcamera defaults=0>
  <Pawn>
    <camerapositions>
      <CameraPosition position="0,0,1500"/>
    </camerapositions>
  </Pawn>
</Template>

<!-- Loads a mesh to mark the center-->
<Template name=centerpointmark>
  <Pawn camerapositiontemplate=centerpointmarkcamera>
    <attached>
      <Model position="0,0,0" mesh="cylinder.mesh" scale3D="1,1,1" /> <!-- the camera is attached to this -->
    </attached>
  </Pawn>
</Template>


<!-- Template for a tower   EDIT: new towertemplate is included with "templates/tower" -->
<!--Template name=towertemplate>
  <Tower>
    <attached>
      <Model position="0,0,0" scale=0.25 mesh="Tower_ME.mesh" />
    </attached>
  </Tower>
</Template-->





<Level gametype = "TowerDefense">
  <templates>
    <Template link=lodtemplate_default />
  </templates>

  <?lua include("includes/notifications.oxi") ?>

  <Scene
    ambientlight = "0.8, 0.8, 0.8"
    skybox       = "Orxonox/Starbox"
  >

    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>

    <!-- Spawns the camera, attached to a crate -->
    <SpawnPoint team=0 position="0,0,0" spawnclass=Pawn pawndesign=centerpointmark />
    <!--TeamSpawnPoint team=1 position="-7,7,4" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /-->

    <!--SpawnPoint team=1 position="0,0,10" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff  /-->
    <!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /-->

    <SpaceShip position="-700,-500, 100" lookat="0,0,0" scale=3 team=1 >
      <templates>
        <Template link=spaceshipassff />
      </templates>
      <controller>
        <WaypointController accuracy=60>
          <waypoints>
            <!-- 1,3 10,3 10,11, 13,11 -->
            <Model mesh="cube.mesh" scale=0 position="-700,-500, 150" />
            <Model mesh="cube.mesh" scale=0 position=" 200,-500, 150" />
            <Model mesh="cube.mesh" scale=0 position=" 200, 300, 150" />
            <Model mesh="cube.mesh" scale=0 position=" 500, 300, 150" />
            <Model mesh="cube.mesh" scale=0 position=" 500, 700, 150" />
          </waypoints>
        </WaypointController>
      </controller>
    </SpaceShip>


    <!--invisible entity to attach towers to, since playfield is static and towers are dynamic-->
    <StaticEntity position=0,0,0>

        <attached>
            <Model position="-50,-50,0" mesh="Playfield_ME.mesh" scale=80 />
            <!-- Base -->
            <Model position="500,700,100" mesh="sphere.mesh" scale=80 />
            <!--Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /--> <!-- Only temporary needed to help align the collisionshape -->
            <!-- This was used to mark the playfield, let's let it be here for now -->
            <!--Model position="-8,8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
            <!--Model position="-8,-8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
            <!--Model position="8,-8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
            <!--Model position="8,8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
        </attached>
        <collisionShapes> <!-- The collisionshape forbids other worldentities that have a collisionShape to fly through it.

                               TODO: Find correct size for the collisionshape; since a collisionShape is invisible
                               I added the crate wich currently has the same dimensions as the collisionshape.
                               You have to adjust the crate's scale3D as well as the collisionshape's halfExtens to
                               find the proper shape. -->
           <BoxCollisionShape position="0,0,0" halfExtents="400,400,100" />
        </collisionShapes>
    </StaticEntity>




    <!-- PlayField -->
    <TowerDefenseCenterpoint
    name=towerdefensecenter
    width=16
    height=16
    tileScale=100
    towerTemplate=tower
    position="0,0,0"
    direction="0,0,0"
    collisionType=dynamic
    mass=100000>

    </TowerDefenseCenterpoint>

  </Scene>
</Level>