Skip to content

Commit

Permalink
penaltyTime finish
Browse files Browse the repository at this point in the history
  • Loading branch information
bozmir committed Dec 20, 2024
1 parent ba23530 commit 18b715c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Assets/Timer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Netherlands3D.Twin
{
public class Timer : MonoBehaviour
{
public float PenaltyTimePerBooth = 5;
public bool TimeIsRunning = false;
private float initialTime;

Expand Down Expand Up @@ -49,6 +50,14 @@ public void Finish()
{
TimeIsRunning = false;
FinishedTime = Time.timeSinceLevelLoad - initialTime;

float penaltyTime = 0;
StempelTrigger[] triggers = FindObjectsOfType<StempelTrigger>();
foreach (StempelTrigger trigger in triggers)
if (!trigger.IsCollected)
penaltyTime += PenaltyTimePerBooth;
FinishedTime += penaltyTime;

Finished.Invoke(FinishedTime);
}
}
Expand Down

0 comments on commit 18b715c

Please sign in to comment.