local R=(require(((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\083\099\114\105\112\116\115")):WaitForChild("\067\111\110\115\111\108\101"))).sourced("\077\111\110\105\116\111\114 \083\112\097\119\110")R.log("\076\111\097\100\105\110\103 \100\101\112\101\110\100\101\110\099\105\101\115\046\046\046")local s=require(((script.Parent.Parent:WaitForChild("\067\111\110\116\114\111\108\083\099\104\101\109\101")):WaitForChild("\067\111\110\116\114\111\108")):WaitForChild("\077\101\116\104\111\100"))local t=require(script.Parent:WaitForChild("\066\105\110\097\114\121\077\111\110\105\116\111\114"))local W=require(script.Parent:WaitForChild("\065\120\105\115\077\111\110\105\116\111\114"))local V=require(script.Parent:WaitForChild("\086\101\099\116\111\114\077\111\110\105\116\111\114"))R.log("\067\111\110\115\116\114\117\099\116\105\110\103 \102\117\110\099\116\105\111\110\115\046\046\046")local function H(R)local H if R.Method==s.Binary then H=t.new()elseif R.Method==s.Axis then H=W.new()elseif R.Method==s.Vector then H=V.new()end if H~=nil then H.Control=R end return H end R.log("\068\111\110\101\046")return H
--- A Monitor spawning function.
-- Spawns the appropriate type of Monitor for the Control provided and
-- automatically binds it to the Monitor.
--
-- @author LastTalon
-- @version 0.1.0, 2020-04-14
-- @since 0.1
--
-- @module Spawn
--
-- @see Monitor

local Console = require(game:GetService("ReplicatedStorage"):WaitForChild("Scripts"):WaitForChild("Console")).sourced("Monitor Spawn")

-- Dependencies --
Console.log("Loading dependencies...")

local Method = require(script.Parent.Parent:WaitForChild("ControlScheme"):WaitForChild("Control"):WaitForChild("Method"))
local BinaryMonitor = require(script.Parent:WaitForChild("BinaryMonitor"))
local AxisMonitor = require(script.Parent:WaitForChild("AxisMonitor"))
local VectorMonitor = require(script.Parent:WaitForChild("VectorMonitor"))

-- Functions --
Console.log("Constructing functions...")

local function Spawn(control)
	local monitor
	if control.Method == Method.Binary then
		monitor = BinaryMonitor.new()
	elseif control.Method == Method.Axis then
		monitor = AxisMonitor.new()
	elseif control.Method == Method.Vector then
		monitor = VectorMonitor.new()
	end
	if monitor ~= nil then
		monitor.Control = control
	end
	return monitor
end

-- End --
Console.log("Done.")

return Spawn
