rename everything to .luau extension

This commit is contained in:
2024-07-17 17:19:19 -04:00
parent 5eda5f0ce7
commit a014ca97c2
57 changed files with 17 additions and 17 deletions

View File

@@ -0,0 +1,64 @@
--!optimize 2
--!native
--!strict
local Bobbing = require(script:WaitForChild("Bobbing"))
type CurrentCamera = Camera
type HumanoidRootPart = BasePart
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
type Impl_Constructor = {
__index: Impl_Constructor,
constructor: Constructor_Fun,
--Class functions
EnableBobbing: (self: ClassConstructor) -> (),
DisableBobbing: (self: ClassConstructor) -> ()
}
type Constructor_Fun = (CurrentCamera: CurrentCamera, HumanoidRootPart: HumanoidRootPart, Humanoid: Humanoid) -> ClassConstructor
type Constructor_Return_Props = {
CameraFPS: boolean,
CurrentCamera: CurrentCamera,
HumanoidRootPart: HumanoidRootPart,
BobbingCamera: Bobbing.BobbingConstructor
}
export type CameraConstructor = ClassConstructor
local Camera = {} :: Impl_Constructor
Camera.__index = Camera
local RS = game:GetService("RunService")
function Camera.constructor(CurrentCamera: CurrentCamera, HumanoidRootPart: HumanoidRootPart, Humanoid: Humanoid)
local self = {} :: Constructor_Return_Props
self.CameraFPS = false
self.CurrentCamera = CurrentCamera
self.HumanoidRootPart = HumanoidRootPart
self.BobbingCamera = Bobbing.constructor(HumanoidRootPart, CurrentCamera, Humanoid)
return setmetatable(self, Camera)
end
function Camera:EnableBobbing()
if not self.CameraFPS then
RS:BindToRenderStep("CameraAnimations", Enum.RenderPriority.Camera.Value+1, function(dt)
self.BobbingCamera:Frame(dt)
end)
self.CameraFPS = true
else
print("Character Camera: Cannot call EnableBobbing while its active", debug.traceback())
end
end
function Camera:DisableBobbing()
if self.CameraFPS then
RS:UnbindFromRenderStep("CameraAnimations")
self.CameraFPS = false
else
print("Character Camera: DisableBobbing was called before EnableBobbing", debug.traceback())
end
self.CurrentCamera.CFrame *= CFrame.Angles(0,0,0)
end
return Camera