local monocle = require("#monocle")

local vector2 = require("#microsoft.xna.framework.vector2")

function onBegin(room)
  disableMovement()
  disableRetry()
  player.ForceCameraUpdate = true
  wait(1)
  walkTo(8020, false, 0.5, false)
  coroutine.yield(getLevel():ZoomTo(vector2(160, 120), 1.6, 3))
  say("Ch3_FreezeOver6_Donk")
  playSound("event:/Donk_OrionsBelt/sfx_FreezeOver", player.Position)
  setFlag("donk_FreezeOver6_A", true)
  wait(0.5)
  setFlag("donk_FreezeOver6_B", true)
  wait(0.5)
  say("Ch3_FreezeOver6_Donk2")
  walkTo(8054, false, 1, false)
  say("Ch3_FreezeOver6_Donk3")
  playSound("event:/Donk_OrionsBelt/sfx_FreezeOverFinal", player.Position)
  setFlag("donk_FreezeOver6_C", true)
  wait(0.5)
  setFlag("donk_FreezeOver6_D", true)
  wait(0.5)
  setFlag("donk_FreezeOver6_E", true)
  wait(0.5)
  setFlag("donk_FreezeOver6_F", true)
  wait(0.5)
  setFlag("donk_FreezeOver6_G", true)
  wait(0.5)
  say("Ch3_FreezeOver6_Donk4")
  wait(1.5)
  coroutine.yield(engine.Scene:ZoomBack(1))
  enableMovement()
end

function onEnd(room, wasSkipped)
  enableMovement()
  player.DummyAutoAnimate = true
  player.ForceCameraUpdate = true
  setFlag("donk_FreezeOver6_A", true)
  setFlag("donk_FreezeOver6_B", true)
  setFlag("donk_FreezeOver6_C", true)
  setFlag("donk_FreezeOver6_D", true)
  setFlag("donk_FreezeOver6_E", true)
  setFlag("donk_FreezeOver6_F", true)
  setFlag("donk_FreezeOver6_G", true)
  getLevel():ResetZoom()
  enableMovement()
end