<scene name="Room3" numVictoryConditions="1">
	<inventory>
		<object name="Drill" memberName="HUD_drill" acquired="0" visible="1">
			<onUseObject name="Charger">
				<action target="Scene" name="RemoveFromInventory" param="Drill"/>
				<action target="Scene" name="RemoveFromInventory" param="Charger"/>
				<action target="Scene" name="AddToInventory" param="DrillAndCharger"/>				
				<action target="Scene" name="PlaySound" param="attach_battery"/>
				<action target="Scene" name="ShowDialog" param="drill_and_charger"/>
			</onUseObject>
		</object>
		<object name="Charger" memberName="HUD_charger" acquired="0" visible="1">
			<onUseObject name="Drill">
				<action target="Scene" name="RemoveFromInventory" param="Drill"/>
				<action target="Scene" name="RemoveFromInventory" param="Charger"/>
				<action target="Scene" name="AddToInventory" param="DrillAndCharger"/>				
				<action target="Scene" name="PlaySound" param="attach_battery"/>
				<action target="Scene" name="ShowDialog" param="drill_and_charger"/>
			</onUseObject>		
		</object>
		<object name="Lamp" memberName="HUD_lamp" acquired="0" visible="1"/>
		<object name="DrillAndCharger" memberName="HUD_drillAndCharger" acquired="0" visible="0"/>
		<object name="ChargedDrill" memberName="HUD_drill" acquired="0" visible="0"/>
	</inventory>
	
	<finalStates>
		<finalState objName="Drill" state="disabled"/>
		<finalState objName="Charger" state="disabled"/>
		<finalState objName="PlugArea" state="nothingPluggedIn"/>
		<finalState objName="Light" state="acquired"/>
		<finalState objName="Bridge" state="complete"/>
	</finalStates>
	
	<animations>
		<animation name="LightAnim" type="loop">
			<frames>
				<frame memberName="light1_anim" frameDelay="360" blend="100"/>
				<frame memberName="light2_anim" frameDelay="30" blend="0"/>
				<frame memberName="light3_anim" frameDelay="180" blend="70"/>
				<frame memberName="light4_anim" frameDelay="3" blend="0"/>
				<frame memberName="light5_anim" frameDelay="20" blend="60"/>
			</frames>
		</animation>
	</animations>
	
	<zoomWindows>
	  <zoomWindow name="PlugAreaWindow" file="ZoomWindows\Room3_PlugAreaWindow.dir" x="560" y="390" visible="0"/>
	  <zoomWindow name="BridgeWindow" file="ZoomWindows\Room3_BridgeWindow.dir" x="230" y="360" visible="0"/>
	</zoomWindows>
	
	<objects>
		<object name="Drill">
			<clickStrategy type="alpha" layer="Drill"/>
			<states>
				<state name="clickable">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="Drill"/>						
						<action target="Scene" name="PlaySound" param="indoor_big"/>
						<action target="Scene" name="StartAnimation" param="LightAnim"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>

					<onClick>
						<action target="Scene" name="AddToInventory" param="Drill"/>
						<action target="Scene" name="PlaySound" param="pickup_driller"/>
						<action target="Drill" name="SetState" param="disabled"/>		
						<action target="Scene" name="ShowDialog" param="drill_click"/>
					</onClick>
				</state>

				<state name="disabled">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="Drill"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Charger">
			<clickStrategy type="alpha" layer="Charger"/>
			<states>
				<state name="clickable">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="Charger"/>					
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>

					<onClick>
						<action target="Scene" name="AddToInventory" param="Charger"/>
						<action target="Scene" name="PlaySound" param="pickup_battery"/>
						<action target="Charger" name="SetState" param="disabled"/>						
						<action target="Scene" name="ShowDialog" param="charger_click"/>
					</onClick>
				</state>

				<state name="disabled">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="Charger"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="PlugArea">
			<clickStrategy type="alpha" layer="ChargerPlugged"/>
			<states>
				<state name="idle">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="ChargerPlugged"/>
						<action target="Scene" name="HideLayer" param="DrillPlugged"/>
					</onStateEnter>					
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>

					<onClick>
						<action target="Scene" name="OpenWindow" param="PlugAreaWindow"/>
						<action target="Scene" name="ShowDialog" param="live_wires"/>
					</onClick>
					
					<onUseObject name="Charger">
						<action target="Scene" name="OpenWindow" param="PlugAreaWindow"/>
						<action target="Scene" name="RemoveFromInventory" param="Charger"/>
						<action target="PlugArea" name="SetState" param="withCharger"/>
					</onUseObject>
					
					<onUseObject name="DrillAndCharger">
						<action target="Scene" name="OpenWindow" param="PlugAreaWindow"/>
						<action target="Scene" name="RemoveFromInventory" param="DrillAndCharger"/>
						<action target="PlugArea" name="SetState" param="withChargerAndDrill"/>
						<action target="Scene" name="PlaySound" param="charging_battery_with_wire"/>
					</onUseObject>
				</state>

				<state name="withCharger">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="ChargerPlugged"/>
						<action target="Scene" name="HideLayer" param="DrillPlugged"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="PlugAreaWindow"/>
					</onClick>
					
					<onUseObject name="Drill">
						<action target="Scene" name="OpenWindow" param="PlugAreaWindow"/>
						<action target="Scene" name="RemoveFromInventory" param="Drill"/>
						<action target="PlugArea" name="SetState" param="withChargerAndDrill"/>
						<action target="Scene" name="PlaySound" param="charging_battery_with_wire"/>
					</onUseObject>
				</state>
				
				<state name="withChargerAndDrill">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="ChargerPlugged"/>
						<action target="Scene" name="ShowLayer" param="DrillPlugged"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="PlugAreaWindow"/>
					</onClick>
				</state>
				
				<state name="nothingPluggedIn">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="ChargerPlugged"/>
						<action target="Scene" name="HideLayer" param="DrillPlugged"/>
						<action target="Scene" name="CloseWindow" param="PlugAreaWindow"/>
					</onStateEnter>
				</state>
			</states>			
		</object>
		
		<object name="Light">
			<clickStrategy type="rect" left="615" top="78" right="694" bottom="253"/>			
			<states>
				<state name="attached">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="Light"/>						
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="interactive"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="ShowDialog" param="light_click"/>
					</onClick>
					
					<onUseObject name="Drill">
						<action target="Scene" name="ShowDialog" param="no_batteries"/>						
					</onUseObject>					
					
					<onUseObject name="ChargedDrill">
						<action target="Scene" name="RemoveFromInventory" param="ChargedDrill"/>
						<action target="Scene" name="PlaySound" param="use_the_charged_driller"/>
						<action target="Light" name="SendEvent" param="lightRemoved" delay="260"/>
					</onUseObject>
					
					<onEvent name="lightRemoved">
						<action target="Scene" name="AddToInventory" param="Lamp"/>
						<action target="Light" name="SetState" param="acquired"/>						
					</onEvent>
				</state>
				
				<state name="acquired">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="Light"/>						
					</onStateEnter>
				</state>
			</states>
		</object>
		
		<object name="Bridge">
			<clickStrategy type="alpha" layer="Bridge"/>
			<states>
				<state name="idle">
					<onStateEnter>
						<action target="Scene" name="HideLayer" param="Bridge"/>
					</onStateEnter>
					
					<onMouseOver>
						<action target="Scene" name="SetCursor" param="zoom"/>
					</onMouseOver>
					
					<onClick>
						<action target="Scene" name="OpenWindow" param="BridgeWindow"/>
						<action target="Scene" name="ShowDialog" param="cross_gap"/>
					</onClick>
					
					<onUseObject name="Lamp">						
						<action target="Scene" name="RemoveFromInventory" param="Lamp"/>
						<action target="Bridge" name="SetState" param="complete"/>
						<action target="Scene" name="CloseWindow" param="BridgeWindow" delay="90"/>
						<action target="Scene" name="RegisterVictoryCondition" param="" delay="180"/>
						<action target="Scene" name="PlaySound" param="hood_close"/>
					</onUseObject>
				</state>
				
				<state name="complete">
					<onStateEnter>
						<action target="Scene" name="ShowLayer" param="Bridge"/>
					</onStateEnter>
				</state>
			</states>
		</object>
		
	</objects>
</scene>
