aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <zelent.marcin@gmail.com>2019-04-27 22:02:42 +0200
committermarcinzelent <zelent.marcin@gmail.com>2019-04-27 22:02:42 +0200
commit932a418c3f2251d434b67d115aaa380b51685ef7 (patch)
tree560e0851521252a85ba65abc06310d3ca24a5897
parentc6cc2672f7033d099630238b72549b42507e6ebd (diff)
Added net obstacle
-rw-r--r--nGJ2019/Assets/Prefabs/Net.prefab155
-rw-r--r--nGJ2019/Assets/Prefabs/Net.prefab.meta7
-rw-r--r--nGJ2019/Assets/Scenes/Marcin_sandbox.unity8
-rw-r--r--nGJ2019/Assets/Scripts/LevelScrolling.cs2
-rw-r--r--nGJ2019/Assets/Scripts/ObstacleSpawner.cs110
-rw-r--r--nGJ2019/Assets/Scripts/ObstacleType.cs2
6 files changed, 226 insertions, 58 deletions
diff --git a/nGJ2019/Assets/Prefabs/Net.prefab b/nGJ2019/Assets/Prefabs/Net.prefab
new file mode 100644
index 0000000..a062489
--- /dev/null
+++ b/nGJ2019/Assets/Prefabs/Net.prefab
@@ -0,0 +1,155 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!65 &2069605559480401724
+BoxCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2575384151648682035}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 2
+ m_Size: {x: 1.7593225, y: 1.677966, z: 0.020000031}
+ m_Center: {x: 0.00000047668814, y: 0.00000002980232, z: -0.010000003}
+--- !u!114 &3040956702141405622
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2575384151648682035}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ type: 5
+--- !u!1 &5435085934957895830
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 4608654727184290691}
+ m_Layer: 0
+ m_Name: Net
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &4608654727184290691
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 5435085934957895830}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 17.166718, y: 2.0016038, z: -26.1938}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1578164108839498272}
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1001 &5808648649210566970
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 4608654727184290691}
+ m_Modifications:
+ - target: {fileID: -927199367670048503, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_Name
+ value: net_1
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalPosition.x
+ value: -0.003036499
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 0.009361267
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalRotation.x
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalRotation.y
+ value: -0.7786035
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalRotation.z
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 0.6275163
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_RootOrder
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: -102.26601
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalScale.x
+ value: 4.94472
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalScale.y
+ value: 4.94472
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ propertyPath: m_LocalScale.z
+ value: 4.94472
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: 7077c39c18eb97e489e858f6908bb67c, type: 3}
+--- !u!1 &2575384151648682035 stripped
+GameObject:
+ m_CorrespondingSourceObject: {fileID: -927199367670048503, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ m_PrefabInstance: {fileID: 5808648649210566970}
+ m_PrefabAsset: {fileID: 0}
+--- !u!4 &1578164108839498272 stripped
+Transform:
+ m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c,
+ type: 3}
+ m_PrefabInstance: {fileID: 5808648649210566970}
+ m_PrefabAsset: {fileID: 0}
diff --git a/nGJ2019/Assets/Prefabs/Net.prefab.meta b/nGJ2019/Assets/Prefabs/Net.prefab.meta
new file mode 100644
index 0000000..ae29c1a
--- /dev/null
+++ b/nGJ2019/Assets/Prefabs/Net.prefab.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 459b4334249a5491ca7e8e02a92f8141
+PrefabImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/nGJ2019/Assets/Scenes/Marcin_sandbox.unity b/nGJ2019/Assets/Scenes/Marcin_sandbox.unity
index 42a9843..068ee2d 100644
--- a/nGJ2019/Assets/Scenes/Marcin_sandbox.unity
+++ b/nGJ2019/Assets/Scenes/Marcin_sandbox.unity
@@ -381,7 +381,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1342555976}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
- m_LocalPosition: {x: 8.886415, y: 0, z: 0}
+ m_LocalPosition: {x: 8.886415, y: 0, z: 10}
m_LocalScale: {x: 1.736111, y: 1.736111, z: 1}
m_Children: []
m_Father: {fileID: 202725832}
@@ -404,7 +404,7 @@ SpriteRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
+ - {fileID: 2100000, guid: 5d5aaa9c2f47c436b922e7b7869e8557, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@@ -423,7 +423,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
- m_SortingOrder: -1
+ m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 420921107e115344ea4e97eeb2bca416, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@@ -664,6 +664,8 @@ MonoBehaviour:
type: 3}
rockJawsPrefab: {fileID: 1998900778231223134, guid: a2b1bab6b90944171a71ff986bce4ebf,
type: 3}
+ netPrefab: {fileID: 5435085934957895830, guid: 459b4334249a5491ca7e8e02a92f8141,
+ type: 3}
scrolling: {fileID: 202725831}
spawnLine: 13.5
--- !u!1 &1695765865
diff --git a/nGJ2019/Assets/Scripts/LevelScrolling.cs b/nGJ2019/Assets/Scripts/LevelScrolling.cs
index 9835f0e..7ca89e3 100644
--- a/nGJ2019/Assets/Scripts/LevelScrolling.cs
+++ b/nGJ2019/Assets/Scripts/LevelScrolling.cs
@@ -49,7 +49,7 @@ public class LevelScrolling : MonoBehaviour
Background.localScale = new Vector3(finalHeight, finalHeight, 1);
var viewportX = Camera.main.ViewportToWorldPoint(new Vector3(0, 1, 0)).x;
- Background.position = new Vector3(viewportX * -1, 0, 0);
+ Background.position = new Vector3(viewportX * -1, 0, 10);
initialBgPos = Background.position;
}
diff --git a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
index a23b8aa..1615714 100644
--- a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
+++ b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
@@ -4,68 +4,72 @@ using UnityEngine;
public class ObstacleSpawner : MonoBehaviour
{
- private EventTimeline timeline = new EventTimeline();
+ private EventTimeline timeline = new EventTimeline();
- public GameObject caveWallsPrefab, rockTopPrefab, rockBottomPrefab, narrowPassagePrefab, rockJawsPrefab;
- public LevelScrolling scrolling;
+ public GameObject caveWallsPrefab, rockTopPrefab, rockBottomPrefab, narrowPassagePrefab, rockJawsPrefab, netPrefab;
+ public LevelScrolling scrolling;
- public float spawnLine;
+ public float spawnLine;
- private void spawnOnEvent(EventTimeline.SpawnEvent e)
- {
- GameObject prefab = null;
-
- switch (e.type)
+ private void spawnOnEvent(EventTimeline.SpawnEvent e)
{
- case ObstacleType.caveWalls:
- prefab = caveWallsPrefab;
- break;
- case ObstacleType.rockTop:
- prefab = rockTopPrefab;
- break;
- case ObstacleType.rockBottom:
- prefab = rockBottomPrefab;
- break;
- case ObstacleType.narrowPassage:
- prefab = narrowPassagePrefab;
- break;
- case ObstacleType.rockJaws:
- prefab = rockJawsPrefab;
- break;
- }
+ GameObject prefab = null;
- var o = Instantiate(prefab, new Vector3(spawnLine, e.position.y, e.position.z), Quaternion.identity);
- scrolling.Obstacles.Add(o);
- }
+ switch (e.type)
+ {
+ case ObstacleType.caveWalls:
+ prefab = caveWallsPrefab;
+ break;
+ case ObstacleType.rockTop:
+ prefab = rockTopPrefab;
+ break;
+ case ObstacleType.rockBottom:
+ prefab = rockBottomPrefab;
+ break;
+ case ObstacleType.narrowPassage:
+ prefab = narrowPassagePrefab;
+ break;
+ case ObstacleType.rockJaws:
+ prefab = rockJawsPrefab;
+ break;
+ case ObstacleType.net:
+ prefab = netPrefab;
+ break;
+ }
- void Start()
- {
- for (int i = 0; i < 120; i += 5)
- {
- timeline.Add(i, new Vector3(0, 0, 0), ObstacleType.caveWalls);
+ var o = Instantiate(prefab, new Vector3(spawnLine, e.position.y, e.position.z), Quaternion.identity);
+ scrolling.Obstacles.Add(o);
}
- timeline.Add(2, new Vector3(0, 2.75f, 0), ObstacleType.rockTop);
- timeline.Add(8, new Vector3(0, -2, 0), ObstacleType.rockBottom);
- timeline.Add(20, new Vector3(0, 0, 0), ObstacleType.narrowPassage);
- timeline.Add(30, new Vector3(0, 0, 1), ObstacleType.rockJaws);
- timeline.OnSpawnEvent += spawnOnEvent;
- }
+ void Start()
+ {
+ for (int i = 0; i < 120; i += 5)
+ {
+ timeline.Add(i, new Vector3(0, 0, 0), ObstacleType.caveWalls);
+ }
+ 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, 0, 2), ObstacleType.rockJaws);
+ timeline.Add(25, new Vector3(0, 0.5f, 3), ObstacleType.net);
+
+ timeline.OnSpawnEvent += spawnOnEvent;
+ }
- // Update is called once per frame
- void Update()
- {
- timeline.timeTick(Time.deltaTime);
- }
+ // Update is called once per frame
+ void Update()
+ {
+ timeline.timeTick(Time.deltaTime);
+ }
- void OnDrawGizmosSelected()
- {
- Gizmos.color = Color.green;
- Gizmos.DrawLine(new Vector3(spawnLine, -10, 0), new Vector3(spawnLine, 10, 0));
- }
+ void OnDrawGizmosSelected()
+ {
+ Gizmos.color = Color.green;
+ Gizmos.DrawLine(new Vector3(spawnLine, -10, 0), new Vector3(spawnLine, 10, 0));
+ }
- public EventTimeline GetEventTimeline()
- {
- return timeline;
- }
+ public EventTimeline GetEventTimeline()
+ {
+ return timeline;
+ }
}
diff --git a/nGJ2019/Assets/Scripts/ObstacleType.cs b/nGJ2019/Assets/Scripts/ObstacleType.cs
index 79a4980..c97a2ed 100644
--- a/nGJ2019/Assets/Scripts/ObstacleType.cs
+++ b/nGJ2019/Assets/Scripts/ObstacleType.cs
@@ -2,4 +2,4 @@
using System.Collections.Generic;
using UnityEngine;
-public enum ObstacleType { caveWalls, rockTop, rockBottom, narrowPassage, rockJaws }
+public enum ObstacleType { caveWalls, rockTop, rockBottom, narrowPassage, rockJaws, net }