aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'nGJ2019')
-rw-r--r--nGJ2019/Assets/Prefabs/CaveWalls.prefab26
-rw-r--r--nGJ2019/Assets/Prefabs/NarrowPassage.prefab26
-rw-r--r--nGJ2019/Assets/Prefabs/ObstacleRockBottom.prefab14
-rw-r--r--nGJ2019/Assets/Prefabs/ObstacleRockTop.prefab14
-rw-r--r--nGJ2019/Assets/Prefabs/RockJaws.prefab264
-rw-r--r--nGJ2019/Assets/Prefabs/RockJaws.prefab.meta7
-rw-r--r--nGJ2019/Assets/Scenes/Marcin_sandbox.unity3
-rw-r--r--nGJ2019/Assets/Scripts/LevelScrolling.cs6
-rw-r--r--nGJ2019/Assets/Scripts/ObstacleSpawner.cs1
-rw-r--r--nGJ2019/Assets/Scripts/RockJaws.cs37
10 files changed, 394 insertions, 4 deletions
diff --git a/nGJ2019/Assets/Prefabs/CaveWalls.prefab b/nGJ2019/Assets/Prefabs/CaveWalls.prefab
index 57cc21b..c57f273 100644
--- a/nGJ2019/Assets/Prefabs/CaveWalls.prefab
+++ b/nGJ2019/Assets/Prefabs/CaveWalls.prefab
@@ -47,6 +47,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 15.39, y: 5.46, z: 1}
m_Center: {x: 4.2, y: -3.84, z: 0}
+--- !u!114 &1476987822071927303
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 7538015035249639830}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ type: 0
--- !u!65 &2761854514729097118
BoxCollider:
m_ObjectHideFlags: 0
@@ -60,6 +73,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 14.07, y: 4.32, z: 1}
m_Center: {x: 3.2, y: 0.96, z: 0}
+--- !u!114 &1133591621666355702
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 7538015035695901050}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ type: 0
--- !u!1001 &1998900776986113251
PrefabInstance:
m_ObjectHideFlags: 0
diff --git a/nGJ2019/Assets/Prefabs/NarrowPassage.prefab b/nGJ2019/Assets/Prefabs/NarrowPassage.prefab
index 214eb1a..8cfd19e 100644
--- a/nGJ2019/Assets/Prefabs/NarrowPassage.prefab
+++ b/nGJ2019/Assets/Prefabs/NarrowPassage.prefab
@@ -47,6 +47,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 15.39, y: 5.46, z: 1}
m_Center: {x: 4.2, y: -3.84, z: 0}
+--- !u!114 &5698759635590018609
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 7538015035249639830}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ type: 3
--- !u!65 &2761854514729097118
BoxCollider:
m_ObjectHideFlags: 0
@@ -60,6 +73,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 14.07, y: 4.32, z: 1}
m_Center: {x: 3.2, y: 0.96, z: 0}
+--- !u!114 &503257385840296578
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 7538015035695901050}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ type: 3
--- !u!1001 &1998900776986113251
PrefabInstance:
m_ObjectHideFlags: 0
diff --git a/nGJ2019/Assets/Prefabs/ObstacleRockBottom.prefab b/nGJ2019/Assets/Prefabs/ObstacleRockBottom.prefab
index a9498c0..d8a53ac 100644
--- a/nGJ2019/Assets/Prefabs/ObstacleRockBottom.prefab
+++ b/nGJ2019/Assets/Prefabs/ObstacleRockBottom.prefab
@@ -10,6 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 3886813090550119731}
- component: {fileID: 5594498704066045325}
+ - component: {fileID: 6017278592914902894}
m_Layer: 0
m_Name: ObstacleRockBottom
m_TagString: Untagged
@@ -48,6 +49,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 7.15, y: 4.08, z: 1}
m_Center: {x: 0.27, y: 0, z: 0}
+--- !u!114 &6017278592914902894
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 264553704504758048}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ type: 2
--- !u!1 &1796633522054151795
GameObject:
m_ObjectHideFlags: 0
diff --git a/nGJ2019/Assets/Prefabs/ObstacleRockTop.prefab b/nGJ2019/Assets/Prefabs/ObstacleRockTop.prefab
index 7b15e8c..cb55207 100644
--- a/nGJ2019/Assets/Prefabs/ObstacleRockTop.prefab
+++ b/nGJ2019/Assets/Prefabs/ObstacleRockTop.prefab
@@ -10,6 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 1255536267988802439}
- component: {fileID: 4652515155153534203}
+ - component: {fileID: 6145614806330494837}
m_Layer: 0
m_Name: ObstacleRockTop
m_TagString: Untagged
@@ -50,6 +51,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 7.55, y: 4.14, z: 1}
m_Center: {x: 0, y: 1.15, z: 0}
+--- !u!114 &6145614806330494837
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2825962919672506772}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ type: 1
--- !u!1 &4820912184054354174
GameObject:
m_ObjectHideFlags: 0
diff --git a/nGJ2019/Assets/Prefabs/RockJaws.prefab b/nGJ2019/Assets/Prefabs/RockJaws.prefab
new file mode 100644
index 0000000..a9b91be
--- /dev/null
+++ b/nGJ2019/Assets/Prefabs/RockJaws.prefab
@@ -0,0 +1,264 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &1998900778231223134
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1998900778231223133}
+ - component: {fileID: 7713002535168256047}
+ m_Layer: 0
+ m_Name: RockJaws
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1998900778231223133
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1998900778231223134}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -7.886415, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 6829481666799721321}
+ - {fileID: 6829481667242832773}
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &7713002535168256047
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1998900778231223134}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: b69da2d4b545440ed86bcb8e72e0a7eb, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ TopJaw: {fileID: 6829481666799721321}
+ BottomJaw: {fileID: 6829481667242832773}
+ Speed: 10
+--- !u!65 &7350926945773242645
+BoxCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 7538015035249639830}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 1
+ m_Enabled: 1
+ serializedVersion: 2
+ m_Size: {x: 9.5, y: 5.46, z: 1}
+ m_Center: {x: 1.06, y: -3.84, z: 0}
+--- !u!114 &8957168230144321536
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 7538015035249639830}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ type: 4
+--- !u!65 &2761854514729097118
+BoxCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 7538015035695901050}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 1
+ m_Enabled: 1
+ serializedVersion: 2
+ m_Size: {x: 7, y: 4.32, z: 1}
+ m_Center: {x: 0, y: 0.96, z: 0}
+--- !u!114 &3978623340426940721
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 7538015035695901050}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ type: 4
+--- !u!1001 &1998900778239684723
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 1998900778231223133}
+ m_Modifications:
+ - target: {fileID: -927199367670048503, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_Name
+ value: obstacle_rock_top
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 1.830543
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 4.74
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_LocalRotation.x
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_LocalRotation.y
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_LocalRotation.z
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_RootOrder
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: 416fae093739c55499f7dcb7d4f7f2c9, type: 3}
+--- !u!1 &7538015035695901050 stripped
+GameObject:
+ m_CorrespondingSourceObject: {fileID: -927199367670048503, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ m_PrefabInstance: {fileID: 1998900778239684723}
+ m_PrefabAsset: {fileID: 0}
+--- !u!4 &6829481666799721321 stripped
+Transform:
+ m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9,
+ type: 3}
+ m_PrefabInstance: {fileID: 1998900778239684723}
+ m_PrefabAsset: {fileID: 0}
+--- !u!1001 &1998900778732132511
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 1998900778231223133}
+ m_Modifications:
+ - target: {fileID: -927199367670048503, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_Name
+ value: obstacle_rock_bottom_1
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 1.1761003
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_LocalPosition.y
+ value: -1.39
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_LocalRotation.x
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_LocalRotation.y
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_LocalRotation.z
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_RootOrder
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: fbb1d264bae087340a30a49b9b9e0148, type: 3}
+--- !u!1 &7538015035249639830 stripped
+GameObject:
+ m_CorrespondingSourceObject: {fileID: -927199367670048503, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ m_PrefabInstance: {fileID: 1998900778732132511}
+ m_PrefabAsset: {fileID: 0}
+--- !u!4 &6829481667242832773 stripped
+Transform:
+ m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148,
+ type: 3}
+ m_PrefabInstance: {fileID: 1998900778732132511}
+ m_PrefabAsset: {fileID: 0}
diff --git a/nGJ2019/Assets/Prefabs/RockJaws.prefab.meta b/nGJ2019/Assets/Prefabs/RockJaws.prefab.meta
new file mode 100644
index 0000000..5c1e1ac
--- /dev/null
+++ b/nGJ2019/Assets/Prefabs/RockJaws.prefab.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: a2b1bab6b90944171a71ff986bce4ebf
+PrefabImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/nGJ2019/Assets/Scenes/Marcin_sandbox.unity b/nGJ2019/Assets/Scenes/Marcin_sandbox.unity
index 5bd670d..a066ed9 100644
--- a/nGJ2019/Assets/Scenes/Marcin_sandbox.unity
+++ b/nGJ2019/Assets/Scenes/Marcin_sandbox.unity
@@ -466,7 +466,8 @@ MonoBehaviour:
type: 3}
narrowPassagePrefab: {fileID: 1998900778231223134, guid: ce339cccf24f74448af698eb997a3d95,
type: 3}
- rockJawsPrefab: {fileID: 0}
+ rockJawsPrefab: {fileID: 1998900778231223134, guid: a2b1bab6b90944171a71ff986bce4ebf,
+ type: 3}
scrolling: {fileID: 202725831}
spawnLine: 13.5
--- !u!1001 &1920748800
diff --git a/nGJ2019/Assets/Scripts/LevelScrolling.cs b/nGJ2019/Assets/Scripts/LevelScrolling.cs
index 025bf40..0122a69 100644
--- a/nGJ2019/Assets/Scripts/LevelScrolling.cs
+++ b/nGJ2019/Assets/Scripts/LevelScrolling.cs
@@ -4,7 +4,7 @@ using UnityEngine;
public class LevelScrolling : MonoBehaviour
{
- public int UpdateRate = 1;
+ public int UpdateRate = -5;
public List<Transform> Obstacles;
public Transform Background;
@@ -56,14 +56,14 @@ public class LevelScrolling : MonoBehaviour
{
foreach (var o in Obstacles)
{
- o.Translate(new Vector2(0.01f * UpdateRate, 0));
+ o.Translate(0.01f * UpdateRate, 0, 0);
}
}
private void MoveBackground()
{
if (Background.position.x > -initialBgPos.x)
- Background.Translate(new Vector2(0.01f * UpdateRate, 0));
+ Background.Translate(0.01f * UpdateRate, 0, 0);
else Background.position = initialBgPos;
}
}
diff --git a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
index a9d1078..c285352 100644
--- a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
+++ b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs
@@ -47,6 +47,7 @@ public class ObstacleSpawner : MonoBehaviour
timeline.Add(2, 2.75f, ObstacleType.rockTop);
timeline.Add(8, -2, ObstacleType.rockBottom);
timeline.Add(20, 0, ObstacleType.narrowPassage);
+ timeline.Add(30, 0, ObstacleType.rockJaws);
timeline.OnSpawnEvent += spawnOnEvent;
}
diff --git a/nGJ2019/Assets/Scripts/RockJaws.cs b/nGJ2019/Assets/Scripts/RockJaws.cs
new file mode 100644
index 0000000..a161dfe
--- /dev/null
+++ b/nGJ2019/Assets/Scripts/RockJaws.cs
@@ -0,0 +1,37 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class RockJaws : MonoBehaviour
+{
+ public Transform TopJaw;
+ public Transform BottomJaw;
+ public int Speed = 10;
+ private bool reverse = false;
+ private float initialTopJawY;
+ // Start is called before the first frame update
+ void Start()
+ {
+ initialTopJawY = TopJaw.localPosition.y;
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+
+ void FixedUpdate()
+ {
+ if (TopJaw.localPosition.y < BottomJaw.localPosition.y) reverse = true;
+ else if(TopJaw.localPosition.y > initialTopJawY) reverse = false;
+
+ if (!reverse) {
+ TopJaw.Translate(0, -0.01f * Speed, 0);
+ BottomJaw.Translate(0, 0.01f * Speed, 0);
+ } else {
+ TopJaw.Translate(0, 0.01f * Speed, 0);
+ BottomJaw.Translate(0, -0.01f * Speed, 0);
+ }
+ }
+}