We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7207600 commit 05c3e42Copy full SHA for 05c3e42
Assets/Prefabs/Pipes.prefab
@@ -26,7 +26,7 @@ Transform:
26
m_PrefabAsset: {fileID: 0}
27
m_GameObject: {fileID: 6053768793515663617}
28
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
29
- m_LocalPosition: {x: 0, y: -4.5, z: 0}
+ m_LocalPosition: {x: 0, y: -3.25, z: 0}
30
m_LocalScale: {x: 1, y: 1, z: 1}
31
m_Children: []
32
m_Father: {fileID: 6053768794356161904}
@@ -134,7 +134,7 @@ Transform:
134
135
m_GameObject: {fileID: 6053768794093319262}
136
m_LocalRotation: {x: 1, y: -0, z: -0, w: 0}
137
- m_LocalPosition: {x: 0, y: 4.5, z: 0}
+ m_LocalPosition: {x: 0, y: 3.25, z: 0}
138
139
140
@@ -265,6 +265,7 @@ MonoBehaviour:
265
top: {fileID: 6053768794093319263}
266
bottom: {fileID: 6053768793515663630}
267
speed: 5
268
+ gap: 3
269
--- !u!1 &7818968135391167135
270
GameObject:
271
m_ObjectHideFlags: 0
Assets/Scenes/Flappy Bird.unity
@@ -271,6 +271,7 @@ MonoBehaviour:
m_Name:
272
m_EditorClassIdentifier:
273
player: {fileID: 527830928}
274
+ spawner: {fileID: 2105631072}
275
scoreText: {fileID: 1474871343}
276
playButton: {fileID: 892178073}
277
gameOver: {fileID: 298509898}
@@ -1111,7 +1112,8 @@ MonoBehaviour:
1111
1112
m_Script: {fileID: 11500000, guid: 374f7314a96d6a04d91aa0f1f644322b, type: 3}
1113
1114
- prefab: {fileID: 6053768794356161907, guid: c1db09ac3ccffc742bbc907d839e8f3a, type: 3}
1115
+ prefab: {fileID: -5845766125972383839, guid: c1db09ac3ccffc742bbc907d839e8f3a, type: 3}
1116
spawnRate: 1
1117
minHeight: -1
1118
maxHeight: 2
1119
+ verticalGap: 3
Assets/Scripts/GameManager.cs
@@ -7,6 +7,7 @@ public class GameManager : MonoBehaviour
7
public static GameManager Instance { get; private set; }
8
9
[SerializeField] private Player player;
10
+ [SerializeField] private Spawner spawner;
11
[SerializeField] private Text scoreText;
12
[SerializeField] private GameObject playButton;
13
[SerializeField] private GameObject gameOver;
Assets/Scripts/Pipes.cs
@@ -5,12 +5,15 @@ public class Pipes : MonoBehaviour
5
public Transform top;
6
public Transform bottom;
public float speed = 5f;
+ public float gap = 3f;
private float leftEdge;
private void Start()
{
14
leftEdge = Camera.main.ScreenToWorldPoint(Vector3.zero).x - 1f;
15
+ top.position += Vector3.up * gap / 2;
16
+ bottom.position += Vector3.down * gap / 2;
17
}
18
19
private void Update()
Assets/Scripts/Spawner.cs
@@ -2,10 +2,11 @@
2
3
public class Spawner : MonoBehaviour
4
- public GameObject prefab;
+ public Pipes prefab;
public float spawnRate = 1f;
public float minHeight = -1f;
public float maxHeight = 2f;
+ public float verticalGap = 3f;
private void OnEnable()
@@ -19,8 +20,9 @@ private void OnDisable()
20
21
private void Spawn()
22
- GameObject pipes = Instantiate(prefab, transform.position, Quaternion.identity);
23
+ Pipes pipes = Instantiate(prefab, transform.position, Quaternion.identity);
24
pipes.transform.position += Vector3.up * Random.Range(minHeight, maxHeight);
25
+ pipes.gap = verticalGap;
0 commit comments