mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 23:01:53 +00:00
Working lanterns as floors pass by, need to work on going down, start working on hall displays
This commit is contained in:
@@ -20,7 +20,7 @@ type Impl_Constructor = {
|
||||
constructor: Constructor_Fun,
|
||||
Get: (Tags: Tags.TagsConstructor, Model: Enums.ElevatorValues) -> Tags.Lanterns,
|
||||
--Class functions
|
||||
Activate: (self: ClassConstructor, EnabledState: boolean, IsDirectionLantern: boolean, Lantern: Tags.Lantern) -> (),
|
||||
Activate: (self: ClassConstructor, EnabledState: boolean, IsDirectionLantern: boolean, Lantern: Tags.Lantern, Chime: boolean) -> (),
|
||||
DirectionUp: (self: ClassConstructor, Enabled: boolean) -> (),
|
||||
DirectionDown: (self: ClassConstructor, Enabled: boolean) -> (),
|
||||
Toggle: (self: ClassConstructor, Enabled: boolean, Floor: number) -> (),
|
||||
@@ -74,18 +74,20 @@ end
|
||||
|
||||
local LanternLight = Tween.constructor(TweenInfo.new(Lanterns.LightTweenTime))
|
||||
|
||||
function Lanterns:Activate(EnabledState, IsDirectionLantern, Lantern)
|
||||
function Lanterns:Activate(EnabledState, IsDirectionLantern, Lantern, Chime)
|
||||
local Tween = LanternLight:Start(Lantern.Light, {
|
||||
Color = EnabledState and self.Colors.Active or self.Colors.Off
|
||||
})
|
||||
|
||||
if EnabledState then
|
||||
if IsDirectionLantern then
|
||||
self.AudioChimeDirection:Play()
|
||||
else
|
||||
Tween.Completed:Once(function()
|
||||
self.AudioChimeLanding:Play()
|
||||
end)
|
||||
if Chime then
|
||||
if IsDirectionLantern then
|
||||
self.AudioChimeDirection:Play()
|
||||
else
|
||||
Tween.Completed:Once(function()
|
||||
self.AudioChimeLanding:Play()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
if Lantern.PointLight then
|
||||
@@ -110,17 +112,17 @@ end
|
||||
function Lanterns:Reset(ExcludeFloor)
|
||||
if self.LanternsMap.Up then
|
||||
self.LanternsMap.Up.Played = false
|
||||
self:Activate(false, true, self.LanternsMap.Up)
|
||||
self:Activate(false, true, self.LanternsMap.Up, true)
|
||||
end
|
||||
if self.LanternsMap.Down then
|
||||
self.LanternsMap.Down.Played = false
|
||||
self:Activate(false, true, self.LanternsMap.Down)
|
||||
self:Activate(false, true, self.LanternsMap.Down, true)
|
||||
end
|
||||
|
||||
for n: number = 1, #self.LanternsMap do
|
||||
local Lantern = self.LanternsMap[n]
|
||||
|
||||
self:Activate(ExcludeFloor and n == ExcludeFloor or false, false, Lantern)
|
||||
self:Activate(ExcludeFloor and n == ExcludeFloor or false, false, Lantern, false)
|
||||
Lantern.Played = false
|
||||
end
|
||||
end
|
||||
@@ -128,22 +130,26 @@ end
|
||||
function Lanterns:DirectionUp(Enabled)
|
||||
if self.LanternsMap.Up and not self.LanternsMap.Up.Played then
|
||||
self.LanternsMap.Up.Played = true
|
||||
self:Activate(Enabled, true, self.LanternsMap.Up)
|
||||
self:Activate(Enabled, true, self.LanternsMap.Up, true)
|
||||
end
|
||||
end
|
||||
|
||||
function Lanterns:DirectionDown(Enabled)
|
||||
if self.LanternsMap.Down and not self.LanternsMap.Down.Played then
|
||||
self.LanternsMap.Down.Played = true
|
||||
self:Activate(Enabled, true, self.LanternsMap.Down)
|
||||
self:Activate(Enabled, true, self.LanternsMap.Down, true)
|
||||
end
|
||||
end
|
||||
|
||||
function Lanterns:Toggle(Enabled, Floor)
|
||||
local f = self.LanternsMap[Floor]
|
||||
|
||||
if not Enabled then
|
||||
f.Played = false
|
||||
end
|
||||
if not f.Played then
|
||||
f.Played = true
|
||||
self:Activate(Enabled, false, f)
|
||||
self:Activate(Enabled, false, f, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user