function ActiveCastStatic.Pause(k)assert(getmetatable(k)==ActiveCastStatic,ERR_NOT_INSTANCE:format("\080\097\117\115\101","\065\099\116\105\118\101\067\097\115\116\046\110\101\119\040\046\046\046\041"))assert(k.StateInfo.UpdateConnection~=nil,ERR_OBJECT_DISPOSED)k.StateInfo.Paused=true end function ActiveCastStatic.Resume(k)assert(getmetatable(k)==ActiveCastStatic,ERR_NOT_INSTANCE:format("\082\101\115\117\109\101","\065\099\116\105\118\101\067\097\115\116\046\110\101\119\040\046\046\046\041"))assert(k.StateInfo.UpdateConnection~=nil,ERR_OBJECT_DISPOSED)k.StateInfo.Paused=false end function ActiveCastStatic.Terminate(k)assert(getmetatable(k)==ActiveCastStatic,ERR_NOT_INSTANCE:format("\084\101\114\109\105\110\097\116\101","\065\099\116\105\118\101\067\097\115\116\046\110\101\119\040\046\046\046\041"))assert(k.StateInfo.UpdateConnection~=nil,ERR_OBJECT_DISPOSED)local t=k.StateInfo.Trajectories local i=t[#t]i.EndTime=k.StateInfo.TotalRuntime k.StateInfo.UpdateConnection:Disconnect()k.Caster.CastTerminating:FireSync(k)k.StateInfo.UpdateConnection=nil k.Caster=nil k.StateInfo=nil k.RayInfo=nil k.UserData=nil setmetatable(k,nil)end return ActiveCastStatic
---- STATE MODIFICATION ----

function ActiveCastStatic:Pause()
	assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("Pause", "ActiveCast.new(...)"))
	assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
	self.StateInfo.Paused = true
end

function ActiveCastStatic:Resume()
	assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("Resume", "ActiveCast.new(...)"))
	assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
	self.StateInfo.Paused = false
end

function ActiveCastStatic:Terminate()
	assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("Terminate", "ActiveCast.new(...)"))
	assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)

	-- First: Set EndTime on the latest trajectory since it is now done simulating.
	local trajectories = self.StateInfo.Trajectories
	local lastTrajectory = trajectories[#trajectories]
	lastTrajectory.EndTime = self.StateInfo.TotalRuntime

	-- Disconnect the update connection.
	self.StateInfo.UpdateConnection:Disconnect()

	-- Now fire CastTerminating
	self.Caster.CastTerminating:FireSync(self)

	-- And now set the update connection object to nil.
	self.StateInfo.UpdateConnection = nil

	-- And nuke everything in the table + clear the metatable.
	self.Caster = nil
	self.StateInfo = nil
	self.RayInfo = nil
	self.UserData = nil
	setmetatable(self, nil)
end

return ActiveCastStatic
