<scene name="Room15" numVictoryConditions="1">
	<inventory>
		<object name="Conductor" memberName="HUD_conductor" acquired="0" visible="1"/>
		<object name="Screwdriver" memberName="HUD_screwdriver" acquired="0" visible="1"/>
		<object name="WindowKnob" memberName="HUD_windowKnob" acquired="0" visible="1"/>
		<object name="Brick" memberName="HUD_brick" acquired="0" visible="1"/>
	</inventory>
	
	<finalStates>
		<finalState objName="Conductor" state="acquired"/>
		<finalState objName="Platform" state="up"/>
		<finalState objName="Toolbox" state="noScrewdriver"/>
		<finalState objName="WindowKnob" state="acquired"/>
		<finalState objName="Brick" state="acquired"/>
		<finalState objName="Window" state="open"/>
	</finalStates>

	<animations>
		<animation name="RopeAnim" type="loop" xpos="447" ypos="212">
			<frames>
				<frame memberName="rope1_anim" frameDelay="4"/>
				<frame memberName="rope2_anim" frameDelay="4"/>
				<frame memberName="rope3_anim" frameDelay="4"/>
				<frame memberName="rope4_anim" frameDelay="4"/>
				<frame memberName="rope5_anim" frameDelay="4"/>
				<frame memberName="rope6_anim" frameDelay="4"/>
				<frame memberName="rope7_anim" frameDelay="4"/>
				<frame memberName="rope8_anim" frameDelay="4"/>
				<frame memberName="rope9_anim" frameDelay="4"/>
				<frame memberName="rope10_anim" frameDelay="4"/>
				<frame memberName="rope11_anim" frameDelay="4"/>
				<frame memberName="rope12_anim" frameDelay="4"/>
				<frame memberName="rope13_anim" frameDelay="4"/>
				<frame memberName="rope14_anim" frameDelay="4"/>
				<frame memberName="rope15_anim" frameDelay="4"/>
				<frame memberName="rope16_anim" frameDelay="4"/>
				<frame memberName="rope17_anim" frameDelay="4"/>
				<frame memberName="rope18_anim" frameDelay="4"/>
				<frame memberName="rope19_anim" frameDelay="4"/>
				<frame memberName="rope20_anim" frameDelay="4"/>
				<frame memberName="rope21_anim" frameDelay="4"/>
				<frame memberName="rope22_anim" frameDelay="4"/>
				<frame memberName="rope23_anim" frameDelay="4"/>
				<frame memberName="rope24_anim" frameDelay="4"/>
				<frame memberName="rope25_anim" frameDelay="4"/>
				<frame memberName="rope26_anim" frameDelay="4"/>
				<frame memberName="rope27_anim" frameDelay="4"/>
				<frame memberName="rope28_anim" frameDelay="4"/>
				<frame memberName="rope29_anim" frameDelay="4"/>
				<frame memberName="rope30_anim" frameDelay="4"/>
				<frame memberName="rope31_anim" frameDelay="4"/>
			</frames>
		</animation>
		
		<animation name="Gate_boxClosedAnim" type="loop" xpos="473" ypos="464">
			<frames>
				<frame memberName="gate_boxClosed1_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed2_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed3_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed4_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed5_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed6_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed7_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed8_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed9_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed10_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed11_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed12_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed13_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed14_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed15_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed16_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed17_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed18_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed19_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed20_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed21_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed22_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed23_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed24_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed25_anim" frameDelay="4"/>
				<frame memberName="gate_boxClosed26_anim" frameDelay="4"/>				
			</frames>
		</animation>
		
		<animation name="Gate_boxOpenAnim" type="loop" xpos="473" ypos="464" zpos="27">
			<frames>
				<frame memberName="gate_boxOpen1_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen2_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen3_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen4_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen5_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen6_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen7_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen8_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen9_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen10_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen11_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen12_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen13_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen14_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen15_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen16_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen17_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen18_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen19_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen20_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen21_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen22_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen23_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen24_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen25_anim" frameDelay="4"/>
				<frame memberName="gate_boxOpen26_anim" frameDelay="4"/>
			</frames>
		</animation>
	</animations>	
	
	<zoomWindows>
		<zoomWindow name="ToolboxWindow" file="ZoomWindows\Room15_ToolboxWindow.dir" x="540" y="462" visible="0"/>
		<zoomWindow name="WindowWindow" file="ZoomWindows\Room15_WindowWindow.dir" x="560" y="220" visible="0"/>
	</zoomWindows>
	
	<objects>
		<object name="Conductor">
			<clickStrategy type="alpha" layer="Conductor"/>
			<states>
				<state name="clickable">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="Conductor"/>
						<action target="Scene" name="PlaySound" param="traffic_outdoor"/>
						<action target="Scene" name="PlaySound" param="wind"/>
						<action target="Scene" name="PlaySound" param="thunder_rain"/>
						<action target="Scene" name="PlaySound" param="rain_city"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="AddToInventory" param="Conductor"/>
						<action target="Conductor" name="SetState" param="acquired"/>
						<action target="Scene" name="PlaySound" param="Item_Pickup_Metal_small"/>
					</onClick>
				</state>
				
				<state name="acquired">
					<onStateEnter><action target="Scene" name="ShowLayer" param="Conductor"/></onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Platform">			
			<clickStrategy type="rect" left="450" top="0" right="478" bottom="434"/>
			<states>
				<state name="down">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="PlatformUp"/>
						<action target="Scene" name="StartAnimation" param="RopeAnim"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="platform_click"/>
					</onClick>					
					
					<onUseObject name="Conductor">						
						<action target="Scene" name="RemoveFromInventory" param="Conductor"/>
						<action target="Platform" name="SetState" param="up"/>
						<action target="Toolbox" name="SendEvent" param="platformRaised"/>
						<action target="Brick" name="SendEvent" param="platformRaised"/>
						<action target="Scene" name="PlaySound" param="use_conductor_on_rope"/>
						<action target="Scene" name="PlaySound" param="platform_goes_higher"/>
					</onUseObject>
				</state>
				
				<state name="up">
					<onStateEnter>
						<action target="Scene" name="StopAnimation" param="RopeAnim"/>
						<action target="Scene" name="ShowLayer" param="PlatformUp"/>
					</onStateEnter>
				</state>			
			</states>
		</object>
		
		<object name="Toolbox">
			<clickStrategy type="alpha" layer="Toolbox"/>
			<states>
				<state name="unreachable">
					<onStateEnter><action target="Scene" name="HideLayer" param="Toolbox"/></onStateEnter>
					<onEvent name="platformRaised">
						<action target="Toolbox" name="SetState" param="reachable"/>
					</onEvent>
				</state>
				
				<state name="reachable">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="Toolbox"/>
						<action target="Scene" name="StartAnimation" param="Gate_boxClosedAnim"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="ToolboxWindow"/>
						<action target="Toolbox" name="SetState" param="open"/>
					</onClick>
				</state>
				
				<state name="open">
					<onStateEnter><action target="Scene" name="ShowLayer" param="Toolbox"/></onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick><action target="Scene" name="OpenWindow" param="ToolboxWindow"/></onClick>
				</state>
				
				<state name="noScrewdriver">
					<onStateEnter>
						<action target="Scene" name="CloseWindow" param="ToolboxWindow" delay="60"/>
						<action target="Scene" name="ShowLayer" param="Toolbox"/>
						<action target="Scene" name="PlaySound" param="take_screwdriver_from_toolbox"/>
						<action target="Scene" name="StopAnimation" param="Gate_boxClosedAnim"/>
						<action target="Scene" name="StartAnimation" param="Gate_boxOpenAnim"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="WindowKnob">
			<clickStrategy type="alpha" layer="WindowKnob"/>
			<states>
				<state name="onWindow">
					<onStateEnter><action target="Scene" name="HideLayer" param="WindowKnob"/></onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="windowKnob_click"/>
					</onClick>
					
					<onUseObject name="Screwdriver">
						<action target="Scene" name="RemoveFromInventory" param="Screwdriver"/>
						<action target="Scene" name="AddToInventory" param="WindowKnob"/>
						<action target="WindowKnob" name="SetState" param="acquired"/>
						<action target="Scene" name="PlaySound" param="unscrew_knob"/>
					</onUseObject>
				</state>
				
				<state name="acquired">
					<onStateEnter><action target="Scene" name="ShowLayer" param="WindowKnob"/></onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Brick">
			<clickStrategy type="alpha" layer="Brick"/>
			<states>
				<state name="unreachable">
					<onStateEnter><action target="Scene" name="HideLayer" param="Brick"/></onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="click_brick"/>
					</onClick>
					
					<onEvent name="platformRaised">
						<action target="Brick" name="SetState" param="clickable"/>
					</onEvent>					
				</state>
				
				<state name="clickable">
					<onStateEnter><action target="Scene" name="HideLayer" param="Brick"/></onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="AddToInventory" param="Brick"/>
						<action target="Brick" name="SetState" param="acquired"/>
						<action target="Scene" name="PlaySound" param="take_the_brick"/>
					</onClick>
				</state>
				
				<state name="acquired">
					<onStateEnter><action target="Scene" name="ShowLayer" param="Brick"/></onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Window">
			<clickStrategy type="rect" left="495" top="95" right="625" bottom="200"/>			
			<states>
				<state name="intact">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="BrokenWindow"/>
						<action target="Scene" name="HideLayer" param="OpenWindow"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick><action target="Scene" name="OpenWindow" param="WindowWindow"/></onClick>
					
					<onUseObject name="Brick">
						<action target="Scene" name="RemoveFromInventory" param="Brick"/>
						<action target="Scene" name="OpenWindow" param="WindowWindow"/>
						<action target="Window" name="SetState" param="broken"/>
						<action target="Scene" name="PlaySound" param="use_brick_on_window"/>
					</onUseObject>
					
					<onUseObject name="WindowKnob">
						<action target="Scene" name="ShowDialog" param="use_knob_on_window"/>
					</onUseObject>
				</state>
				
				<state name="broken">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="BrokenWindow"/>
						<action target="Scene" name="HideLayer" param="OpenWindow"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="WindowWindow"/>
						<action target="Scene" name="ShowDialog" param="no_knob"/>
					</onClick>
					
					<onUseObject name="WindowKnob">
						<action target="Scene" name="RemoveFromInventory" param="WindowKnob"/>
						<action target="Scene" name="OpenWindow" param="WindowWindow"/>
						<action target="Window" name="SetState" param="open"/>
						<action target="Scene" name="PlaySound" param="use_window_knob"/>
					</onUseObject>
				</state>
				
				<state name="open">
					<onStateEnter>
						<action target="Scene" name="CloseWindow" param="WindowWindow" delay="90"/>
						<action target="Scene" name="HideLayer" param="BrokenWindow"/>
						<action target="Scene" name="ShowLayer" param="OpenWindow"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="exit"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="RegisterVictoryCondition" param=""/>
					</onClick>
				</state>
			</states>
		</object>
	</objects>
</scene>
