Scriptname _00E_MQ13b_SC10_ReliefRotationSC extends ObjectReference  

Import Utility

;=====================================================================================
;              							FUNCTIONS                  					 
;=====================================================================================

Function StartRotationLoop()

	if !bInit
		RotationMarker = Self.PlaceAtMe(XMarkerHeading, 1)
		bInit = True
	EndIf
	
	RotationMarker.SetAngle((fAngleX), (fAngleY), (Self.GetAngleZ() + 180))
	Self.TranslateToREF(RotationMarker, RotationSpeedBase, RotationSpeedBase)

EndFunction

;=====================================================================================
;              							EVENTS                  					 
;=====================================================================================

Event OnInit()

	fPosX = Self.GetPositionX()
	fPosY = Self.GetPositionY()
	fPosZ = Self.GetPositionZ()
	
	fAngleX = Self.GetAngleX()
	fAngleY = Self.GetAngleY()
	fAngleZ = Self.GetAngleZ()

	RotationMarker = Self.PlaceAtMe(XMarkerHeading, 1)

EndEvent

Event OnTranslationAlmostComplete()

	If MQ13b.bReliefRotating == True
		StartRotationLoop()
	ElseIf iSlowDown == 0
		Game.ShakeCamera()
		DRSStoneLabyrinthianOpenM.Play(Game.GetPlayer())
		RotationMarker.SetPosition(1545.0, 8771.6738, 21343.3164) 
		RotationMarker.SetAngle(0, 0, 326.2419)
		Self.PlayImpactEffect(FXDragonTakeoffImpactSet)
		Self.TranslateToREF(RotationMarker, 150.0, 150.0)
		iSlowDown = 1
	ElseIf iSlowDown == 1
		Self.TranslateToREF(RotationMarker, 100.0, 100.0)
		iSlowDown = 2
	EndIf
	
EndEvent

Event OnTranslationComplete()

	if iSlowDown == 2
		Game.ShakeCamera()
		Self.PlayImpactEffect(FXDragonTakeoffImpactSet)
		DRSStoneLabyrinthianCloseM.Play(Game.GetPlayer())
	EndIf

EndEvent

;=====================================================================================
;              							PROPERTIES                  					 
;=====================================================================================

float fPosX
float fPosY
float fPosZ

float fAngleX
float fAngleY
float fAngleZ

bool bInit

int iSlowDown

_00E_MQ13b_Functions Property MQ13b Auto 

ObjectReference RotationMarker

Static Property XMarkerHeading Auto

ImpactDataSet Property FXDragonTakeoffImpactSet Auto

Sound Property DRSStoneLabyrinthianCloseM Auto
Sound Property DRSStoneLabyrinthianOpenM Auto

Float Property RotationSpeedBase = 125.0 Auto
{The base speed the objects will rotate around with. Defaut: 25}