mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-13 22:31:55 +00:00
move Iris into UI and remove Health.luau
This commit is contained in:
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
||||
[submodule "Iris"]
|
||||
path = src/client/Iris
|
||||
path = src/client/UI/Iris
|
||||
url = https://github.com/Michael-48/Iris
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,60 +0,0 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Enable: (self: ClassConstructor) -> (),
|
||||
Disable: (self: ClassConstructor) -> (),
|
||||
DisplayHealth: (self: ClassConstructor, Amount: number) -> (),
|
||||
} & Impl_Static_Props
|
||||
|
||||
type Impl_Static_Props = {
|
||||
Enabled: boolean
|
||||
}
|
||||
|
||||
type Constructor_Fun = (PlayerGui: PlayerGui) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
HealthGui: ScreenGui,
|
||||
Amount: TextLabel
|
||||
}
|
||||
|
||||
local HealthModule = {} :: Impl_Constructor
|
||||
HealthModule.__index = HealthModule
|
||||
|
||||
HealthModule.Enabled = false
|
||||
|
||||
function HealthModule.constructor(PlayerGui: PlayerGui)
|
||||
local HealthGui = PlayerGui:WaitForChild("Health") :: ScreenGui
|
||||
local Amount = HealthGui:WaitForChild("Amount") :: TextLabel
|
||||
|
||||
return setmetatable({
|
||||
HealthGui = HealthGui,
|
||||
Amount = Amount
|
||||
}, HealthModule)
|
||||
end
|
||||
|
||||
function HealthModule:Enable()
|
||||
HealthModule.Enabled = true
|
||||
end
|
||||
|
||||
function HealthModule:Disable()
|
||||
HealthModule.Enabled = false
|
||||
end
|
||||
|
||||
function HealthModule:DisplayHealth(Amount: number)
|
||||
self.Amount.Text = tostring(Amount)
|
||||
|
||||
if Amount <= 40 then
|
||||
self.Amount.TextColor3 = Color3.fromRGB(255,238,0)
|
||||
elseif Amount <= 20 then
|
||||
self.Amount.TextColor3 = Color3.fromRGB(255,0,38)
|
||||
else
|
||||
self.Amount.TextColor3 = Color3.new(1,1,1)
|
||||
end
|
||||
end
|
||||
|
||||
return HealthModule
|
||||
Reference in New Issue
Block a user