mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
RelayAlgorithm .Sorted event
This commit is contained in:
@@ -18,6 +18,10 @@ type Constructor_Return_Props = {
|
||||
ElevatorAttributes: ElevatorAttributes,
|
||||
DoorAttributes: DoorAttributes,
|
||||
__FloorQueue: FloorQueue,
|
||||
|
||||
Events: {
|
||||
Sorted: BindableEvent
|
||||
},
|
||||
}
|
||||
|
||||
type ElevatorAttributes = {
|
||||
@@ -51,6 +55,10 @@ function RelayAlgorithm.constructor(BoxAlignPosition, ElevatorAttributes, DoorAt
|
||||
ElevatorAttributes = ElevatorAttributes,
|
||||
DoorAttributes = DoorAttributes,
|
||||
__FloorQueue = {},
|
||||
|
||||
Events = {
|
||||
Sorted = Instance.new("BindableEvent") :: BindableEvent
|
||||
},
|
||||
}, RelayAlgorithm)
|
||||
end
|
||||
|
||||
@@ -64,6 +72,7 @@ function RelayAlgorithm:Sort(ElevatorGoingUp)
|
||||
end
|
||||
return a>b
|
||||
end)
|
||||
self.Events.Sorted:Fire()
|
||||
end
|
||||
|
||||
function RelayAlgorithm:Check(ElevatorGoingUp)
|
||||
@@ -82,4 +91,4 @@ function RelayAlgorithm:AddFloor(ElevatorGoingUp, RequestedLevel)
|
||||
self:Sort(ElevatorGoingUp)
|
||||
end
|
||||
|
||||
return RelayAlgorithm
|
||||
return RelayAlgorithm
|
||||
|
||||
Reference in New Issue
Block a user