mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
Pie plate selector and tweening patch
This commit is contained in:
@@ -1,32 +1,38 @@
|
|||||||
local PieplateSelectorModule = {}
|
local PPSModule = {}
|
||||||
PieplateSelectorModule.__index = PieplateSelectorModule
|
PPSModule.__index = PPSModule
|
||||||
|
|
||||||
local RS: RunService = game:GetService("RunService")
|
PPSModule.Delta = 0
|
||||||
|
|
||||||
function PieplateSelectorModule.constructor(PieplateSelector: UnionOperation, PiePlatePlates: UnionOperation, ElevatorBox: UnionOperation)
|
local RS: RunService = game:GetService("RunService")
|
||||||
|
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
|
||||||
|
local Tween = require(Storage:WaitForChild("Tween"))
|
||||||
|
local Easing = require(Storage:WaitForChild("AlgebraEasings"))
|
||||||
|
|
||||||
|
function PPSModule.constructor(PieplateSelector: UnionOperation, PiePlatePlates: UnionOperation, ElevatorBox: UnionOperation)
|
||||||
return setmetatable({
|
return setmetatable({
|
||||||
PieplateSelector = PieplateSelector,
|
PieplateSelector = PieplateSelector,
|
||||||
PiePlatePlates = PiePlatePlates,
|
PiePlatePlates = PiePlatePlates,
|
||||||
ElevatorBox = ElevatorBox
|
ElevatorBox = ElevatorBox
|
||||||
}, PieplateSelectorModule)
|
}, PPSModule)
|
||||||
end
|
end
|
||||||
|
|
||||||
function PieplateSelectorModule:test()
|
local SelectorTween = Tween.constructor()
|
||||||
local Delta = 0
|
|
||||||
|
|
||||||
|
function PPSModule:test()
|
||||||
self.PieplateSelector.CFrame=self.PieplateSelector.CFrame+Vector3.yAxis/20
|
self.PieplateSelector.CFrame=self.PieplateSelector.CFrame+Vector3.yAxis/20
|
||||||
|
|
||||||
local OriginalAngleDelta = self.PiePlatePlates.CFrame
|
local OriginalAngleDelta = self.PiePlatePlates.CFrame
|
||||||
local OriginalPositionDelta = self.PieplateSelector.CFrame
|
local OriginalPositionDelta = self.PieplateSelector.CFrame
|
||||||
|
|
||||||
self.__SelectorConnection = RS.Heartbeat:Connect(function(_dt)
|
self.__SelectorConnection = RS.Heartbeat:Connect(function(_dt)
|
||||||
Delta+=1
|
PPSModule.Delta+=1
|
||||||
|
|
||||||
self.PieplateSelector.CFrame=OriginalPositionDelta+Vector3.new(0, Delta/500, 0)
|
self.PieplateSelector.CFrame=OriginalPositionDelta+Vector3.new(0, PPSModule.Delta/580, 0)
|
||||||
self.PiePlatePlates.CFrame=OriginalAngleDelta*CFrame.Angles(-math.rad(Delta*6.8), 0, 0)
|
self.PiePlatePlates.CFrame=OriginalAngleDelta*CFrame.Angles(-math.rad(Easing.Linear(0, PPSModule.Delta, Easing.InQuad(.5))*5), 0, 0)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return self.__SelectorConnection
|
return self.__SelectorConnection
|
||||||
end
|
end
|
||||||
|
|
||||||
return PieplateSelectorModule
|
return PPSModule
|
||||||
@@ -10,9 +10,15 @@ type LinearFunction = (a: number, b: number, t: number) -> number
|
|||||||
export type EasingStyles = {
|
export type EasingStyles = {
|
||||||
Linear: LinearFunction,
|
Linear: LinearFunction,
|
||||||
InOutBack: EaseFunction,
|
InOutBack: EaseFunction,
|
||||||
OutBounce: EaseFunction
|
OutBounce: EaseFunction,
|
||||||
|
InQuad: EaseFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function flip(x: number): number
|
||||||
|
return x*0-x
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
local Ease = {} :: EasingStyles
|
local Ease = {} :: EasingStyles
|
||||||
--Google straight up gives wrong/bad math
|
--Google straight up gives wrong/bad math
|
||||||
|
|
||||||
@@ -32,4 +38,8 @@ function Ease.OutBounce(n)
|
|||||||
n<0.909091 and (.9375*(1.*d1-2.4*n*n1)/d1)) or (.984375*(1.*d1-2.66667*n*n1))/d1
|
n<0.909091 and (.9375*(1.*d1-2.4*n*n1)/d1)) or (.984375*(1.*d1-2.66667*n*n1))/d1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Ease.InQuad(n)
|
||||||
|
return n*n
|
||||||
|
end
|
||||||
|
|
||||||
return Ease
|
return Ease
|
||||||
@@ -42,10 +42,12 @@ function Tween:Start(PostInstance, PostProperties, PostTweenSettings)
|
|||||||
|
|
||||||
if PostProperties then
|
if PostProperties then
|
||||||
if self.PreProperties then
|
if self.PreProperties then
|
||||||
for tween_prop, tween_value in PostProperties do
|
if Props then
|
||||||
Props[tween_prop] = tween_value
|
print("Tween library: Combining PostProperties and PreProperties together", debug.traceback())
|
||||||
|
for tween_prop, tween_value in PostProperties do
|
||||||
|
Props[tween_prop] = tween_value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
print("Tween library: Combining PostProperties and PreProperties together", debug.traceback())
|
|
||||||
else
|
else
|
||||||
Props = PostProperties
|
Props = PostProperties
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user