Skip to content

Commit b83aefd

Browse files
committed
Game Over when animal or ball reach bounds.
1 parent f2a37e5 commit b83aefd

File tree

385 files changed

+116287
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+116287
-47
lines changed

Assets/Challenge 2/Scripts/DestroyOutOfBoundsX.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ void Update()
1616
else if (transform.position.y < _bottomLimit)
1717
{
1818
Destroy(gameObject);
19+
Debug.Log("Game Over !");
1920
}
2021

2122
}
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
using UnityEngine;
2+
using UnityEngine.SceneManagement;
23

34
public class PlayerControllerX : MonoBehaviour
45
{
5-
public GameObject DogPrefab;
6-
private readonly float _cdr = 2.0f;
7-
private float _lastPressed = 0.0f;
8-
private float _currentTime = 0.0f;
6+
public GameObject DogPrefab;
7+
private readonly float _cdr = 2.0f;
8+
private float _lastPressed = 0.0f;
9+
private float _currentTime = 0.0f;
910

1011

11-
private void Update()
12-
{
13-
_currentTime += Time.deltaTime;
14-
if (Input.GetKeyDown(KeyCode.Space) && _currentTime - _lastPressed >= _cdr)
15-
{
16-
_lastPressed = _currentTime;
17-
Instantiate(DogPrefab, transform.position, DogPrefab.transform.rotation);
18-
}
12+
private void Update()
13+
{
14+
_currentTime += Time.deltaTime;
15+
if (Input.GetKeyDown(KeyCode.Space) && _currentTime - _lastPressed >= _cdr)
16+
{
17+
_lastPressed = _currentTime;
18+
Instantiate(DogPrefab, transform.position, DogPrefab.transform.rotation);
19+
}
20+
if (Input.GetKeyDown(KeyCode.Escape))
21+
{
22+
SceneManager.LoadScene(0, LoadSceneMode.Single);
23+
}
1924

20-
}
25+
}
2126
}

Assets/Prefabs/Dog.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3099,7 +3099,7 @@ GameObject:
30993099
- component: {fileID: 4203633247082805962}
31003100
m_Layer: 0
31013101
m_Name: Dog
3102-
m_TagString: Untagged
3102+
m_TagString: Animal
31033103
m_Icon: {fileID: 0}
31043104
m_NavMeshLayer: 0
31053105
m_StaticEditorFlags: 0

Assets/Prefabs/Horse.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ GameObject:
12631263
- component: {fileID: 6062066238229488173}
12641264
m_Layer: 0
12651265
m_Name: Horse
1266-
m_TagString: Untagged
1266+
m_TagString: Animal
12671267
m_Icon: {fileID: 0}
12681268
m_NavMeshLayer: 0
12691269
m_StaticEditorFlags: 0

Assets/Prefabs/Moose.prefab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ GameObject:
897897
- component: {fileID: 142231783754432849}
898898
m_Layer: 0
899899
m_Name: Moose
900-
m_TagString: Untagged
900+
m_TagString: Animal
901901
m_Icon: {fileID: 0}
902902
m_NavMeshLayer: 0
903903
m_StaticEditorFlags: 0

0 commit comments

Comments
 (0)