Polish arena effects, audio and diagnostics
This commit is contained in:
1 parent
2774e625c1
commit
16a359d4af
28 files changed
+512
-257
No files matched your search
@@ -11,8 +11,8 @@ local match=rs:WaitForChild("ArenaRound"):WaitForChild("Procedural")
|
||||
local gui=Instance.new("ScreenGui")
|
||||
gui.Name,gui.DisplayOrder,gui.ResetOnSpawn="TrophyCounter",23,false
|
||||
gui.Parent=player:WaitForChild("PlayerGui")
|
||||
local plate=UI.plate(gui,"Coins",UDim2.new(1,-16,1,-80),UDim2.fromOffset(106,48),UI.Gold)
|
||||
plate.AnchorPoint=Vector2.new(1,1)
|
||||
local plate=UI.plate(gui,"Coins",UDim2.new(.5,0,1,-85),UDim2.fromOffset(106,48),UI.Gold)
|
||||
plate.AnchorPoint=Vector2.new(.5,1)
|
||||
local art=UI.element("GoldCoin",plate,UDim2.fromOffset(6,4),UDim2.fromOffset(40,40)) :: Frame
|
||||
local rig=UI.bindCoin(art)
|
||||
local label=UI.label(plate,"Count","×0",UDim2.fromOffset(47,0),UDim2.fromOffset(52,48),24,UI.Gold)
|
||||
@@ -35,7 +35,24 @@ local function update()
|
||||
end
|
||||
local connections={player:GetAttributeChangedSignal("ArenaTokens"):Connect(update),player:GetAttributeChangedSignal("InArena"):Connect(update),
|
||||
match:GetAttributeChangedSignal("Ruleset"):Connect(update),match:GetAttributeChangedSignal("Phase"):Connect(update)}
|
||||
local tokens: {[BasePart]: boolean} = {}
|
||||
local arena = workspace:WaitForChild("ProceduralArena")
|
||||
local function add(item: Instance)
|
||||
if item:IsA("BasePart") and item.Name == "Tokens" then tokens[item] = true end
|
||||
end
|
||||
for _, item in arena:GetDescendants() do add(item) end
|
||||
local created = arena.DescendantAdded:Connect(add)
|
||||
local removed = arena.DescendantRemoving:Connect(function(item)
|
||||
if item:IsA("BasePart") then tokens[item] = nil end
|
||||
end)
|
||||
local draw=RunService.RenderStepped:Connect(function()
|
||||
local now = workspace:GetServerTimeNow()
|
||||
for token in tokens do
|
||||
local deadline = token:GetAttribute("TokenExpiresAt")
|
||||
local flashSeconds = token:GetAttribute("TokenFlashSeconds")
|
||||
local flashing = typeof(deadline) == "number" and typeof(flashSeconds) == "number" and deadline - now <= flashSeconds
|
||||
token.LocalTransparencyModifier = if flashing then .32 + .26 * math.sin(now * math.pi * 2 / .76) else 0
|
||||
end
|
||||
if not gui.Enabled then return end
|
||||
local t=os.clock()
|
||||
UI.spinCoin(rig,t*2,math.max(0,math.cos(t*2))*.55,t%1)
|
||||
@@ -70,6 +87,9 @@ end)
|
||||
update()
|
||||
script.Destroying:Once(function()
|
||||
draw:Disconnect()
|
||||
created:Disconnect()
|
||||
removed:Disconnect()
|
||||
for token in tokens do token.LocalTransparencyModifier = 0 end
|
||||
for _, cn in connections do cn:Disconnect() end
|
||||
off()
|
||||
for _, coin in pool do
|
||||
|
||||
Reference in new issue
Block a user