<scene name="Room12" numVictoryConditions="1">
	<inventory>
		<object name="Glass" memberName="HUD_glass" acquired="0" visible="1"/>
		<object name="Lever" memberName="HUD_lever" acquired="0" visible="1"/>
		<object name="Glue" memberName="HUD_glue" acquired="0" visible="1"/>
		<object name="Key" memberName="HUD_key" acquired="0" visible="1"/>
	</inventory>
	
	<finalStates>
		<finalState objName="Shark" state="animating"/>
		<finalState objName="Glass" state="acquired"/>
		<finalState objName="Lever" state="acquired"/>
		<finalState objName="Toolbox" state="noGlue"/>
		<finalState objName="Aquarium" state="noKey"/>
		<finalState objName="Valve" state="leverOn"/>
		<finalState objName="Door" state="waitForClick"/>
	</finalStates>
	
	<animations>
		<animation name="SharkAnim" type="loop">
			<frames>
				<frame memberName="shark1_anim" frameDelay="6"/>
				<frame memberName="shark2_anim" frameDelay="6"/>
				<frame memberName="shark3_anim" frameDelay="6"/>
				<frame memberName="shark4_anim" frameDelay="6"/>
				<frame memberName="shark5_anim" frameDelay="6"/>
				<frame memberName="shark6_anim" frameDelay="6"/>
				<frame memberName="shark7_anim" frameDelay="6"/>
				<frame memberName="shark8_anim" frameDelay="6"/>
				<frame memberName="shark9_anim" frameDelay="6"/>
				<frame memberName="shark10_anim" frameDelay="6"/>
				<frame memberName="shark11_anim" frameDelay="6"/>
				<frame memberName="shark10_anim" frameDelay="6"/>
				<frame memberName="shark9_anim" frameDelay="6"/>
				<frame memberName="shark8_anim" frameDelay="6"/>
				<frame memberName="shark7_anim" frameDelay="6"/>
				<frame memberName="shark6_anim" frameDelay="6"/>
				<frame memberName="shark5_anim" frameDelay="6"/>
				<frame memberName="shark4_anim" frameDelay="6"/>
				<frame memberName="shark3_anim" frameDelay="6"/>
				<frame memberName="shark2_anim" frameDelay="6"/>				
			</frames>
		</animation>
		
		<animation name="WaterAnim" type="loop" xpos="49" ypos="352">
			<frames>
				<frame memberName="water1_anim" frameDelay="6"/>
				<frame memberName="water2_anim" frameDelay="6"/>
				<frame memberName="water3_anim" frameDelay="6"/>
				<frame memberName="water4_anim" frameDelay="6"/>
				<frame memberName="water5_anim" frameDelay="6"/>
				<frame memberName="water6_anim" frameDelay="6"/>
				<frame memberName="water7_anim" frameDelay="6"/>
				<frame memberName="water8_anim" frameDelay="6"/>
				<frame memberName="water9_anim" frameDelay="6"/>
				<frame memberName="water10_anim" frameDelay="6"/>
				<frame memberName="water11_anim" frameDelay="6"/>
				<frame memberName="water12_anim" frameDelay="6"/>
				<frame memberName="water13_anim" frameDelay="6"/>
				<frame memberName="water14_anim" frameDelay="6"/>
				<frame memberName="water15_anim" frameDelay="6"/>
				<frame memberName="water16_anim" frameDelay="6"/>
				<frame memberName="water17_anim" frameDelay="6"/>
				<frame memberName="water18_anim" frameDelay="6"/>
				<frame memberName="water19_anim" frameDelay="6"/>
			</frames>
		</animation>
	</animations>
	
	<zoomWindows>
		<zoomWindow name="ToolboxWindow" file="ZoomWindows\Room12_ToolboxWindow.dir" x="610" y="462" visible="0"/>
		<zoomWindow name="AquariumWindow" file="ZoomWindows\Room12_AquariumWindow.dir" x="155" y="217" visible="0"/>
		<zoomWindow name="ValveWindow" file="ZoomWindows\Room12_ValveWindow.dir" x="150" y="462" visible="0"/>
	</zoomWindows>
	
	<objects>
		<object name="Shark">
			<states>
				<state name="animating">
					<onStateEnter><action target="Scene" name="StartAnimation" param="SharkAnim"/></onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Glass">
			<clickStrategy type="alpha" layer="Glass"/>
			<states>
				<state name="onGround">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="Glass"/>
						<action target="Scene" name="PlaySound" param="indoor_small"/>
						<action target="Scene" name="PlaySound" param="window_rain"/>
						<action target="Scene" name="PlaySound" param="thunder_rain"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
					
					<onClick>
						<action target="Glass" name="SetState" param="acquired"/>
						<action target="Scene" name="AddToInventory" param="Glass"/>
						<action target="Scene" name="PlaySound" param="Item_Pickup_Glass_small"/>
					</onClick>					
				</state>
				
				<state name="acquired">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="Glass"/>						
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Lever">
			<clickStrategy type="alpha" layer="Lever"/>
			<states>
				<state name="onGround">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="Lever"/>
					</onStateEnter>					
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
										
					<onClick>
						<action target="Lever" name="SetState" param="acquired"/>
						<action target="Scene" name="AddToInventory" param="Lever"/>
						<action target="Scene" name="PlaySound" param="Item_Pickup_Metal_small"/>
					</onClick>					
				</state>
				
				<state name="acquired">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="Lever"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Toolbox">
			<clickStrategy type="alpha" layer="Toolbox"/>
			<states>
				<state name="withGlue">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="Toolbox"/>
					</onStateEnter>	
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="ToolboxWindow"/>
					</onClick>
				</state>
				
				<state name="noGlue">
					<onStateEnter>
						<action target="Scene" name="CloseWindow" param="ToolboxWindow"/>
						<action target="Scene" name="ShowLayer" param="Toolbox"/>
						<action target="Scene" name="PlaySound" param="take_glue_from_toolbox"/>
					</onStateEnter>
				</state>
			</states>
		</object>

		<object name="Aquarium">
			<clickStrategy type="rect" left="0" top="302" right="215" bottom="442"/>			
			<states>
				<state name="withHole">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="AquariumWithGlass"/>
						<action target="Scene" name="HideLayer" param="AquariumWithGlue"/>
						<action target="Scene" name="HideLayer" param="AquariumFull"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="AquariumWindow"/>
						<action target="Scene" name="ShowDialog" param="aquarium_click"/>
					</onClick>
					
					<onUseObject name="Glass">
						<action target="Scene" name="OpenWindow" param="AquariumWindow"/>
						<action target="Scene" name="RemoveFromInventory" param="Glass"/>
						<action target="Aquarium" name="SetState" param="withGlass"/>
						<action target="Scene" name="PlaySound" param="put_glass_shard_in_hole"/>
					</onUseObject>
				</state>
				
				<state name="withGlass">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="AquariumWithGlass"/>
						<action target="Scene" name="HideLayer" param="AquariumWithGlue"/>
						<action target="Scene" name="HideLayer" param="AquariumFull"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="AquariumWindow"/>
					</onClick>
					
					<onUseObject name="Glue">
						<action target="Scene" name="OpenWindow" param="AquariumWindow"/>
						<action target="Scene" name="RemoveFromInventory" param="Glue"/>
						<action target="Aquarium" name="SetState" param="withGlue"/>
						<action target="Valve" name="SendEvent" param="holePatched"/>
					</onUseObject>
				</state>
				
				<state name="withGlue">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="AquariumWithGlass"/>
						<action target="Scene" name="ShowLayer" param="AquariumWithGlue"/>
						<action target="Scene" name="HideLayer" param="AquariumFull"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="AquariumWindow"/>
					</onClick>
				</state>
								
				<state name="withWater">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="AquariumWithGlass" delay="120"/>
						<action target="Scene" name="HideLayer" param="AquariumWithGlue" delay="120"/>
						<action target="Scene" name="ShowLayer" param="AquariumFull" delay="120"/>
						<action target="Scene" name="StartAnimation" param="WaterAnim"/>
						<action target="Scene" name="StopAnimation" param="WaterAnim" delay="120"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="AquariumWindow"/>
					</onClick>
				</state>
				
				<state name="noKey">
					<onStateEnter>
						<action target="Scene" name="CloseWindow" param="AquariumWindow" delay="60"/>
						<action target="Scene" name="HideLayer" param="AquariumWithGlass"/>
						<action target="Scene" name="HideLayer" param="AquariumWithGlue"/>
						<action target="Scene" name="ShowLayer" param="AquariumFull"/>
						<action target="Scene" name="PlaySound" param="take_the_key2"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Valve">
			<clickStrategy type="alpha" layer="ValveOn"/>
			<states>
				<state name="noLever_holeNotPatched">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="ValveOff"/>
						<action target="Scene" name="HideLayer" param="ValveOn"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="ValveWindow"/>
					</onClick>
					
					<onUseObject name="Lever">
						<action target="Scene" name="OpenWindow" param="ValveWindow"/>
						<action target="Scene" name="RemoveFromInventory" param="Lever"/>
						<action target="Valve" name="SetState" param="withLever_holeNotPatched"/>
						<action target="Scene" name="PlaySound" param="use_lever_on_valve"/>
					</onUseObject>
					
					<onEvent name="holePatched">
						<action target="Valve" name="SetState" param="noLever"/>
					</onEvent>
				</state>
				
				<state name="withLever_holeNotPatched">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="ValveOff"/>
						<action target="Scene" name="HideLayer" param="ValveOn"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="ValveWindow"/>
					</onClick>
					
					<onEvent name="holePatched">
						<action target="Valve" name="SetState" param="withLever"/>
					</onEvent>
					
					<onEvent name="useLever">
						<action target="Scene" name="ShowDialog" param="hole_in_aquarium"/>
					</onEvent>
				</state>
				
				<state name="noLever">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="ValveOff"/>
						<action target="Scene" name="HideLayer" param="ValveOn"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="ValveWindow"/>
					</onClick>
					
					<onUseObject name="Lever">
						<action target="Scene" name="OpenWindow" param="ValveWindow"/>
						<action target="Scene" name="RemoveFromInventory" param="Lever"/>
						<action target="Valve" name="SetState" param="withLever"/>
					</onUseObject>					
				</state>
				
				<state name="withLever">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="ValveOff"/>
						<action target="Scene" name="HideLayer" param="ValveOn"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="ValveWindow"/>
					</onClick>
					
					<onEvent name="useLever">
						<action target="Valve" name="SetState" param="leverOn"/>
						<action target="Aquarium" name="SetState" param="withWater"/>
						<action target="Scene" name="PlaySound" param="water_running_into_aqua"/>
					</onEvent>
				</state>
				
				<state name="leverOn">
					<onStateEnter>
						<action target="Scene" name="CloseWindow" param="ValveWindow" delay="60"/>
						<action target="Scene" name="HideLayer" param="ValveOff"/>
						<action target="Scene" name="ShowLayer" param="ValveOn"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Door">
			<clickStrategy type="rect" left="130" top="175" right="200" bottom="300"/>
			<states>
				<state name="waitForKey">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="OpenDoor"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="noExit"/>
					</onMouseOver>					
					
					<onUseObject name="Key">
						<action target="Scene" name="RemoveFromInventory" param="Key"/>
						<action target="Scene" name="PlaySound" param="use_the_key"/>
						<action target="Door" name="SetState" param="waitForClick"/>
					</onUseObject>
				</state>
				
				<state name="waitForClick">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="OpenDoor"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="exit"/>
					</onMouseOver>					
					
					<onClick>
						<action target="Scene" name="RegisterVictoryCondition" param=""/>						
					</onClick>
				</state>
			</states>
		</object>
	</objects>
	
</scene>
	
	