diff --git a/Assets/AssetsFORELLE/Prefabs/boulder.prefab b/Assets/AssetsFORELLE/Prefabs/boulder.prefab index 6204879..bcee928 100644 --- a/Assets/AssetsFORELLE/Prefabs/boulder.prefab +++ b/Assets/AssetsFORELLE/Prefabs/boulder.prefab @@ -12,6 +12,7 @@ GameObject: - component: {fileID: 2931262115788872084} - component: {fileID: 8547966821854904316} - component: {fileID: 5950443230785378104} + - component: {fileID: 8814372359582481795} m_Layer: 0 m_Name: boulder m_TagString: PressurePlatable @@ -133,3 +134,17 @@ Rigidbody2D: m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 4 +--- !u!114 &8814372359582481795 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2931262115788872085} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2de907f50474c5b40bb803c5f51866f7, type: 3} + m_Name: + m_EditorClassIdentifier: + frictionless: {fileID: 6200000, guid: 9a162dcdc92b4194ba53630f8785bed1, type: 2} + frictionful: {fileID: 6200000, guid: b200e3c05da9fc94486c5941e94bd715, type: 2} diff --git a/Assets/AssetsFORELLE/Script/BoulderFix.cs b/Assets/AssetsFORELLE/Script/BoulderFix.cs new file mode 100644 index 0000000..262020d --- /dev/null +++ b/Assets/AssetsFORELLE/Script/BoulderFix.cs @@ -0,0 +1,43 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class BoulderFix : MonoBehaviour + +{ + + private Rigidbody2D rb; + private BoxCollider2D bc; + [SerializeField] private PhysicsMaterial2D frictionless; + [SerializeField] private PhysicsMaterial2D frictionful; + + void Start() + { + rb = GetComponent(); + bc = GetComponent(); + rb.mass = 8; + rb.drag = 1; + + } + + // Update is called once per frame + void Update() + { + + } + + void OnCollisionEnter2D(Collision2D col) + { + bc.sharedMaterial = frictionless; + rb.drag = 3; + + } + + void OnCollisionExit2D(Collision2D col) + { + bc.sharedMaterial = frictionful; + rb.drag = 1; + + } + +} diff --git a/Assets/AssetsFORELLE/Script/BoulderFix.cs.meta b/Assets/AssetsFORELLE/Script/BoulderFix.cs.meta new file mode 100644 index 0000000..d5d85aa --- /dev/null +++ b/Assets/AssetsFORELLE/Script/BoulderFix.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2de907f50474c5b40bb803c5f51866f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Frictionful.physicsMaterial2D b/Assets/Frictionful.physicsMaterial2D new file mode 100644 index 0000000..b9d990a --- /dev/null +++ b/Assets/Frictionful.physicsMaterial2D @@ -0,0 +1,11 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!62 &6200000 +PhysicsMaterial2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Frictionful + friction: 50 + bounciness: 0 diff --git a/Assets/Frictionful.physicsMaterial2D.meta b/Assets/Frictionful.physicsMaterial2D.meta new file mode 100644 index 0000000..18fd39c --- /dev/null +++ b/Assets/Frictionful.physicsMaterial2D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b200e3c05da9fc94486c5941e94bd715 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 6200000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Prototype.unity b/Assets/Scenes/Prototype.unity index e596a85..563bbb0 100644 --- a/Assets/Scenes/Prototype.unity +++ b/Assets/Scenes/Prototype.unity @@ -2016,7 +2016,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 170098608} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -36.74, y: 2.17, z: -0.022044204} + m_LocalPosition: {x: -37.52, y: 2.08, z: -0.022044204} m_LocalScale: {x: 0.42547998, y: 0.3653795, z: 0.42548} m_ConstrainProportionsScale: 0 m_Children: [] @@ -39327,11 +39327,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 2931262115788872107, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3} propertyPath: m_LocalPosition.x - value: 28.087334 + value: 28.23 objectReference: {fileID: 0} - target: {fileID: 2931262115788872107, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3} propertyPath: m_LocalPosition.y - value: 0.26070547 + value: 0.27 objectReference: {fileID: 0} - target: {fileID: 2931262115788872107, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3} propertyPath: m_LocalPosition.z @@ -39375,7 +39375,7 @@ PrefabInstance: objectReference: {fileID: 6200000, guid: 9a162dcdc92b4194ba53630f8785bed1, type: 2} - target: {fileID: 5950443230785378104, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3} propertyPath: m_LinearDrag - value: 5 + value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}