
// 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
link root0 TimeUpdate Audio TimeUpdate

subcreate Audio SFX name PhysicsPushSFX script Data\Audio\Ric.txt
link Physics PushSound PhysicsPushSFX Play

create AmbientNode parent root0
set AmbientNode Center 0.0 0.0 0.0
set AmbientNode Area 10.0 0.0 10.0
set AmbientNode MinTime 5.0
set AmbientNode MaxTime 15.0
link root0 TimeUpdate AmbientNode TimeUpdate
subcreate Audio SFX name AmbientSFX script Data\Audio\Ambient.txt
link AmbientNode PushSound AmbientSFX Play


// Create avatar

create Avatar parent root0
set Avatar Position 0.0 1.0 -5.0


// 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 Avatar Look Physics TargetLook
link Avatar Up Physics TargetUp
set Physics TargetViewAngle 0.95


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


// Create UI


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


// 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 Avatar Position GunManager Position
link Avatar Look GunManager Direction
link DXInput MouseClickRight GunManager Trigger
link DXInput Hit_U GunManager ChangeGunUp
link DXInput Hit_J GunManager ChangeGunDown



// Explosion

subcreate D3DRenderer RenderInstance name ExplosionGFX
set ExplosionGFX DataFile Data\Explosion.txt

subcreate Physics PhysicsExplosion
link PhysicsExplosion ParticleArray ExplosionGFX ParticleArray

subcreate Audio SFX name ExplosionSFX script Data\Audio\Explosion.txt

create ExplosionHelper parent root0

link ExplosionHelper SoundEvent ExplosionSFX Play
link ExplosionHelper TextDisplay D3DRenderer TextDisplay
link DXInput Hit_T ExplosionHelper NextAttribute
link DXInput Hit_G ExplosionHelper PrevAttribute
link DXInput Hit_Y ExplosionHelper IncreaseAttribute
link DXInput Hit_H ExplosionHelper DecreaseAttribute

set ExplosionHelper TimeModifier 1.0
set ExplosionHelper Speed 0.0
set ExplosionHelper GasIgnitionRate 150.0
set ExplosionHelper NumGasParticles 10
set ExplosionHelper NumFireParticles 1000
set ExplosionHelper Gravity 0.0
set ExplosionHelper SearchRadius 0.5
set ExplosionHelper RestDensity 40.0
set ExplosionHelper PressureK 0.04
set ExplosionHelper NearPressureK 0.1
set ExplosionHelper TemperatureDiffusion 0.03
set ExplosionHelper VisciousAlpha 0.3
set ExplosionHelper VisciousBeta 0.6

link DXInput Hit_Space ExplosionHelper FireTrigger
link Avatar Position ExplosionHelper FirePos
link Avatar Look ExplosionHelper FireLook

link ExplosionHelper Trigger PhysicsExplosion Trigger
link ExplosionHelper Position PhysicsExplosion Position
link ExplosionHelper TimeModifier PhysicsExplosion TimeModifier
link ExplosionHelper Speed PhysicsExplosion Speed
link ExplosionHelper GasIgnitionRate PhysicsExplosion GasIgnitionRate
link ExplosionHelper NumGasParticles PhysicsExplosion NumGasParticles
link ExplosionHelper NumFireParticles PhysicsExplosion NumFireParticles
link ExplosionHelper Gravity PhysicsExplosion Gravity
link ExplosionHelper SearchRadius PhysicsExplosion SearchRadius
link ExplosionHelper RestDensity PhysicsExplosion RestDensity
link ExplosionHelper PressureK PhysicsExplosion PressureK
link ExplosionHelper NearPressureK PhysicsExplosion NearPressureK
link ExplosionHelper TemperatureDiffusion PhysicsExplosion TemperatureDiffusion
link ExplosionHelper VisciousAlpha PhysicsExplosion VisciousAlpha
link ExplosionHelper VisciousBeta PhysicsExplosion VisciousBeta


// 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


// Create physics entity

subcreate Physics PhysicsEntity name Box

set Box AddMaterial Data\PhysicsMaterials\Stone.txt

set Box AddShapePos 0.3 0.0 0.0
set Box AddBox 0.1 5.0 5.0

//set Box AddShapePos 0.0 -0.2 0.0
//set Box AddBox 10.0 0.1 10.0

set Box Enable true



