mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-16 06:01:54 +00:00
Rotation matrix UI and Interactions dir
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local MapDir = script.Parent
|
||||
local MapDir = script.Parent.Parent
|
||||
local MainDir = MapDir.Parent
|
||||
|
||||
local Storage = game:GetService("ReplicatedStorage")
|
||||
@@ -19,7 +19,7 @@ type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Create: (self: ClassConstructor) -> (),
|
||||
Init: (self: ClassConstructor) -> (),
|
||||
} & Impl_Static_Props
|
||||
|
||||
type Impl_Static_Props = {
|
||||
@@ -38,8 +38,6 @@ Lights.__index = Lights
|
||||
|
||||
Lights.SwitchAnimationTime = .1
|
||||
|
||||
local LightSwitchTween = TweenModule.constructor(TweenInfo.new(Lights.SwitchAnimationTime, Enum.EasingStyle.Linear))
|
||||
|
||||
function Lights.constructor(LightSwitches)
|
||||
return setmetatable({
|
||||
LightSwitches = LightSwitches
|
||||
@@ -65,6 +63,8 @@ local function ToggleSwitchLight(EnabledState: boolean, LightObject: BasePart, L
|
||||
end
|
||||
end
|
||||
|
||||
local LightSwitchTween = TweenModule.constructor(TweenInfo.new(Lights.SwitchAnimationTime, Enum.EasingStyle.Linear))
|
||||
|
||||
local function SwitchAnimation(EnabledState: boolean, LightProperties: LightProperties)
|
||||
local Switch = LightProperties.Switch
|
||||
|
||||
@@ -85,7 +85,7 @@ end
|
||||
Guide for lights with toggable switches:
|
||||
TODO
|
||||
]]
|
||||
function Lights:Create()
|
||||
function Lights:Init()
|
||||
for _, LightProperties in self.LightSwitches do
|
||||
if LightProperties.Prompt and LightProperties.Switch then
|
||||
local Prompt = PromptsConstructor.constructor(LightProperties.Prompt, LightProperties.Switch)
|
||||
@@ -104,7 +104,7 @@ function Lights:Create()
|
||||
end
|
||||
end)
|
||||
else
|
||||
warn(`Prompt failed`)
|
||||
warn(`LightSwitch hook failed, a required field is missing:\n-----\nColorDeactivated = {LightProperties.ColorDeactivated}\nColorActivated = {LightProperties.ColorActivated}\nPrompt = {LightProperties.Prompt}\nLights = {LightProperties.Lights}\n-----`)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -77,7 +77,6 @@ export type InteractablesTree = {
|
||||
LightSwitches: LightSwitchTree
|
||||
}
|
||||
|
||||
|
||||
export type ButtonsTree = {
|
||||
Landing: ButtonProperties,
|
||||
Car: ButtonProperties,
|
||||
@@ -237,7 +236,7 @@ function Tags:__Interactables()
|
||||
if InteractType == Enums.Interactables.LightSwitch then
|
||||
local ptr = Interactables.LightSwitches[InteractObjectLocation]
|
||||
local itype = type(Inst) == "table"
|
||||
local Switch = itype and (Inst :: {Instance})[1] or Inst :: Instance
|
||||
local Switch = (itype and (Inst :: {Instance})[1] or Inst :: Instance) :: BasePart
|
||||
if itype then
|
||||
warn(`2 or more light switch tags were present under the same name, using the first index. "{TagName}". This feature is not implemented yet`)
|
||||
end
|
||||
@@ -249,6 +248,7 @@ function Tags:__Interactables()
|
||||
Prompt.HoldDuration = Tags.MaxLightSwitchHoldDuration
|
||||
Prompt.Parent = Attachment
|
||||
local ClickSound = Instance.new("Sound") :: Sound
|
||||
ClickSound.Volume = .1
|
||||
ClickSound.SoundId = Tags.LightSwitchActivateSoundId
|
||||
ClickSound.Parent = Switch
|
||||
|
||||
@@ -281,7 +281,7 @@ function Tags:__Interactables()
|
||||
ptr.Lights = Inst
|
||||
else
|
||||
ptr.Lights = {}
|
||||
table.insert(ptr.Lights :: {Instance}, Inst)
|
||||
table.insert(ptr.Lights :: {BasePart}, Inst :: BasePart)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,12 @@ local ShowEditorEntities = game:GetService("RunService"):IsServer()
|
||||
local Storage = game:GetService("ReplicatedStorage")
|
||||
local Enums = require(Storage:WaitForChild("Enums"))
|
||||
|
||||
local Elevators = script:WaitForChild("Elevators")
|
||||
local Elevators = script:WaitForChild("Elevators")
|
||||
local Maps = script:WaitForChild("Map")
|
||||
|
||||
local Interactions = Maps:WaitForChild("Interactions")
|
||||
local LightSwitches = require(Interactions:WaitForChild("LightSwitches"))
|
||||
|
||||
local Otis1960_Module = require(Elevators:WaitForChild("Otis1960"))
|
||||
|
||||
local TagsModule = require(script:WaitForChild("Tags"))
|
||||
@@ -30,6 +35,10 @@ Workspace_Stuff()
|
||||
local Interactables = TagsConstructor:__Interactables()
|
||||
print("[DEBUG] Interactables=", Interactables)
|
||||
|
||||
--Interactables
|
||||
local LightSwitchesConstructor = LightSwitches.constructor(Interactables.LightSwitches)
|
||||
LightSwitchesConstructor:Init()
|
||||
|
||||
--Start the elevators
|
||||
local Buttons = TagsConstructor:__ElevatorButtons()
|
||||
print("[DEBUG] Buttons=", Buttons)
|
||||
|
||||
Reference in New Issue
Block a user