Polish Trophy Hunt pickups and feedback
This commit is contained in:
1 parent
9fb926537c
commit
0c949fadf0
10 files changed
+156
-11
No files matched your search
@@ -0,0 +1,80 @@
|
||||
--!strict
|
||||
local rs=game:GetService("ReplicatedStorage")
|
||||
local Players=game:GetService("Players")
|
||||
local RunService=game:GetService("RunService")
|
||||
local TweenService=game:GetService("TweenService")
|
||||
local UI=require(rs:WaitForChild("HunterUI") :: ModuleScript)
|
||||
local Kinds=require(rs.Hunter.EventKinds)
|
||||
local Router=require(script.Parent.EventRouter)
|
||||
local player=Players.LocalPlayer
|
||||
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 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)
|
||||
label.FontFace=UI.Display
|
||||
local scale=Instance.new("UIScale",plate)
|
||||
local bounce: Tween?=nil
|
||||
local last=0
|
||||
local function update()
|
||||
local count=player:GetAttribute("ArenaTokens")
|
||||
local n=if typeof(count)=="number" then count else 0
|
||||
gui.Enabled=player:GetAttribute("InArena")==true and match:GetAttribute("Ruleset")=="TrophyHunt" and match:GetAttribute("Phase")=="Round"
|
||||
label.Text="×"..n
|
||||
if gui.Enabled and n>last then
|
||||
if bounce then bounce:Cancel() end
|
||||
scale.Scale=1.18
|
||||
bounce=TweenService:Create(scale,TweenInfo.new(.32,Enum.EasingStyle.Back,Enum.EasingDirection.Out),{Scale=1})
|
||||
bounce:Play()
|
||||
end
|
||||
last=n
|
||||
end
|
||||
local connections={player:GetAttributeChangedSignal("ArenaTokens"):Connect(update),player:GetAttributeChangedSignal("InArena"):Connect(update),
|
||||
match:GetAttributeChangedSignal("Ruleset"):Connect(update),match:GetAttributeChangedSignal("Phase"):Connect(update)}
|
||||
local draw=RunService.RenderStepped:Connect(function()
|
||||
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)
|
||||
end)
|
||||
|
||||
local pool: {Part}={}
|
||||
local motions: {[Part]: Tween}={}
|
||||
for i=1,6 do
|
||||
local coin=Instance.new("Part")
|
||||
coin.Name="TrophySpark"
|
||||
coin.Shape,coin.Material,coin.Color=Enum.PartType.Cylinder,Enum.Material.Neon,UI.Gold
|
||||
coin.Size=Vector3.new(.12,.62,.62)
|
||||
coin.Anchored,coin.CanCollide,coin.CanQuery,coin.CanTouch=true,false,false,false
|
||||
coin.Transparency=1
|
||||
coin.Parent=workspace
|
||||
table.insert(pool,coin)
|
||||
end
|
||||
local off=Router.on(Kinds.TokenDropped,function(payload)
|
||||
if not gui.Enabled or typeof(payload.at)~="Vector3" then return end
|
||||
for i,coin in pool do
|
||||
if motions[coin] then motions[coin]:Cancel() end
|
||||
local a=i*math.pi/3
|
||||
local from=payload.at+Vector3.yAxis*.7
|
||||
coin.CFrame=CFrame.new(from)*CFrame.Angles(a,0,0)
|
||||
coin.Transparency=.1
|
||||
local tween=TweenService:Create(coin,TweenInfo.new(.55,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),
|
||||
{CFrame=CFrame.new(from+Vector3.new(math.cos(a)*4,2.4,math.sin(a)*4))*CFrame.Angles(a,1.7,1),Transparency=1})
|
||||
motions[coin]=tween
|
||||
tween:Play()
|
||||
end
|
||||
end)
|
||||
update()
|
||||
script.Destroying:Once(function()
|
||||
draw:Disconnect()
|
||||
for _, cn in connections do cn:Disconnect() end
|
||||
off()
|
||||
for _, coin in pool do
|
||||
if motions[coin] then motions[coin]:Cancel() end
|
||||
coin:Destroy()
|
||||
end
|
||||
gui:Destroy()
|
||||
end)
|
||||
Reference in new issue
Block a user