<?xml version="1.0" ?>

<Scene name="DragonKnobs" type="XMLMinigame" hide_ui="$dragon_knobs_solved == 0">

	<Audio source="Chapter4"/>

	<!-- Scene layers & anims -->
	<if t="not $dragon_knobs_solved">
		<if t="$dragon_knobs_ani_knob_01 == -1">
			<Object type="ImageBox" image="scene_button_01" x="546" y="236">
				<Animator type="AlphaChanger" amplitude="-255" speed="2"/>
			</Object>
			<Object type="ImageBox" image="add_greenlight_01" x="594" y="160">
				<Animator type="AlphaChanger" amplitude="-255" speed="0.5"/>
			</Object>

			<Object type="ImageBox" image="scene_button_02" x="572" y="298">
				<Animator type="AlphaChanger" amplitude="-255" speed="2"/>
			</Object>
			<Object type="ImageBox" image="add_greenlight_02" x="627" y="218">
				<Animator type="AlphaChanger" amplitude="-255" speed="0.4"/>
			</Object>

			<Object type="ImageBox" image="scene_button_03" x="594" y="374">
				<Animator type="AlphaChanger" amplitude="-255" speed="2"/>
			</Object>
			<Object type="ImageBox" image="add_greenlight_03" x="663" y="280">
				<Animator type="AlphaChanger" amplitude="-255" speed="0.3"/>
			</Object>

			<Object type="ImageBox" image="scene_button_04" x="479" y="385">
				<Animator type="AlphaChanger" amplitude="-255" speed="2"/>
			</Object>
			<Object type="ImageBox" image="add_greenlight_04" x="705" y="355">
				<Animator type="AlphaChanger" amplitude="-255" speed="0.2"/>
			</Object>

			<Object type="ImageBox" image="scene_button_05" x="360" y="397">
				<Animator type="AlphaChanger" amplitude="-255" speed="2"/>
			</Object>
			<Object type="ImageBox" image="add_greenlight_05" x="188" y="414">
				<Animator type="AlphaChanger" amplitude="-255" speed="0.5"/>
			</Object>

			<Object type="ImageBox" image="scene_button_06" x="350" y="317">
				<Animator type="AlphaChanger" amplitude="-255" speed="2"/>
			</Object>
			<Object type="ImageBox" image="add_greenlight_06" x="191" y="331">
				<Animator type="AlphaChanger" amplitude="-255" speed="0.4"/>
			</Object>

			<Object type="ImageBox" image="scene_button_07" x="341" y="251">
				<Animator type="AlphaChanger" amplitude="-255" speed="2"/>
			</Object>
			<Object type="ImageBox" image="add_greenlight_07" x="190" y="260">
				<Animator type="AlphaChanger" amplitude="-255" speed="0.3"/>
			</Object>

			<Object type="ImageBox" image="scene_button_08" x="442" y="245">
				<Animator type="AlphaChanger" amplitude="-255" speed="2"/>
			</Object>
			<Object type="ImageBox" image="add_greenlight_08" x="190" y="199">
				<Animator type="AlphaChanger" amplitude="-255" speed="0.2"/>
			</Object>

			<Animator type="DelayedAction" time="5">
				<Action type="UnlockScene"/>
				<Action type="SetVar" var="dragon_knobs_solved" value="1" reset="1"/>
			</Animator>
		<else>
			<if t="$dragon_knobs_light_01"> <Object type="ImageBox" image="add_greenlight_01" x="594" y="160" /> </if>
			<if t="$dragon_knobs_light_02"> <Object type="ImageBox" image="add_greenlight_02" x="627" y="218" /> </if>
			<if t="$dragon_knobs_light_03"> <Object type="ImageBox" image="add_greenlight_03" x="663" y="280" /> </if>
			<if t="$dragon_knobs_light_04"> <Object type="ImageBox" image="add_greenlight_04" x="705" y="355" /> </if>
			<if t="$dragon_knobs_light_05"> <Object type="ImageBox" image="add_greenlight_05" x="188" y="414" /> </if>
			<if t="$dragon_knobs_light_06"> <Object type="ImageBox" image="add_greenlight_06" x="191" y="331" /> </if>
			<if t="$dragon_knobs_light_07"> <Object type="ImageBox" image="add_greenlight_07" x="190" y="260" /> </if>
			<if t="$dragon_knobs_light_08"> <Object type="ImageBox" image="add_greenlight_08" x="190" y="199" /> </if>
		</else>
		</if>

		<if t="not $dragon_knobs_ani_knob_01 == -1">
			<if t="$dragon_knobs_ani_knob_01 == 0">
				<Object type="ImageBox" image="scene_button_01" x="546" y="236" />
			<else>
				<Object type="ImageBox" image="scene_button_01" x="546" y="229" />
				<Animator type="DelayedAction" time="0.3"><Action type="ResetScene"/></Animator>
				<Action type="SetVar" var="dragon_knobs_ani_knob_01" value="0" reset="0"/>
			</else>
			</if>

			<if t="$dragon_knobs_ani_knob_02 == 0">
				<Object type="ImageBox" image="scene_button_02" x="572" y="298" />
			<else>
				<Object type="ImageBox" image="scene_button_02" x="572" y="291" />
				<Animator type="DelayedAction" time="0.3"><Action type="ResetScene"/></Animator>
				<Action type="SetVar" var="dragon_knobs_ani_knob_02" value="0" reset="0"/>
			</else>
			</if>

			<if t="$dragon_knobs_ani_knob_03 == 0">
				<Object type="ImageBox" image="scene_button_03" x="594" y="374" />
			<else>
				<Object type="ImageBox" image="scene_button_03" x="594" y="367" />
				<Animator type="DelayedAction" time="0.3"><Action type="ResetScene"/></Animator>
				<Action type="SetVar" var="dragon_knobs_ani_knob_03" value="0" reset="0"/>
			</else>
			</if>

			<if t="$dragon_knobs_ani_knob_04 == 0">
				<Object type="ImageBox" image="scene_button_04" x="479" y="385" />
			<else>
				<Object type="ImageBox" image="scene_button_04" x="479" y="378" />
				<Animator type="DelayedAction" time="0.3"><Action type="ResetScene"/></Animator>
				<Action type="SetVar" var="dragon_knobs_ani_knob_04" value="0" reset="0"/>
			</else>
			</if>

			<if t="$dragon_knobs_ani_knob_05 == 0">
				<Object type="ImageBox" image="scene_button_05" x="360" y="397" />
			<else>
				<Object type="ImageBox" image="scene_button_05" x="360" y="390" />
				<Animator type="DelayedAction" time="0.3"><Action type="ResetScene"/></Animator>
				<Action type="SetVar" var="dragon_knobs_ani_knob_05" value="0" reset="0"/>
			</else>
			</if>

			<if t="$dragon_knobs_ani_knob_06 == 0">
				<Object type="ImageBox" image="scene_button_06" x="350" y="317" />
			<else>
				<Object type="ImageBox" image="scene_button_06" x="350" y="310" />
				<Animator type="DelayedAction" time="0.3"><Action type="ResetScene"/></Animator>
				<Action type="SetVar" var="dragon_knobs_ani_knob_06" value="0" reset="0"/>
			</else>
			</if>

			<if t="$dragon_knobs_ani_knob_07 == 0">
				<Object type="ImageBox" image="scene_button_07" x="341" y="251" />
			<else>
				<Object type="ImageBox" image="scene_button_07" x="341" y="244" />
				<Animator type="DelayedAction" time="0.3"><Action type="ResetScene"/></Animator>
				<Action type="SetVar" var="dragon_knobs_ani_knob_07" value="0" reset="0"/>
			</else>
			</if>

			<if t="$dragon_knobs_ani_knob_08 == 0">
				<Object type="ImageBox" image="scene_button_08" x="442" y="245" />
			<else>
				<Object type="ImageBox" image="scene_button_08" x="442" y="238" />
				<Animator type="DelayedAction" time="0.3"><Action type="ResetScene"/></Animator>
				<Action type="SetVar" var="dragon_knobs_ani_knob_08" value="0" reset="0"/>
			</else>
			</if>
		</if>
	</if>

	<!-- Actions -->
	<if t="not ($dragon_knobs_light_01 and $dragon_knobs_light_02 and $dragon_knobs_light_03 and $dragon_knobs_light_04 and $dragon_knobs_light_05 and $dragon_knobs_light_06 and $dragon_knobs_light_07 and $dragon_knobs_light_08) and not $dragon_knobs_solved">
		<Action color="736357" type="Composite" cursor="use"> <!-- 1 -->
			<Action type="PlaySound" sound="ui.minigame_generic_2"/>
			<Action type="SetVar" var="dragon_knobs_light_01" value="1" reset="0"/>
			<Action type="SetVar" var="dragon_knobs_ani_knob_01" value="1" reset="1"/>
		</Action>

		<Action color="534741" type="Composite" cursor="use"> <!-- 2 -->
			<Action type="PlaySound" sound="ui.minigame_generic_2"/>
			<Action type="SetVar" var="dragon_knobs_light_02" value="1" reset="0"/>

			<Action type="SetVar" var="dragon_knobs_light_05" value="0" reset="0"/>

			<Action type="SetVar" var="dragon_knobs_ani_knob_02" value="1" reset="1"/>
		</Action>

		<Action color="362F2D" type="Composite" cursor="use"> <!-- 3 -->
			<Action type="PlaySound" sound="ui.minigame_generic_2"/>
			<Action type="SetVar" var="dragon_knobs_light_03" value="1" reset="0"/>
			<Action type="SetVar" var="dragon_knobs_ani_knob_03" value="1" reset="1"/>
		</Action>

		<Action color="C69C6D" type="Composite" cursor="use"> <!-- 4 -->
			<Action type="PlaySound" sound="ui.minigame_generic_2"/>
			<Action type="SetVar" var="dragon_knobs_light_04" value="1" reset="0"/>

			<Action type="SetVar" var="dragon_knobs_light_01" value="0" reset="0"/>
			<Action type="SetVar" var="dragon_knobs_light_02" value="0" reset="0"/>
			<Action type="SetVar" var="dragon_knobs_light_03" value="0" reset="0"/>

			<Action type="SetVar" var="dragon_knobs_ani_knob_04" value="1" reset="1"/>
		</Action>

		<Action color="A67C52" type="Composite" cursor="use"> <!-- 5 -->
			<Action type="PlaySound" sound="ui.minigame_generic_2"/>
			<Action type="SetVar" var="dragon_knobs_light_05" value="1" reset="0"/>
			<Action type="SetVar" var="dragon_knobs_ani_knob_05" value="1" reset="1"/>
		</Action>

		<Action color="8C6239" type="Composite" cursor="use"> <!-- 6 -->
			<Action type="PlaySound" sound="ui.minigame_generic_2"/>
			<Action type="SetVar" var="dragon_knobs_light_06" value="1" reset="0"/>
			<Action type="SetVar" var="dragon_knobs_ani_knob_06" value="1" reset="1"/>
		</Action>

		<Action color="C7B29A" type="Composite" cursor="use"> <!-- 7 -->
			<Action type="PlaySound" sound="ui.minigame_generic_2"/>
			<Action type="SetVar" var="dragon_knobs_light_07" value="1" reset="0"/>

			<Action type="SetVar" var="dragon_knobs_light_02" value="0" reset="0"/>

			<Action type="SetVar" var="dragon_knobs_ani_knob_07" value="1" reset="1"/>
		</Action>

		<Action color="998675" type="Composite" cursor="use"> <!-- 8 -->
			<Action type="PlaySound" sound="ui.minigame_generic_2"/>
			<Action type="SetVar" var="dragon_knobs_light_08" value="1" reset="0"/>

			<Action type="SetVar" var="dragon_knobs_light_04" value="0" reset="0"/>

			<Action type="SetVar" var="dragon_knobs_light_05" value="0" reset="0"/>
			<Action type="SetVar" var="dragon_knobs_light_06" value="0" reset="0"/>
			<Action type="SetVar" var="dragon_knobs_light_07" value="0" reset="0"/>

			<Action type="SetVar" var="dragon_knobs_ani_knob_08" value="1" reset="1"/>
		</Action>
	<else>
		<if t="not $dragon_knobs_solved"> <!-- on solved -->
			<Action type="SetVar" var="minigame_solved" value="1" reset="0"/>
		</if>
	</else>
	</if>

	<Action name="DragonKnobs_OnSuccess" type="Composite">
		<Action type="LockScene"/>
		<Action type="SetVar" var="dragon_knobs_ani_knob_01" value="-1" reset="1"/>
	</Action>

	<if t="$dragon_knobs_solved and not $got_dragon_figure">
		<Action color="FF0000" type="SwitchScene" scene="cemetery.DragonJigsaw" cursor="look"/>
		<Action color="736357" type="SwitchScene" scene="cemetery.DragonJigsaw" cursor="look"/>
		<Action color="534741" type="SwitchScene" scene="cemetery.DragonJigsaw" cursor="look"/>
		<Action color="362F2D" type="SwitchScene" scene="cemetery.DragonJigsaw" cursor="look"/>
		<Action color="C69C6D" type="SwitchScene" scene="cemetery.DragonJigsaw" cursor="look"/>
		<Action color="A67C52" type="SwitchScene" scene="cemetery.DragonJigsaw" cursor="look"/>
		<Action color="8C6239" type="SwitchScene" scene="cemetery.DragonJigsaw" cursor="look"/>
		<Action color="C7B29A" type="SwitchScene" scene="cemetery.DragonJigsaw" cursor="look"/>
		<Action color="998675" type="SwitchScene" scene="cemetery.DragonJigsaw" cursor="look"/>
	</if>

	<Action color="FFFF00" type="SwitchScene" scene="cemetery.CryptOutside" cursor="walk"/>


	<!-- Foreground -->
	<if t="not $dragon_knobs_solved">
		<if t="$dragon_knobs_ani_knob_01 == -1">
			<Object type="ImageBox" image="scene_dragon_layer" alpha="0" x="280" y="217">
				<Animator type="AlphaChanger" amplitude="255" speed="1"/>
			</Object>
		</if>
	<else>
		<Object type="ImageBox" image="scene_dragon_layer" alpha="255" x="280" y="217"/>
	</else>
	</if>

</Scene>