--[[

	CastVisualiser Visuals.new(Color: Color3?, WorldRoot: WorldRoot?)
		Creates and returns a CastVisualiser class.

--]]


local Meta = {__index = CastVisualiser}

function Visuals.new(Color: Color3?, WorldRoot: WorldRoot?): CastVisualiser
	local self: CastVisualiserPrivate = setmetatable({
		Color = Color or Color3.new(0, 0, 1),
		WorldRoot = WorldRoot or workspace,
	}, Meta)
	
	-- Origin Part
	local CastOriginPart = Instance.new("Part")
	CastOriginPart.Transparency = 1
	CastOriginPart.CanCollide = false
	CastOriginPart.CanQuery = false
	CastOriginPart.CanTouch = false
	CastOriginPart.Anchored = true
	CastOriginPart.Size = Vector3.one / 100

	self.CastOriginPart = CastOriginPart
	
	-- Visuals
	local LineHandleAdornment = Instance.new("LineHandleAdornment")
	LineHandleAdornment.Color3 = self.Color
	LineHandleAdornment.AlwaysOnTop = ALWAYS_ON_TOP
	LineHandleAdornment.Transparency = TRANSPARENCY
	LineHandleAdornment.Thickness = LINE_THICKNESS
	LineHandleAdornment.ZIndex = 1
	LineHandleAdornment.Adornee = CastOriginPart
	LineHandleAdornment.Parent = CastOriginPart
	
	self.LineVisual = LineHandleAdornment
	
	local ConeHandleAdornmnet = Instance.new("ConeHandleAdornment")
	ConeHandleAdornmnet.Color3 = self.Color
	ConeHandleAdornmnet.AlwaysOnTop = ALWAYS_ON_TOP
	ConeHandleAdornmnet.Transparency = TRANSPARENCY
	ConeHandleAdornmnet.Radius = 0.05
	ConeHandleAdornmnet.Height = CONE_HEIGHT
	ConeHandleAdornmnet.SizeRelativeOffset = Vector3.new(0, 0, CONE_HEIGHT * 2)
	ConeHandleAdornmnet.ZIndex = 1
	ConeHandleAdornmnet.Adornee = CastOriginPart
	ConeHandleAdornmnet.Parent = CastOriginPart
	
	self.ConeVisual = ConeHandleAdornmnet
	
	local BoxHandleAdornment = Instance.new("BoxHandleAdornment")
	BoxHandleAdornment.Color3 = self.Color
	BoxHandleAdornment.AlwaysOnTop = ALWAYS_ON_TOP
	BoxHandleAdornment.Transparency = TRANSPARENCY
	BoxHandleAdornment.ZIndex = 0
	BoxHandleAdornment.Adornee = CastOriginPart
	BoxHandleAdornment.Parent = CastOriginPart
	
	self.BoxVisual = BoxHandleAdornment
	
	local SphereHandleAdornment = Instance.new("SphereHandleAdornment")
	SphereHandleAdornment.Color3 = self.Color
	SphereHandleAdornment.AlwaysOnTop = ALWAYS_ON_TOP
	SphereHandleAdornment.Transparency = TRANSPARENCY
	SphereHandleAdornment.ZIndex = 0
	SphereHandleAdornment.Adornee = CastOriginPart
	SphereHandleAdornment.Parent = CastOriginPart
	
	self.SphereVisual = SphereHandleAdornment
	
	return self
end

return Visuals
