Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
proto_classification_base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SOS-DM
proto_classification_base
Commits
75609fb2
Commit
75609fb2
authored
1 year ago
by
CUNIN Clemence
Browse files
Options
Downloads
Patches
Plain Diff
Ajout timer
parent
fa99ed80
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Assets/Scenes/V0.unity
+129
-0
129 additions, 0 deletions
Assets/Scenes/V0.unity
Assets/Scripts/GameTimer.cs
+51
-0
51 additions, 0 deletions
Assets/Scripts/GameTimer.cs
Assets/Scripts/GameTimer.cs.meta
+11
-0
11 additions, 0 deletions
Assets/Scripts/GameTimer.cs.meta
with
191 additions
and
0 deletions
Assets/Scenes/V0.unity
+
129
−
0
View file @
75609fb2
...
...
@@ -123,6 +123,85 @@ NavMeshSettings:
debug
:
m_Flags
:
0
m_NavMeshData
:
{
fileID
:
0
}
---
!u!1
&302566360
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
302566363
}
-
component
:
{
fileID
:
302566362
}
-
component
:
{
fileID
:
302566361
}
m_Layer
:
5
m_Name
:
Timer
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&302566361
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
302566360
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
5f7201a12d95ffc409449d95f23cf332
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
1
,
g
:
0.06774929
,
b
:
0
,
a
:
1
}
m_RaycastTarget
:
1
m_RaycastPadding
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
0
}
m_Maskable
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_FontData
:
m_Font
:
{
fileID
:
10102
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
m_FontSize
:
15
m_FontStyle
:
1
m_BestFit
:
0
m_MinSize
:
1
m_MaxSize
:
40
m_Alignment
:
0
m_AlignByGeometry
:
0
m_RichText
:
1
m_HorizontalOverflow
:
0
m_VerticalOverflow
:
0
m_LineSpacing
:
1
m_Text
:
New Text
---
!u!222
&302566362
CanvasRenderer
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
302566360
}
m_CullTransparentMesh
:
1
---
!u!224
&302566363
RectTransform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
302566360
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
-0
}
m_LocalScale
:
{
x
:
5
,
y
:
10
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
5310696331365926257
}
m_RootOrder
:
1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchoredPosition
:
{
x
:
4964
,
y
:
2199
}
m_SizeDelta
:
{
x
:
160
,
y
:
30
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!1
&443585353
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -535,6 +614,51 @@ Transform:
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
3
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!1
&1406246512
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
1406246514
}
-
component
:
{
fileID
:
1406246513
}
m_Layer
:
0
m_Name
:
Timer
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&1406246513
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1406246512
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
0c84bc8d8e04ab94aa29f92e2070d449
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
timeRemaining
:
15
timeText
:
{
fileID
:
302566361
}
---
!u!4
&1406246514
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1406246512
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
8
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!1001
&1424735135
PrefabInstance
:
m_ObjectHideFlags
:
0
...
...
@@ -892,3 +1016,8 @@ PrefabInstance:
objectReference
:
{
fileID
:
0
}
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
b7db0de3f095c8146a99ef43e6d81422
,
type
:
3
}
---
!u!224
&5310696331365926257
stripped
RectTransform
:
m_CorrespondingSourceObject
:
{
fileID
:
5310696331881220764
,
guid
:
b7db0de3f095c8146a99ef43e6d81422
,
type
:
3
}
m_PrefabInstance
:
{
fileID
:
5310696331365926256
}
m_PrefabAsset
:
{
fileID
:
0
}
This diff is collapsed.
Click to expand it.
Assets/Scripts/GameTimer.cs
0 → 100644
+
51
−
0
View file @
75609fb2
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine.EventSystems
;
using
UnityEngine.UI
;
using
UnityEngine
;
public
class
GameTimer
:
MonoBehaviour
{
public
float
timeRemaining
=
15
;
private
bool
timerIsRunning
=
false
;
public
Text
timeText
;
// Start is called before the first frame update
void
Start
()
{
timerIsRunning
=
true
;
Debug
.
Log
(
"Timer has started"
);
}
// Update is called once per frame
void
Update
()
{
if
(
timerIsRunning
){
if
(
timeRemaining
>
0
)
{
timeRemaining
-=
Time
.
deltaTime
;
DisplayTimer
(
timeRemaining
);
}
else
{
timeRemaining
=
0
;
timerIsRunning
=
false
;
Debug
.
Log
(
"End of game session"
);
//Execute the back button actions
GameObject
button
=
GameObject
.
Find
(
"Back"
);
var
eventSystem
=
EventSystem
.
current
;
ExecuteEvents
.
Execute
(
button
.
gameObject
,
new
BaseEventData
(
eventSystem
),
ExecuteEvents
.
submitHandler
);
}
}
}
void
DisplayTimer
(
float
time
){
time
+=
1
;
float
minutes
=
Mathf
.
FloorToInt
(
time
/
60
);
float
seconds
=
Mathf
.
FloorToInt
(
time
%
60
);
timeText
.
text
=
string
.
Format
(
"{0:00}:{1:00}"
,
minutes
,
seconds
);
}
}
This diff is collapsed.
Click to expand it.
Assets/Scripts/GameTimer.cs.meta
0 → 100644
+
11
−
0
View file @
75609fb2
fileFormatVersion: 2
guid: 0c84bc8d8e04ab94aa29f92e2070d449
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment