<scene name="Room5" numVictoryConditions="1">
	<inventory>
		<object name="Paper" memberName="HUD_paper" acquired="0" visible="1"/>
		<object name="Glass" memberName="HUD_glass" acquired="0" visible="1"/>	
		<object name="Quill" memberName="HUD_quill" acquired="0" visible="1"/>		
		<object name="Key" memberName="HUD_key" acquired="0" visible="1"/>		
	</inventory>
	
	<finalStates>
		<finalState objName="Showcase" state="noPaper"/>
		<finalState objName="Statue" state="clickable"/>
		<finalState objName="PaperDoor" state="noKey"/>
		<finalState objName="Glass" state="acquired"/>
		<finalState objName="CarpetHole" state="tornNoQuill"/>
		<finalState objName="Lock" state="doNothing"/>
		<finalState objName="OpenDoor" state="open"/>
	</finalStates>
	
	<animations>
		<animation name="RightMapAnim" type="loop" zpos="21">
			<frames>
				<frame memberName="rightMap_anim" frameDelay="360" blend="0"/>
				<frame memberName="rightMap_anim" frameDelay="4" blend="50"/>
				<frame memberName="rightMap_anim" frameDelay="8" blend="20"/>
				<frame memberName="rightMap_anim" frameDelay="4" blend="50"/>								
				<frame memberName="rightMap_anim" frameDelay="180" blend="100"/>
			</frames>
		</animation>
		
		<animation name="LeftMapAnim" type="loop" zpos="21">
			<frames>
				<frame memberName="leftMap_anim" frameDelay="320" blend="0"/>
				<frame memberName="leftMap_anim" frameDelay="4" blend="50"/>
				<frame memberName="leftMap_anim" frameDelay="8" blend="30"/>
				<frame memberName="leftMap_anim" frameDelay="4" blend="50"/>								
				<frame memberName="leftMap_anim" frameDelay="160" blend="100"/>
			</frames>
		</animation>
	</animations>
	
	<zoomWindows>
		<zoomWindow name="ShowcaseWindow" file="ZoomWindows\Room5_ShowcaseWindow.dir" x="650" y="220" visible="0"/>
		<zoomWindow name="CarpetHoleWindow" file="ZoomWindows\Room5_CarpetHoleWindow.dir" x="340" y="445" visible="0"/>
		<zoomWindow name="DoorWindow" file="ZoomWindows\Room5_DoorWindow.dir" x="650" y="462" visible="0"/>
		<zoomWindow name="LockWindow" file="ZoomWindows\Room5_LockWindow.dir" x="630" y="217" visible="0"/>
	</zoomWindows>
	
	<objects>
		<object name="Showcase">
			<clickStrategy type="rect" left="740" top="180" right="800" bottom="360"/>
			<states>
				<state name="withPaper">
					<onStateEnter>
						<action target="Scene" name="PlaySound" param="indoor_small"/>
						<action target="Scene" name="PlaySound" param="circuit2"/>
						<action target="Scene" name="StartAnimation" param="RightMapAnim"/>
						<action target="Scene" name="StartAnimation" param="LeftMapAnim"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="ShowcaseWindow"/>
					</onClick>
				</state>

				<state name="noPaper">
					<onStateEnter>
						<action target="Scene" name="PlaySound" param="take_paper_from_box"/>
						<action target="Scene" name="CloseWindow" param="ShowcaseWindow"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Statue">
			<clickStrategy type="rect" left="320" top="224" right="370" bottom="320"/>
			<states>
				<state name="clickable">
					<onClick><action target="Scene" name="ShowDialog" param="statue"/></onClick>
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
				</state>
			</states>
		</object>
		
		<object name="PaperDoor">
			<clickStrategy type="alpha" layer="PaperDoor"/>
			<states>
				<state name="noPaper">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="PaperDoor"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="DoorWindow"/>
					</onClick>
					
					<onUseObject name="Paper">
						<action target="Scene" name="RemoveFromInventory" param="Paper"/>
						<action target="Scene" name="PlaySound" param="place_paper"/>
						<action target="PaperDoor" name="SetState" param="withPaper"/>
						<action target="Lock" name="SetState" param="withKey"/>
					</onUseObject>
				</state>
				
				<state name="withPaper">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="PaperDoor"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="DoorWindow"/>
					</onClick>
				</state>
				
				<state name="withKey">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="PaperDoor"/>
						<action target="Scene" name="PlaySound" param="pull_the_paper_key"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="DoorWindow"/>
					</onClick>
				</state>
				
				<state name="noKey">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="PaperDoor"/>
						<action target="Scene" name="PlaySound" param="take_the_key1"/>
						<action target="Scene" name="CloseWindow" param="DoorWindow"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Glass">
			<clickStrategy type="alpha" layer="Glass"/>
			<states>
				<state name="onFloor">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="Glass"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="AddToInventory" param="Glass"/>
						<action target="Scene" name="PlaySound" param="Item_Pickup_Glass_small"/>
						<action target="Glass" name="SetState" param="acquired"/>
					</onClick>					
				</state>
				
				<state name="acquired">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="Glass"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="CarpetHole">
			<clickStrategy type="alpha" layer="CarpetHole"/>
			<states>
				<state name="notTorn">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="CarpetHole"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="CarpetHoleWindow"/>
						<action target="Scene" name="ShowDialog" param="under_carpet"/>
					</onClick>
					
					<onUseObject name="Glass">
						<action target="Scene" name="OpenWindow" param="CarpetHoleWindow"/>
						<action target="Scene" name="RemoveFromInventory" param="Glass"/>
						<action target="Scene" name="PlaySound" param="rip_the_carpet"/>
						<action target="CarpetHole" name="SetState" param="torn"/>
					</onUseObject>
				</state>
				
				<state name="torn">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="CarpetHole"/>
					</onStateEnter>					
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="CarpetHoleWindow"/>
					</onClick>						
				</state>
				
				<state name="tornNoQuill">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="CarpetHole"/>
						<action target="Scene" name="PlaySound" param="Item_Pickup_Metal_small"/>
						<action target="Scene" name="CloseWindow" param="CarpetHoleWindow"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Lock">
			<clickStrategy type="rect" left="685" top="300" right="720" bottom="460"/>
			<states>
				<state name="waitForPaper">
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="LockWindow"/>
						<action target="Scene" name="ShowDialog" param="no_key"/>
					</onClick>
					
					<onUseObject name="Quill">
						<action target="Scene" name="ShowDialog" param="no_paper"/>						
					</onUseObject>	
				</state>
				
				<state name="withKey">
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="LockWindow"/>
					</onClick>
					
					<onUseObject name="Quill">
						<action target="Scene" name="CloseWindow" param="LockWindow"/>
						<action target="Lock" name="SetState" param="withoutKey"/>
						<action target="PaperDoor" name="SetState" param="withKey"/>
						<action target="Scene" name="OpenWindow" param="DoorWindow"/>
						<action target="Scene" name="RemoveFromInventory" param="Quill"/>
						<action target="Scene" name="PlaySound" param="use_stylus_on_the_key"/>
					</onUseObject>
				</state>
				
				<state name="withoutKey">
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="LockWindow"/>
					</onClick>
					
					<onUseObject name="Key">						
						<action target="Scene" name="RemoveFromInventory" param="Key"/>
						<action target="Scene" name="PlaySound" param="unlock_the_door"/>
						<action target="OpenDoor" name="SetState" param="open"/>
						<action target="Lock" name="SetState" param="doNothing"/>
						<action target="Scene" name="CloseWindow" param="LockWindow"/>
						<action target="Scene" name="CloseWindow" param="DoorWindow"/>
					</onUseObject>
				</state>
				
				<state name="doNothing">
				</state>
			</states>
		</object>

		<object name="OpenDoor">
			<clickStrategy type="alpha" layer="OpenDoor"/>
			<states>
				<state name="locked">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="OpenDoor"/>
					</onStateEnter>
				</state>
				
				<state name="open">
					<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>
