mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 14:51:55 +00:00
floor goal and start testing the stop button
This commit is contained in:
@@ -14,7 +14,7 @@ local PromptModule = require(Main:WaitForChild("Map"):WaitForChild("Prompts"))
|
||||
local Tags = require(Load:WaitForChild("Tags"))
|
||||
|
||||
type FloorButtonActivatedCallback = (ButtonFloor: number) -> ()
|
||||
type StopButtonActivatedCallback = <T>(Toggled: T) -> ()
|
||||
type StopButtonActivatedCallback = (Toggled: SpecialButtonToggle) -> ()
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
@@ -57,6 +57,8 @@ type ElevatorButtonColors = {
|
||||
LanternDisplayOff: Color3,
|
||||
}
|
||||
|
||||
export type SpecialButtonToggle = boolean
|
||||
|
||||
export type ButtonsConstructor = ClassConstructor
|
||||
|
||||
local ButtonFunctions = {} :: Impl_Constructor
|
||||
|
||||
@@ -53,6 +53,7 @@ type Impl_Constructor = {
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
__GoToFloor: (self: ClassConstructor, Level: number, GoingUp: boolean) -> (),
|
||||
__MovingHeartbeat: (self: ClassConstructor, GoingUp: boolean) -> (),
|
||||
RequestLevelAsync: (self: ClassConstructor, RequestedLevel: number) -> boolean
|
||||
} & Impl_Static_Props
|
||||
|
||||
@@ -200,14 +201,22 @@ local function HookButtons(self: ClassConstructor, ButtonNameType: Enums.ButtonT
|
||||
end
|
||||
end
|
||||
|
||||
self.ButtonsConstructor:SpecialButton(ButtonTree.Name :: Enums.SpecialButtonValues, ButtonID, ButtonTree, function<boolean>(Toggled: boolean)
|
||||
self.ButtonsConstructor:SpecialButton(ButtonTree.Name :: Enums.SpecialButtonValues, ButtonID, ButtonTree, function(Toggled: Buttons.SpecialButtonToggle)
|
||||
Attributes.Stopped.Value = Toggled
|
||||
|
||||
if Toggled then
|
||||
(ButtonTree.Inst :: BasePart).Position+=Vector3.new(0,0,.05)
|
||||
|
||||
if self.__MovingConnection and self.__MovingConnection.Connected then
|
||||
self.__MovingConnection:Disconnect()
|
||||
end
|
||||
else
|
||||
(ButtonTree.Inst :: BasePart).Position-=Vector3.new(0,0,.05)
|
||||
|
||||
if self.__MovingConnection and self.__MovingConnection.Connected then
|
||||
self.__MovingConnection:Disconnect()
|
||||
end
|
||||
self.__MovingConnection = self:__MovingHeartbeat(ElevatorGoingUpDirection(Attributes.CurrentFloor.Value, Attributes.GoalFloor.Value))
|
||||
end
|
||||
end)
|
||||
elseif ButtonNameType == Enums.ButtonTree.Relays then
|
||||
@@ -394,7 +403,7 @@ local function FloorPassingDown(self: ClassConstructor, ElevatorPositionY: numbe
|
||||
end
|
||||
end
|
||||
|
||||
local function ElevatorHeartbeat(self: ClassConstructor, GoingUp: boolean)
|
||||
function Elevator:__MovingHeartbeat(GoingUp: boolean)
|
||||
local Delta = 0
|
||||
local DoorsOpeningEvent = false
|
||||
|
||||
@@ -466,7 +475,7 @@ function Elevator:__GoToFloor(GoalLevelVEC, GoingUp)
|
||||
self.MOConstructor:UpdateCFrame()
|
||||
local ElevatorBoxCurrentPos = self.ElevatorBox_1960.Position
|
||||
|
||||
ElevatorHeartbeat(self, GoingUp)
|
||||
self:__MovingHeartbeat(GoingUp)
|
||||
|
||||
self.BoxAlignPosition.Position = Vector3.new(ElevatorBoxCurrentPos.X, GoalLevelVEC, ElevatorBoxCurrentPos.Z)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user