-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
-- STATE CHANGE HANDLERS


function onRunning(speed)
	if speed > 0.75 then
		local scale = 16
		local speedToPlay = calculateRunSpeed(speed / scale)
		playAnimation("walk", 0.2, Humanoid, speedToPlay)
		pose = "Running"
	else
		if not currentlyPlayingEmote then
			playAnimation("idle", 0.2, Humanoid)
			pose = "Standing"
		end
	end
end

function onDied()
	pose = "Dead"
end

function onJumping()
	playAnimation("jump", 0.1, Humanoid)
	jumpAnimTime = jumpAnimDuration
	pose = "Jumping"
end

function onClimbing(speed)
	local scale = 5.0
	playAnimation("climb", 0.1, Humanoid, speed / scale)