mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-16 23:41:54 +00:00
Type vacuuming and working classes types
This commit is contained in:
@@ -8,9 +8,28 @@ type LocalPlayer = Player
|
||||
type HumanoidRootPart = BasePart
|
||||
type EulerXYZ_struct = {number}
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
On: (self: ClassConstructor) -> (),
|
||||
Off: (self: ClassConstructor) -> (),
|
||||
Toggle: (self: ClassConstructor) -> ()
|
||||
} & Impl_Static_Props
|
||||
|
||||
type Constructor_Fun = (LocalPlayer: LocalPlayer, HumanoidRootPart: HumanoidRootPart) -> ClassConstructor
|
||||
type Impl_Static_Props = {
|
||||
Enabled: boolean,
|
||||
HeadHeight: number
|
||||
}
|
||||
type Constructor_Return_Props = {
|
||||
FlashlightPart: Part,
|
||||
SpotLight: SpotLight,
|
||||
ToggleSound: Sound
|
||||
}
|
||||
|
||||
local Flashlight = {}
|
||||
local Flashlight = {} :: Impl_Constructor
|
||||
Flashlight.__index = Flashlight
|
||||
|
||||
Flashlight.Enabled = false
|
||||
@@ -83,15 +102,15 @@ end
|
||||
function Flashlight:On()
|
||||
Flashlight.Enabled = true
|
||||
|
||||
(self.ToggleSound :: Sound):Play();
|
||||
(self.SpotLight :: SpotLight).Enabled = Flashlight.Enabled
|
||||
self.ToggleSound:Play();
|
||||
self.SpotLight.Enabled = Flashlight.Enabled
|
||||
end
|
||||
|
||||
function Flashlight:Off()
|
||||
Flashlight.Enabled = false
|
||||
|
||||
(self.ToggleSound :: Sound):Play();
|
||||
(self.SpotLight :: SpotLight).Enabled = Flashlight.Enabled
|
||||
self.ToggleSound:Play();
|
||||
self.SpotLight.Enabled = Flashlight.Enabled
|
||||
end
|
||||
|
||||
function Flashlight:Toggle()
|
||||
@@ -102,8 +121,4 @@ function Flashlight:Toggle()
|
||||
end
|
||||
end
|
||||
|
||||
function Flashlight:SetCFrame(CameraCFrame: CFrame)
|
||||
|
||||
end
|
||||
|
||||
return Flashlight
|
||||
Reference in New Issue
Block a user