mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-15 21:41:53 +00:00
moving objects module
This commit is contained in:
72
src/server/main/Elevators/Otis1960/MovingObjects.lua
Normal file
72
src/server/main/Elevators/Otis1960/MovingObjects.lua
Normal file
@@ -0,0 +1,72 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
FR_Pullies: (self: ClassConstructor, Delta: number, ElevatorVelocity_Y: number) -> (),
|
||||
FR_PiePlate: (self: ClassConstructor) -> ()
|
||||
}
|
||||
|
||||
type Constructor_Fun = (InstanceTree: InstanceTree) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
PulleyCFrame: CFrame,
|
||||
Pulley2CFrame: CFrame,
|
||||
GovernorCFrame: CFrame,
|
||||
GovernorFlyballsCFrame: CFrame,
|
||||
PieplatePulleyCFrame: CFrame,
|
||||
Pulley: UnionOperation,
|
||||
Pulley2: UnionOperation,
|
||||
Governor: UnionOperation,
|
||||
GovernorFlyballs: UnionOperation,
|
||||
PieplatePulley: UnionOperation,
|
||||
}
|
||||
|
||||
export type InstanceTree = {
|
||||
Pulley: UnionOperation,
|
||||
Pulley2: UnionOperation,
|
||||
Governor: UnionOperation,
|
||||
GovernorFlyballs: UnionOperation,
|
||||
PieplatePulley: UnionOperation,
|
||||
}
|
||||
|
||||
export type MovingObjectsConstructor = ClassConstructor
|
||||
|
||||
local MovingObjects = {} :: Impl_Constructor
|
||||
MovingObjects.__index = MovingObjects
|
||||
|
||||
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local Tween = require(Storage:WaitForChild("Tween"))
|
||||
local Easing = require(Storage:WaitForChild("AlgebraEasings"))
|
||||
|
||||
function MovingObjects.constructor(InstanceTree)
|
||||
local self = InstanceTree
|
||||
self.PulleyCFrame = InstanceTree.Pulley.CFrame
|
||||
self.Pulley2CFrame = InstanceTree.Pulley2.CFrame
|
||||
self.GovernorCFrame = InstanceTree.Governor.CFrame
|
||||
self.GovernorFlyballsCFrame = InstanceTree.GovernorFlyballs.CFrame
|
||||
self.PieplatePulleyCFrame = InstanceTree.PieplatePulley.CFrame
|
||||
|
||||
return setmetatable(self, MovingObjects)
|
||||
end
|
||||
|
||||
function MovingObjects:FR_Pullies(Delta, ElevatorVelocity_Y)
|
||||
local RotAngle = Delta*ElevatorVelocity_Y
|
||||
local PullAngle_2 = math.rad(RotAngle/2)
|
||||
local PullAngle = math.rad(RotAngle)
|
||||
|
||||
self.Pulley.CFrame = self.PulleyCFrame *CFrame.Angles(-PullAngle_2, 0, 0)
|
||||
self.Pulley2.CFrame = self.Pulley2CFrame *CFrame.Angles(PullAngle_2, 0, 0)
|
||||
self.Governor.CFrame = self.GovernorCFrame *CFrame.Angles(0, PullAngle_2, 0)
|
||||
self.GovernorFlyballs.CFrame = self.GovernorFlyballsCFrame*CFrame.Angles(PullAngle, 0, 0)
|
||||
self.PieplatePulley.CFrame = self.PieplatePulleyCFrame *CFrame.Angles(PullAngle_2, 0, 0)
|
||||
end
|
||||
|
||||
function MovingObjects:FR_PiePlate()
|
||||
|
||||
end
|
||||
|
||||
return MovingObjects
|
||||
Reference in New Issue
Block a user