Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SSBookMinigames
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
SSBookMinigames
Commits
e58e68d9
Commit
e58e68d9
authored
Apr 15, 2026
by
saad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
increase tick sound speed over time
bug: the tick sound doesn't work in mcq game
parent
70812d7e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
42 deletions
+52
-42
MCQ.unity
My project/Assets/Scenes/MCQ/MCQ.unity
+1
-1
CsGameManager.cs
My project/Assets/ScienceStreet/CS/Scripts/CsGameManager.cs
+16
-8
CsUIManager.cs
My project/Assets/ScienceStreet/CS/Scripts/CsUIManager.cs
+14
-19
McqUIManager.cs
My project/Assets/ScienceStreet/MCQ/Scripts/McqUIManager.cs
+7
-8
SSAudioManager.cs
...ect/Assets/ScienceStreet/Shared/Scripts/SSAudioManager.cs
+14
-6
No files found.
My project/Assets/Scenes/MCQ/MCQ.unity
View file @
e58e68d9
...
...
@@ -707,7 +707,7 @@ MonoBehaviour:
classCode
:
runSpeed
:
8
lives
:
5
startTime
:
6
0
startTime
:
10
0
correctAnswerBonusTime
:
10
wrongAnswerPenaltyTime
:
10
useOfflineTestData
:
0
...
...
My project/Assets/ScienceStreet/CS/Scripts/CsGameManager.cs
View file @
e58e68d9
...
...
@@ -7,6 +7,7 @@ using UnityEngine.Events;
namespace
com.al_arcade.cs
{
using
com.al_arcade.mcq
;
using
shared
;
using
Unity.Cinemachine
;
...
...
@@ -56,7 +57,7 @@ namespace com.al_arcade.cs
private
int
_deltaChangeInSize
;
private
bool
_showHint
=
true
;
private
Camera
_cam
;
private
float
_quarterTime
;
CinemachineTargetGroup
_targetGroup
;
CinemachineGroupFraming
_groupFraming
;
...
...
@@ -122,17 +123,24 @@ namespace com.al_arcade.cs
protected
override
void
OnTimerTick
(
float
timeLeft
)
{
// Ticking sound when under 4 seconds
if
(
timeLeft
<
4f
&&
!
_isTicking
)
float
quarter
=
CsPrefabBuilder
.
Instance
.
startTime
/
4f
;
if
(
timeLeft
<
quarter
&&
!
_isTicking
)
{
_isTicking
=
true
;
SSAudioManager
.
Instance
?.
Tick
(
true
);
}
else
if
(
timeLeft
>=
4f
&&
_isTicking
)
else
if
(
timeLeft
>=
quarter
&&
_isTicking
)
{
_isTicking
=
false
;
SSAudioManager
.
Instance
?.
Tick
(
false
);
}
if
(
_isTicking
)
{
float
t
=
1f
-
(
timeLeft
/
quarter
);
float
pitch
=
Mathf
.
Lerp
(
1f
,
2.5f
,
t
);
SSAudioManager
.
Instance
?.
SetTickPitch
(
pitch
);
}
uiManager
?.
SetTimer
(
timeLeft
);
}
...
...
@@ -176,6 +184,7 @@ namespace com.al_arcade.cs
onGameStart
?.
Invoke
();
StartCoroutine
(
QuestionLoop
());
_quarterTime
=
CsPrefabBuilder
.
Instance
.
startTime
/
4
;
}
// ─── Update: CS also needs the state guard from original ─────────────
...
...
@@ -240,13 +249,12 @@ namespace com.al_arcade.cs
// ─── Timer helpers ────────────────────────────────────────────────────
private
void
AdjustTimer
(
float
delta
)
{
UpdateTimerBy
(
delta
);
_timeLeft
=
Mathf
.
Clamp
(
_timeLeft
,
0
,
CsPrefabBuilder
.
Instance
.
startTime
);
_timeLeft
=
Mathf
.
Clamp
(
_timeLeft
+
delta
,
0f
,
CsPrefabBuilder
.
Instance
.
startTime
);
// Re-check tick state after adjustment
if
(
_timeLeft
<
4f
&&
!
_isTicking
)
if
(
_timeLeft
<
_quarterTime
&&
!
_isTicking
)
{
_isTicking
=
true
;
SSAudioManager
.
Instance
?.
Tick
(
true
);
}
else
if
(
_timeLeft
>=
4f
&&
_isTicking
)
else
if
(
_timeLeft
>=
_quarterTime
&&
_isTicking
)
{
_isTicking
=
false
;
SSAudioManager
.
Instance
?.
Tick
(
false
);
}
uiManager
?.
UpdateTimer
(
_timeLeft
,
delta
>
0
);
...
...
My project/Assets/ScienceStreet/CS/Scripts/CsUIManager.cs
View file @
e58e68d9
...
...
@@ -505,9 +505,9 @@ namespace com.al_arcade.cs
public
void
SetTimer
(
float
time
)
{
if
(
isTweening
)
return
;
_timerSlider
.
value
=
time
/
30f
;
_timerFill
.
color
=
time
>
4f
?
_timerDefaultColor
:
SSColorPalette
.
Danger
;
float
quarter
=
CsPrefabBuilder
.
Instance
.
startTime
/
4f
;
_timerSlider
.
value
=
time
/
CsPrefabBuilder
.
Instance
.
startTime
;
_timerFill
.
color
=
time
>
quarter
?
_timerDefaultColor
:
SSColorPalette
.
Danger
;
}
public
void
EnableScore
(
bool
value
)
{
...
...
@@ -525,27 +525,22 @@ namespace com.al_arcade.cs
public
void
UpdateTimer
(
float
time
,
bool
pos
)
{
isTweening
=
true
;
float
quarter
=
CsPrefabBuilder
.
Instance
.
startTime
/
4f
;
var
color
=
pos
?
SSColorPalette
.
CorrectWord
:
SSColorPalette
.
Danger
;
_timerSlider
.
transform
.
DOPunchScale
(
Vector3
.
one
*
0.1f
,
0.3f
,
8
,
0.3f
);
_timerFill
.
DOColor
(
color
,
0.2f
).
SetEase
(
Ease
.
OutQuad
).
OnComplete
(()
=>
{
_timerFill
.
DOColor
(
_timerDefaultColor
,
0.2f
).
SetEase
(
Ease
.
OutQuad
);
});
var
targetTime
=
time
;
// ✅ after the flash, return to red if still in danger zone, normal if above quarter
Color
restingColor
=
time
>
quarter
?
_timerDefaultColor
:
SSColorPalette
.
Danger
;
// Account for tween time
if
(!
pos
)
{
targetTime
-=
0.3f
;
}
_timerSlider
.
DOValue
(
targetTime
/
30f
,
0.3f
).
SetEase
(
Ease
.
OutQuad
).
OnComplete
(()
=>
var
flashColor
=
pos
?
SSColorPalette
.
CorrectWord
:
SSColorPalette
.
Danger
;
_timerSlider
.
transform
.
DOPunchScale
(
Vector3
.
one
*
0.1f
,
0.3f
,
8
,
0.3f
);
_timerFill
.
DOColor
(
flashColor
,
0.2f
).
SetEase
(
Ease
.
OutQuad
).
OnComplete
(()
=>
{
isTweening
=
false
;
_timerFill
.
DOColor
(
restingColor
,
0.2f
).
SetEase
(
Ease
.
OutQuad
);
// ✅ smart resting color
});
var
targetTime
=
pos
?
time
:
time
-
0.3f
;
_timerSlider
.
DOValue
(
targetTime
/
CsPrefabBuilder
.
Instance
.
startTime
,
0.3f
)
.
SetEase
(
Ease
.
OutQuad
)
.
OnComplete
(()
=>
isTweening
=
false
);
}
public
void
ResetUI
()
...
...
My project/Assets/ScienceStreet/MCQ/Scripts/McqUIManager.cs
View file @
e58e68d9
...
...
@@ -190,13 +190,11 @@ namespace com.al_arcade.mcq
public
void
SetTimer
(
float
time
)
{
if
(
_isTweening
)
return
;
float
quarter
=
McqPrefabBuilder
.
Instance
.
startTime
/
4f
;
if
(
_timerSlider
!=
null
)
_timerSlider
.
value
=
time
/
McqPrefabBuilder
.
Instance
.
startTime
;
if
(
_timerFill
!=
null
)
_timerFill
.
color
=
time
>
4f
?
_timerDefaultColor
:
SSColorPalette
.
Danger
;
_timerFill
.
color
=
time
>
quarter
?
_timerDefaultColor
:
SSColorPalette
.
Danger
;
// ✅ red below quarter
if
(
_timerText
!=
null
)
_timerText
.
Text
=
Mathf
.
CeilToInt
(
time
).
ToString
();
}
...
...
@@ -205,21 +203,22 @@ namespace com.al_arcade.mcq
public
void
UpdateTimer
(
float
time
,
bool
positive
)
{
_isTweening
=
true
;
float
quarter
=
McqPrefabBuilder
.
Instance
.
startTime
/
4f
;
var
flashColor
=
positive
?
SSColorPalette
.
CorrectWord
:
SSColorPalette
.
Danger
;
// ✅ after flash, go red if still in danger zone, normal if bonus pushed us above quarter
Color
restingColor
=
time
>
quarter
?
_timerDefaultColor
:
SSColorPalette
.
Danger
;
var
flashColor
=
positive
?
SSColorPalette
.
CorrectWord
:
SSColorPalette
.
Danger
;
if
(
_timerSlider
!=
null
)
_timerSlider
.
transform
.
DOPunchScale
(
Vector3
.
one
*
0.1f
,
0.3f
,
8
,
0.3f
);
if
(
_timerFill
!=
null
)
{
_timerFill
.
DOColor
(
flashColor
,
0.2f
).
SetEase
(
Ease
.
OutQuad
)
.
OnComplete
(()
=>
_timerFill
.
DOColor
(
_timerDefaultColor
,
0.2f
).
SetEase
(
Ease
.
OutQuad
));
_timerFill
.
DOColor
(
restingColor
,
0.2f
).
SetEase
(
Ease
.
OutQuad
));
// ✅ smart resting color
}
float
targetTime
=
positive
?
time
:
time
-
0.3f
;
if
(
_timerSlider
!=
null
)
{
_timerSlider
.
DOValue
(
targetTime
/
McqPrefabBuilder
.
Instance
.
startTime
,
0.3f
)
...
...
My project/Assets/ScienceStreet/Shared/Scripts/SSAudioManager.cs
View file @
e58e68d9
using
UnityEngine
;
using
System.Collections.Generic
;
...
...
@@ -87,18 +87,26 @@ namespace com.al_arcade.shared
{
if
(
start
)
{
if
(
_tickingSource
.
isPlaying
)
{
_tickingSource
.
Stop
();
}
if
(
_tickingSource
.
isPlaying
)
return
;
// ✅ prevent restart
_tickingSource
.
clip
=
tickingLoop
;
_tickingSource
.
loop
=
true
;
// ✅ IMPORTANT
_tickingSource
.
pitch
=
1f
;
// reset
_tickingSource
.
Play
();
}
else
{
_tickingSource
.
Stop
();
if
(
_tickingSource
.
isPlaying
)
_tickingSource
.
Stop
();
}
}
// ADD this new method below the existing Tick() method
public
void
SetTickPitch
(
float
pitch
)
{
if
(
_tickingSource
!=
null
&&
_tickingSource
.
isPlaying
)
_tickingSource
.
pitch
=
Mathf
.
Clamp
(
pitch
,
1f
,
3f
);
}
public
void
StopMusic
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment