aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <zelent.marcin@gmail.com>2019-04-28 03:40:14 +0200
committermarcinzelent <zelent.marcin@gmail.com>2019-04-28 03:40:14 +0200
commit80cff62241a7e10e46d54ba62648076e93a734a1 (patch)
tree6d0ce7b3fc2c5065e7f11f4a2c8c15136f78557d /nGJ2019/Assets/Scripts
parent700b762e57ab6c15ee63beaa8bd6e9e922947b71 (diff)
Added title screen
Diffstat (limited to 'nGJ2019/Assets/Scripts')
-rw-r--r--nGJ2019/Assets/Scripts/Messenger.cs4
-rw-r--r--nGJ2019/Assets/Scripts/ObstacleSpawner.cs20
-rw-r--r--nGJ2019/Assets/Scripts/TitleScreen.cs25
3 files changed, 39 insertions, 10 deletions
diff --git a/nGJ2019/Assets/Scripts/Messenger.cs b/nGJ2019/Assets/Scripts/Messenger.cs
index 21d2f8d..c86bcce 100644
--- a/nGJ2019/Assets/Scripts/Messenger.cs
+++ b/nGJ2019/Assets/Scripts/Messenger.cs
@@ -15,8 +15,8 @@ public class Messenger : MonoBehaviour
{
timeline = Spawner.GetEventTimeline();
- timeline.Add(1, "Test");
- timeline.Add(3, "");
+ //timeline.Add(1, "Test");
+ //timeline.Add(3, "");
timeline.OnMessageEvent += MessageOnEvent;
}
diff --git a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
index 4c4028f..3c09e6f 100644
--- a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
+++ b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -43,15 +43,19 @@ public class ObstacleSpawner : MonoBehaviour
void Start()
{
- for (int i = 0; i < 120; i += 5)
+ var scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene();
+ if (scene.name == "TitleScreen")
{
- timeline.Add(i, new Vector3(0, 0, 0), ObstacleType.caveWalls);
+ for (int i = 0; i < 1000; i++)
+ {
+ timeline.Add(i * 2.5f, new Vector3(0, 0, 0), ObstacleType.caveWalls);
+ timeline.Add(i * 12.5f + 3, new Vector3(0, 2.75f, 0), ObstacleType.rockTop);
+ timeline.Add(i * 12.5f + 6, new Vector3(0, -2, 0), ObstacleType.rockBottom);
+ timeline.Add(i * 12.5f + 9, new Vector3(0, 0, 0), ObstacleType.narrowPassage);
+ timeline.Add(i * 12.5f + 12.5f, new Vector3(0, -2.5f, 2), ObstacleType.rockJaws);
+ timeline.Add(i * 12.5f + 15f, new Vector3(0, 0.5f, 3), ObstacleType.net);
+ }
}
- timeline.Add(0, new Vector3(0, 2.75f, 0), ObstacleType.rockTop);
- timeline.Add(6, new Vector3(0, -2, 0), ObstacleType.rockBottom);
- timeline.Add(12, new Vector3(0, 0, 0), ObstacleType.narrowPassage);
- timeline.Add(20, new Vector3(0, -2.5f, 2), ObstacleType.rockJaws);
- timeline.Add(25, new Vector3(0, 0.5f, 3), ObstacleType.net);
timeline.OnSpawnEvent += spawnOnEvent;
}
diff --git a/nGJ2019/Assets/Scripts/TitleScreen.cs b/nGJ2019/Assets/Scripts/TitleScreen.cs
new file mode 100644
index 0000000..d439c51
--- /dev/null
+++ b/nGJ2019/Assets/Scripts/TitleScreen.cs
@@ -0,0 +1,25 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.EventSystems;
+using UnityEngine.SceneManagement;
+
+public class TitleScreen : MonoBehaviour
+{
+ void Update()
+ {
+ // quit application when back button is clicked
+ if (Input.GetKeyDown(KeyCode.Escape))
+ Application.Quit();
+ }
+
+ public void ToLevel1()
+ {
+ SceneManager.LoadScene("Level1");
+ }
+
+ public void Quit()
+ {
+ Application.Quit();
+ }
+}