BoulderFix Script added
This commit is contained in:
parent
645c21bb95
commit
0b69c75627
15
Assets/AssetsFORELLE/Prefabs/boulder.prefab
generated
15
Assets/AssetsFORELLE/Prefabs/boulder.prefab
generated
@ -12,6 +12,7 @@ GameObject:
|
|||||||
- component: {fileID: 2931262115788872084}
|
- component: {fileID: 2931262115788872084}
|
||||||
- component: {fileID: 8547966821854904316}
|
- component: {fileID: 8547966821854904316}
|
||||||
- component: {fileID: 5950443230785378104}
|
- component: {fileID: 5950443230785378104}
|
||||||
|
- component: {fileID: 8814372359582481795}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: boulder
|
m_Name: boulder
|
||||||
m_TagString: PressurePlatable
|
m_TagString: PressurePlatable
|
||||||
@ -133,3 +134,17 @@ Rigidbody2D:
|
|||||||
m_SleepingMode: 1
|
m_SleepingMode: 1
|
||||||
m_CollisionDetection: 0
|
m_CollisionDetection: 0
|
||||||
m_Constraints: 4
|
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}
|
||||||
|
43
Assets/AssetsFORELLE/Script/BoulderFix.cs
Normal file
43
Assets/AssetsFORELLE/Script/BoulderFix.cs
Normal file
@ -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<Rigidbody2D>();
|
||||||
|
bc = GetComponent<BoxCollider2D>();
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
Assets/AssetsFORELLE/Script/BoulderFix.cs.meta
generated
Normal file
11
Assets/AssetsFORELLE/Script/BoulderFix.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2de907f50474c5b40bb803c5f51866f7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
11
Assets/Frictionful.physicsMaterial2D
Normal file
11
Assets/Frictionful.physicsMaterial2D
Normal file
@ -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
|
8
Assets/Frictionful.physicsMaterial2D.meta
generated
Normal file
8
Assets/Frictionful.physicsMaterial2D.meta
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b200e3c05da9fc94486c5941e94bd715
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 6200000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/Scenes/Prototype.unity
generated
8
Assets/Scenes/Prototype.unity
generated
@ -2016,7 +2016,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 170098608}
|
m_GameObject: {fileID: 170098608}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
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_LocalScale: {x: 0.42547998, y: 0.3653795, z: 0.42548}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@ -39327,11 +39327,11 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2931262115788872107, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}
|
- target: {fileID: 2931262115788872107, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: 28.087334
|
value: 28.23
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2931262115788872107, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}
|
- target: {fileID: 2931262115788872107, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 0.26070547
|
value: 0.27
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2931262115788872107, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}
|
- target: {fileID: 2931262115788872107, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
@ -39375,7 +39375,7 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 6200000, guid: 9a162dcdc92b4194ba53630f8785bed1, type: 2}
|
objectReference: {fileID: 6200000, guid: 9a162dcdc92b4194ba53630f8785bed1, type: 2}
|
||||||
- target: {fileID: 5950443230785378104, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}
|
- target: {fileID: 5950443230785378104, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}
|
||||||
propertyPath: m_LinearDrag
|
propertyPath: m_LinearDrag
|
||||||
value: 5
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: a72839b3ed4bd20458a1b530b3f3d5bc, type: 3}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user