

// Create renderer

create D3DRenderer parent root0
link root0 TimeUpdate D3DRenderer TimeUpdate
//subcreate D3DRenderer GlobalEffect script Data\GlobalEffects\X_DepthOfField.txt
//subcreate D3DRenderer GlobalEffect script Data\GlobalEffects\X_MotionBlur.txt



// Create sunlight

subcreate D3DRenderer LightInstance name Light0
set Light0 Colour 0.5 0.5 0.9
set Light0 Intensity 0.8
set Light0 VisInfo 0.0 25.0 20.0 0.0 -2.5 -1

// Create scenery

subcreate D3DRenderer RenderInstance name Mesh
set Mesh DataFile Data\Mesh.txt

subcreate D3DRenderer RenderInstance name Sky
set Sky DataFile Data\SkyBox.txt

// Create input

create DXInput parent root0
link root0 TimeUpdate DXInput TimeUpdate

// Create PhysX

create Physics parent root0
link root0 TimeUpdate Physics TimeUpdate

// Create Audio

create Audio parent root0

// Create avatar

create Avatar parent root0
set Avatar Position 0.0 1.0 -5.0

subcreate Physics PhysicsAvatar
link Avatar Displacement PhysicsAvatar Displacement
link PhysicsAvatar Position D3DRenderer CamPos
set PhysicsAvatar Enable true


// Link input to avatar movement

link DXInput MouseClickLeft Avatar LookMode
link DXInput MouseMove Avatar LookMove
link DXInput Pressed_W Avatar MoveForwards
link DXInput Pressed_S Avatar MoveBackwards
link DXInput Pressed_Q Avatar MoveLeft
link DXInput Pressed_E Avatar MoveRight
link DXInput Pressed_R Avatar MoveUp
link DXInput Pressed_F Avatar MoveDown
link DXInput Pressed_D Avatar StrafeRight
link DXInput Pressed_A Avatar StrafeLeft


// Link avatar outputs

//link Avatar Position D3DRenderer CamPos
link Avatar Look D3DRenderer CamLook
link Avatar Up D3DRenderer CamUp

link PhysicsAvatar Position Physics TargetPos
link Avatar Look Physics TargetLook
link Avatar Up Physics TargetUp
set Physics TargetViewAngle 0.95


link PhysicsAvatar Position Audio ListenerPos
link Avatar Look Audio ListenerLook
link Avatar Up Audio ListenerUp


// Create UI

subcreate D3DRenderer RenderEntity2D name HealthBar
set HealthBar Position 0.5 0.985 0.0
set HealthBar Scale 0.4 0.03 0.0
set HealthBar Texture Data\Textures\healthbar.tga
link Avatar HealthBarScale HealthBar Scale

subcreate D3DRenderer RenderEntity2D name Crosshair
set Crosshair Position 0.5 0.5 0.0
set Crosshair Scale 0.04 0.04 0.0
set Crosshair Colour 0.0 1.0 0.0
set Crosshair Texture Data\Textures\crosshair.tga
set Crosshair Alpha 0.5


subcreate D3DRenderer RenderEntity2D name TargetGfx
set TargetGfx Position 0.5 0.5 0.0
set TargetGfx Scale 0.1 0.1 0.0
set TargetGfx Texture Data\Textures\target.tga
set TargetGfx Alpha 0.0

create TargetUI parent roo1


// Link UI

//link Avatar Health HealthBar Scale

link Physics Target TargetUI Target
link TargetUI Position TargetGfx Position
link TargetUI Scale TargetGfx Scale
link TargetUI Colour TargetGfx Colour
link TargetUI Alpha TargetGfx Alpha


// Create gun manager and guns

create GunManager parent root0
set GunManager AddGun Data\Guns\Pistol.txt
set GunManager AddGun Data\Guns\Shotgun.txt
set GunManager AddGun Data\Guns\MacPistol.txt
set GunManager AddGun Data\Guns\Sniper.txt

// Gun Manager inputs

link root0 TimeUpdate GunManager TimeUpdate
link PhysicsAvatar Position GunManager Position
link Avatar Look GunManager Direction
link DXInput MouseClickRight GunManager Trigger
link DXInput Hit_Y GunManager ChangeGunUp
link DXInput Hit_H GunManager ChangeGunDown

// Fort physics

subcreate Physics PhysicsEntity name Fort
set Fort AddMaterial Data\PhysicsMaterials\Stone.txt
set Fort Density 0.0
set Fort AddMesh Data\Meshes\fort8.x
set Fort Enable true

// Explosion

//subcreate D3DRenderer RenderInstance name Particles
//set Particles DataFile Data\Particles.txt

//subcreate Physics PhysicsExplosion
//link PhysicsExplosion ParticleArray Particles ParticleArray

//link DXInput Hit_V PhysicsExplosion SpawnParticles


// Create ship

subcreate D3DRenderer RenderInstance name ShipGfx
set ShipGfx DataFile Data\Ship.txt

subcreate D3DRenderer RenderInstance name ShipShieldGfx
set ShipShieldGfx DataFile Data\ShipShield.txt

