aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <zelent.marcin@gmail.com>2019-04-28 08:57:14 +0200
committermarcinzelent <zelent.marcin@gmail.com>2019-04-28 08:57:14 +0200
commit85441632d65425bdcaa76097e44e1f6f1f3bae7f (patch)
tree8ab4b462919eb826467563634339490e0b3d993b /nGJ2019/Assets
parent397abd83dc791d0d8cbbd20d918164c0c37143da (diff)
Added procedural obstacle generation to level 1
Diffstat (limited to 'nGJ2019/Assets')
-rw-r--r--nGJ2019/Assets/Scenes/Level1.unity4
-rw-r--r--nGJ2019/Assets/Scenes/TitleScreen.unity2
-rw-r--r--nGJ2019/Assets/Scenes/Tutorial.unity4
-rw-r--r--nGJ2019/Assets/Scripts/ObstacleSpawner.cs35
-rw-r--r--nGJ2019/Assets/Scripts/TitleScreen.cs2
5 files changed, 34 insertions, 13 deletions
diff --git a/nGJ2019/Assets/Scenes/Level1.unity b/nGJ2019/Assets/Scenes/Level1.unity
index f085597..1dd6d50 100644
--- a/nGJ2019/Assets/Scenes/Level1.unity
+++ b/nGJ2019/Assets/Scenes/Level1.unity
@@ -558,7 +558,7 @@ PrefabInstance:
- target: {fileID: 1540055299232912360, guid: 439782ce0455fb740be2c55da31ff44f,
type: 3}
propertyPath: m_LocalPosition.y
- value: 0.13672495
+ value: -1.09
objectReference: {fileID: 0}
- target: {fileID: 1540055299232912360, guid: 439782ce0455fb740be2c55da31ff44f,
type: 3}
@@ -871,7 +871,7 @@ MonoBehaviour:
type: 3}
liveCrystal: {fileID: 2100000, guid: d19c2d3c342b20c46b03be1f5369081d, type: 2}
deadCrystal: {fileID: 2100000, guid: a772733e42c983144b0a01570895aa30, type: 2}
- lives: 10
+ lives: 3
--- !u!4 &1651299503
Transform:
m_ObjectHideFlags: 0
diff --git a/nGJ2019/Assets/Scenes/TitleScreen.unity b/nGJ2019/Assets/Scenes/TitleScreen.unity
index b1d2c21..84c0188 100644
--- a/nGJ2019/Assets/Scenes/TitleScreen.unity
+++ b/nGJ2019/Assets/Scenes/TitleScreen.unity
@@ -420,7 +420,7 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 164273593}
- m_MethodName: ToLevel1
+ m_MethodName: OpenTutorial
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
diff --git a/nGJ2019/Assets/Scenes/Tutorial.unity b/nGJ2019/Assets/Scenes/Tutorial.unity
index 4aaf866..667f6ab 100644
--- a/nGJ2019/Assets/Scenes/Tutorial.unity
+++ b/nGJ2019/Assets/Scenes/Tutorial.unity
@@ -558,7 +558,7 @@ PrefabInstance:
- target: {fileID: 1540055299232912360, guid: 439782ce0455fb740be2c55da31ff44f,
type: 3}
propertyPath: m_LocalPosition.y
- value: 0.13672495
+ value: -1.09
objectReference: {fileID: 0}
- target: {fileID: 1540055299232912360, guid: 439782ce0455fb740be2c55da31ff44f,
type: 3}
@@ -871,7 +871,7 @@ MonoBehaviour:
type: 3}
liveCrystal: {fileID: 2100000, guid: d19c2d3c342b20c46b03be1f5369081d, type: 2}
deadCrystal: {fileID: 2100000, guid: a772733e42c983144b0a01570895aa30, type: 2}
- lives: 10
+ lives: 3
--- !u!4 &1651299503
Transform:
m_ObjectHideFlags: 0
diff --git a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
index bea85b2..84bc0d9 100644
--- a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
+++ b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
@@ -1,4 +1,5 @@
-using System.Collections;
+using System;
+using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -73,14 +74,34 @@ public class ObstacleSpawner : MonoBehaviour
}
else if (scene.name == "Level1")
{
+ System.Random random = new System.Random();
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(i * 2.5f, new Vector3(0,0,0), ObstacleType.caveWalls);
+
+ Array values = Enum.GetValues(typeof(ObstacleType));
+ ObstacleType randomObstacle = (ObstacleType)values.GetValue(random.Next(values.Length));
+ Vector3 position;
+
+ switch (randomObstacle)
+ {
+ case ObstacleType.rockTop:
+ position = new Vector3(0, 2.75f, 0);
+ break;
+ case ObstacleType.rockBottom:
+ position = new Vector3(0, -2, 0);
+ break;
+ case ObstacleType.rockJaws:
+ position = new Vector3(0, -2.5f, 2);
+ break;
+ case ObstacleType.net:
+ position = new Vector3(0, 0.5f, 3);
+ break;
+ default:
+ position = new Vector3(0,0,0);
+ break;
+ }
+ timeline.Add(i * 4, position, randomObstacle);
}
}
diff --git a/nGJ2019/Assets/Scripts/TitleScreen.cs b/nGJ2019/Assets/Scripts/TitleScreen.cs
index 3ec62b2..bf37785 100644
--- a/nGJ2019/Assets/Scripts/TitleScreen.cs
+++ b/nGJ2019/Assets/Scripts/TitleScreen.cs
@@ -13,7 +13,7 @@ public class TitleScreen : MonoBehaviour
Application.Quit();
}
- public void ToLevel1()
+ public void OpenTutorial()
{
SceneManager.LoadScene("Tutorial");
}