Skip to content

Commit

Permalink
Added markers for Fever in performance graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
macmillan333 committed Jul 7, 2024
1 parent b8c1cf8 commit 57767dc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions TECHMANIA/Assets/UI/Scripts/Panels/Game Panel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ gamePanel = {
-- HPAfterNote: remaining HP after note, [0, 1]
-- }
performanceOnAllNotes = {},
-- Each element is the game time, odd elements are fever start, even are fever end
feverStartAndEnd = {},
}

pauseButton = {
Expand Down Expand Up @@ -124,6 +126,7 @@ gamePanel.Initialize = function()

tm.gameSetup.onLoadComplete = function()
gamePanel.performanceOnAllNotes = {}
gamePanel.feverStartAndEnd = {}
gamePanel.BeginGame()
end

Expand Down Expand Up @@ -233,6 +236,7 @@ gamePanel.Initialize = function()

tm.gameSetup.onFeverActivated = function()
tm.audio.PlaySfx(tm.io.LoadAudioFromTheme("Assets/UI/SFX/Fever.wav"))
table.insert(gamePanel.feverStartAndEnd, tm.game.timer.gameTime)
gamePanel.ShowFeverOff()
end

Expand All @@ -241,6 +245,7 @@ gamePanel.Initialize = function()
end

tm.gameSetup.onFeverEnd = function(feverBonus)
table.insert(gamePanel.feverStartAndEnd, tm.game.timer.gameTime)
gamePanel.ShowFeverOff()
gamePanel.feverBonusCoroutine = tm.StartCoroutine(function()
local bonusDisplay = gamePanel.panel.Q("middle-fever-bar-bg").Q("fever-bonus")
Expand Down
20 changes: 20 additions & 0 deletions TECHMANIA/Assets/UI/Scripts/Panels/Result Panel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@ resultPanel.Initialize = function()
)
end

-- Fever
if (#gamePanel.feverStartAndEnd % 2 == 1) then
table.insert(gamePanel.feverStartAndEnd, maxTime)
end
painter.fillColor = unity.color.__new(251 / 255, 192 / 255, 45 / 255, 13 / 255)
for i = 1, #gamePanel.feverStartAndEnd, 2 do
local feverStart = gamePanel.feverStartAndEnd[i]
local feverEnd = gamePanel.feverStartAndEnd[i + 1]
local startX = unity.mathf.InverseLerp(minTime, maxTime, feverStart)
local endX = unity.mathf.InverseLerp(minTime, maxTime, feverEnd)

painter.BeginPath()
painter.MoveTo(Denormalize(startX, 0))
painter.LineTo(Denormalize(startX, 1))
painter.LineTo(Denormalize(endX, 1))
painter.LineTo(Denormalize(endX, 0))
painter.ClosePath()
painter.Fill()
end

-- HP graph
painter.BeginPath()
painter.MoveTo(unity.vector2.__new(padding, padding))
Expand Down

0 comments on commit 57767dc

Please sign in to comment.