diff options
author | marcinzelent <zelent.marcin@gmail.com> | 2019-04-28 01:00:52 +0200 |
---|---|---|
committer | marcinzelent <zelent.marcin@gmail.com> | 2019-04-28 01:00:52 +0200 |
commit | 790e527dc4433beadf12abaee618da9650699a82 (patch) | |
tree | 1436e8d0c6acff5de1494c90da42cc06aa92ca3a /nGJ2019 | |
parent | 563f06e6caf98b6112952fe1065ddeabc327ea83 (diff) |
Updated rock jaws model
Diffstat (limited to 'nGJ2019')
-rw-r--r-- | nGJ2019/Assets/Prefabs/RockJaws.prefab | 248 | ||||
-rw-r--r-- | nGJ2019/Assets/Scripts/RockJaws.cs | 15 |
2 files changed, 148 insertions, 115 deletions
diff --git a/nGJ2019/Assets/Prefabs/RockJaws.prefab b/nGJ2019/Assets/Prefabs/RockJaws.prefab index 81143fd..227238f 100644 --- a/nGJ2019/Assets/Prefabs/RockJaws.prefab +++ b/nGJ2019/Assets/Prefabs/RockJaws.prefab @@ -1,264 +1,294 @@ %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: 1464312581659586306} - 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: +--- !u!65 &8896860774825481701 +BoxCollider: 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 &1464312581659586306 + m_GameObject: {fileID: 1663497088778258253} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 0.3735988, y: 0.36792317, z: 0.6026454} + m_Center: {x: 0, y: 0, z: 0.3013227} +--- !u!114 &4918903277008153292 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1998900778231223134} + m_GameObject: {fileID: 1663497088778258253} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: b69da2d4b545440ed86bcb8e72e0a7eb, type: 3} + m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3} m_Name: m_EditorClassIdentifier: - TopJaw: {fileID: 6829481666799721321} - BottomJaw: {fileID: 6829481667242832773} - Speed: 10 ---- !u!65 &7350926945773242645 + type: 4 +--- !u!65 &5394748020052435326 BoxCollider: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7538015035249639830} + m_GameObject: {fileID: 6355416010125707379} m_Material: {fileID: 0} - m_IsTrigger: 1 + m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 - m_Size: {x: 9.5, y: 5.46, z: 2.82} - m_Center: {x: 1.06, y: -3.84, z: -1.14} ---- !u!114 &4943350886894711678 + m_Size: {x: 0.3735988, y: 0.36792317, z: 0.6026454} + m_Center: {x: 0, y: 0, z: 0.3013227} +--- !u!114 &308759134702416259 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7538015035249639830} + m_GameObject: {fileID: 6355416010125707379} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3} m_Name: m_EditorClassIdentifier: type: 4 ---- !u!65 &2761854514729097118 -BoxCollider: +--- !u!1 &8765725572880811705 +GameObject: 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: 2.28} - m_Center: {x: 0, y: 0.96, z: -1.2} ---- !u!114 &4015049844703851200 + serializedVersion: 6 + m_Component: + - component: {fileID: 693510330793266352} + - component: {fileID: 1396177332742484901} + m_Layer: 0 + m_Name: RockJaws + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &693510330793266352 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8765725572880811705} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2400053636711363934} + - {fileID: 7956067138186869344} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1396177332742484901 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7538015035695901050} + m_GameObject: {fileID: 8765725572880811705} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3} + m_Script: {fileID: 11500000, guid: b69da2d4b545440ed86bcb8e72e0a7eb, type: 3} m_Name: m_EditorClassIdentifier: - type: 4 ---- !u!1001 &1998900778239684723 + TopJaw: {fileID: 2400053636711363934} + BottomJaw: {fileID: 7956067138186869344} + Speed: 10 +--- !u!1001 &3103846722658423162 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 1998900778231223133} + m_TransformParent: {fileID: 693510330793266352} m_Modifications: - - target: {fileID: -927199367670048503, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -927199367670048503, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_Name - value: obstacle_rock_top + value: obstacle_clasp (1) objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalPosition.x - value: 1.830543 + value: 0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalPosition.y - value: 4.74 + value: -7 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalRotation.x - value: -0 + value: -0.7071068 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalRotation.y value: -0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalRotation.z value: -0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalRotation.w - value: 1 + value: 0.7071068 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_RootOrder - value: 0 + value: 1 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, + type: 3} + propertyPath: m_LocalScale.x + value: 10 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, + type: 3} + propertyPath: m_LocalScale.y + value: 10 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, + type: 3} + propertyPath: m_LocalScale.z + value: 10 + objectReference: {fileID: 0} m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 416fae093739c55499f7dcb7d4f7f2c9, type: 3} ---- !u!1 &7538015035695901050 stripped + m_SourcePrefab: {fileID: 100100000, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} +--- !u!1 &6355416010125707379 stripped GameObject: - m_CorrespondingSourceObject: {fileID: -927199367670048503, guid: 416fae093739c55499f7dcb7d4f7f2c9, + m_CorrespondingSourceObject: {fileID: -927199367670048503, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} - m_PrefabInstance: {fileID: 1998900778239684723} + m_PrefabInstance: {fileID: 3103846722658423162} m_PrefabAsset: {fileID: 0} ---- !u!4 &6829481666799721321 stripped +--- !u!4 &7956067138186869344 stripped Transform: - m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: 416fae093739c55499f7dcb7d4f7f2c9, + m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} - m_PrefabInstance: {fileID: 1998900778239684723} + m_PrefabInstance: {fileID: 3103846722658423162} m_PrefabAsset: {fileID: 0} ---- !u!1001 &1998900778732132511 +--- !u!1001 &7220397062700473924 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 1998900778231223133} + m_TransformParent: {fileID: 693510330793266352} m_Modifications: - - target: {fileID: -927199367670048503, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -927199367670048503, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_Name - value: obstacle_rock_bottom_1 + value: obstacle_clasp objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalPosition.x - value: 1.1761003 + value: 0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalPosition.y - value: -1.39 + value: 7 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalRotation.x - value: -0 + value: -0.7071068 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalRotation.y value: -0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalRotation.z value: -0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalRotation.w - value: 1 + value: 0.7071068 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_RootOrder - value: 1 + value: 0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, + type: 3} + propertyPath: m_LocalScale.x + value: 10 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, + type: 3} + propertyPath: m_LocalScale.y + value: 10 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, + type: 3} + propertyPath: m_LocalScale.z + value: 10 + objectReference: {fileID: 0} m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: fbb1d264bae087340a30a49b9b9e0148, type: 3} ---- !u!1 &7538015035249639830 stripped + m_SourcePrefab: {fileID: 100100000, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} +--- !u!1 &1663497088778258253 stripped GameObject: - m_CorrespondingSourceObject: {fileID: -927199367670048503, guid: fbb1d264bae087340a30a49b9b9e0148, + m_CorrespondingSourceObject: {fileID: -927199367670048503, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} - m_PrefabInstance: {fileID: 1998900778732132511} + m_PrefabInstance: {fileID: 7220397062700473924} m_PrefabAsset: {fileID: 0} ---- !u!4 &6829481667242832773 stripped +--- !u!4 &2400053636711363934 stripped Transform: - m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: fbb1d264bae087340a30a49b9b9e0148, + m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: e96d5e2d0b2efc94baa1a79b449a4a21, type: 3} - m_PrefabInstance: {fileID: 1998900778732132511} + m_PrefabInstance: {fileID: 7220397062700473924} m_PrefabAsset: {fileID: 0} diff --git a/nGJ2019/Assets/Scripts/RockJaws.cs b/nGJ2019/Assets/Scripts/RockJaws.cs index a161dfe..874d6d3 100644 --- a/nGJ2019/Assets/Scripts/RockJaws.cs +++ b/nGJ2019/Assets/Scripts/RockJaws.cs @@ -23,15 +23,18 @@ public class RockJaws : MonoBehaviour void FixedUpdate()
{
- if (TopJaw.localPosition.y < BottomJaw.localPosition.y) reverse = true;
- else if(TopJaw.localPosition.y > initialTopJawY) reverse = false;
+ var topJawHeight= TopJaw.GetComponent<MeshRenderer>().bounds.size.y;
+ var bottomJawHeight= BottomJaw.GetComponent<MeshRenderer>().bounds.size.y;
+
+ if (TopJaw.localPosition.y - topJawHeight / 2 < BottomJaw.localPosition.y + bottomJawHeight / 2) 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);
+ TopJaw.Translate(0, -0.01f * Speed, 0, Space.World);
+ BottomJaw.Translate(0, 0.01f * Speed, 0, Space.World);
} else {
- TopJaw.Translate(0, 0.01f * Speed, 0);
- BottomJaw.Translate(0, -0.01f * Speed, 0);
+ TopJaw.Translate(0, 0.01f * Speed, 0, Space.World);
+ BottomJaw.Translate(0, -0.01f * Speed, 0, Space.World);
}
}
}
|