create HoverShip parent root0
set HoverShip CenterPos 0.0 5.0 -5.0
set HoverShip SearchArea 20.0 0.0 20.0
link HoverShip VisInfo ShipGfx VisInfo
link HoverShip ShieldVisInfo ShipShieldGfx VisInfo

//subcreate D3DRenderer LightInstance name ShipLight
//set ShipLight Colour 0.4 0.9 0.5
//set ShipLight Intensity 2.1
//set ShipLight FOV 45.0
//link HoverShip LightVis ShipLight VisInfo

link PhysicsAvatar Position HoverShip Target
link root0 TimeUpdate HoverShip TimeUpdate

//link Avatar Look HoverShip CameraLookIn
//link HoverShip CameraLookOut D3DRenderer CamLook

subcreate Physics PhysicsEntity name ShipTarget1
set ShipTarget1 AddMaterial Data\PhysicsMaterials\ShipTarget1.txt
set ShipTarget1 AddShapePos 0.0 -0.15 4.5
set ShipTarget1 AddBox 0.5 0.1 0.5
set ShipTarget1 Enable true
link ShipTarget1 Health HoverShip TargetHealth1
link HoverShip TargetActive1 ShipTarget1 Target
link HoverShip TargetMaxHealth ShipTarget1 Health
link HoverShip TargetSoftness ShipTarget1 Softness
link HoverShip VisInfo  ShipTarget1 VisInfo

subcreate Physics PhysicsEntity name ShipTarget2
set ShipTarget2 AddMaterial Data\PhysicsMaterials\ShipTarget1.txt
set ShipTarget2 AddShapePos 2.5 0.2 -1.1
set ShipTarget2 AddBox 0.5 0.1 0.5
set ShipTarget2 Enable true
link ShipTarget2 Health HoverShip TargetHealth2
link HoverShip TargetActive2 ShipTarget2 Target
link HoverShip TargetMaxHealth ShipTarget2 Health
link HoverShip TargetSoftness ShipTarget2 Softness
link HoverShip VisInfo  ShipTarget2 VisInfo

subcreate Physics PhysicsEntity name ShipTarget3
set ShipTarget3 AddMaterial Data\PhysicsMaterials\ShipTarget1.txt
set ShipTarget3 AddShapePos -2.5 0.2 -1.1
set ShipTarget3 AddBox 0.5 0.1 0.5
set ShipTarget3 Enable true
link ShipTarget3 Health HoverShip TargetHealth3
link HoverShip TargetActive3 ShipTarget3 Target
link HoverShip TargetMaxHealth ShipTarget3 Health
link HoverShip TargetSoftness ShipTarget3 Softness
link HoverShip VisInfo  ShipTarget3 VisInfo

subcreate Physics PhysicsEntity name ShipTarget4
set ShipTarget4 AddMaterial Data\PhysicsMaterials\ShipTarget1.txt
set ShipTarget4 AddShapePos 0.0 -0.15 -2.7
set ShipTarget4 AddBox 0.5 0.1 0.5
set ShipTarget4 Enable true
set ShipTarget4 Softness 0.0005
link ShipTarget4 Health HoverShip TargetHealth4
link HoverShip TargetActive4 ShipTarget4 Target
link HoverShip TargetMaxHealth ShipTarget4 Health
link HoverShip TargetSoftness ShipTarget4 Softness
link HoverShip VisInfo  ShipTarget4 VisInfo

// Lava

subcreate D3DRenderer RenderInstance name Particles
set Particles DataFile Data\Particles.txt

subcreate Physics PhysicsLava
link PhysicsLava ParticleArray Particles ParticleArray
link PhysicsAvatar Position PhysicsLava PlayerPosition
link PhysicsLava PlayerDamage Avatar Damage

link HoverShip LavaGunFire PhysicsLava SpawnParticle




subcreate D3DRenderer RenderEntity2D name IntroPic1
set IntroPic1 Scale 1.0 1.0 0.0
set IntroPic1 Position 0.5 0.5 0.0
set IntroPic1 Texture Data\Textures\invade_intro.tga

subcreate D3DRenderer RenderEntity2D name IntroPic2
set IntroPic2 Scale 0.6 0.12 0.0
set IntroPic2 Texture Data\Textures\help.tga

create IntroUI
link root0 TimeUpdate IntroUI TimeUpdate
link IntroUI Position IntroPic2 Position
link IntroUI Alpha1 IntroPic1 Alpha
link IntroUI Alpha2 IntroPic2 Alpha


open Data\Language\English.txt
open Data\Language\German.txt


create HelpNode parent root0
link HelpNode TextDisplay D3DRenderer TextDisplay
link DXInput Pressed_F1 HelpNode Active
link DXInput Hit_F2 HelpNode CycleLanguage


// Create nodes to run scripts on input

create RunScript parent root0 name Run1
set Run1 ScriptFile Data\AddBox.txt
link DXInput Hit_G Run2 Execute

create RunScript parent root0 name Run2
set Run2 ScriptFile Data\Language\English.txt
link DXInput Hit_F2 Run2 Execute

create RunScript parent root0 name Run3
set Run3 ScriptFile Data\Language\German.txt
link DXInput Hit_F2 Run3 Execute

create RunScript parent root0 name Run4
set Run4 ScriptFile Data\Language\Japenese.txt
link DXInput Hit_F2 Run4 Execute



