Moving Platforms Improvement

This commit is contained in:
Syntriax 2022-02-26 11:10:26 +03:00
parent ea9da84b2e
commit bee004a425
3 changed files with 130 additions and 10 deletions

View File

@ -190,7 +190,7 @@ MonoBehaviour:
m_ShowCameraFrustum: 1
m_IgnoreTimeScale: 0
m_WorldUpOverride: {fileID: 0}
m_UpdateMethod: 2
m_UpdateMethod: 0
m_BlendUpdateMethod: 1
m_DefaultBlend:
m_Style: 1

View File

@ -1,5 +1,37 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7993102083136317301
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4113497873755004013}
m_Layer: 0
m_Name: Platforms
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4113497873755004013
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7993102083136317301}
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_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7303924638498732051}
m_Father: {fileID: 1356359347258250021}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8562577587959612430
GameObject:
m_ObjectHideFlags: 0
@ -28,6 +60,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4339765521323171834}
- {fileID: 2287249310054695465}
- {fileID: 2047378177058907366}
- {fileID: 1130031776185018102}
@ -42,11 +75,11 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1356359347258250021}
m_TransformParent: {fileID: 3712973690855544599}
m_Modifications:
- target: {fileID: 2215831379607469555, guid: 166a1e67df866c64990d98902fcbeb71, type: 3}
propertyPath: m_RootOrder
value: 4
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2215831379607469555, guid: 166a1e67df866c64990d98902fcbeb71, type: 3}
propertyPath: m_LocalPosition.x
@ -94,6 +127,11 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 166a1e67df866c64990d98902fcbeb71, type: 3}
--- !u!4 &4339765521323171834 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2215831379607469555, guid: 166a1e67df866c64990d98902fcbeb71, type: 3}
m_PrefabInstance: {fileID: 2520264655673106953}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &2543712135427947457
PrefabInstance:
m_ObjectHideFlags: 0
@ -103,7 +141,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_RootOrder
value: 2
value: 3
objectReference: {fileID: 0}
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_LocalPosition.x
@ -165,7 +203,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_RootOrder
value: 1
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_LocalPosition.x
@ -227,7 +265,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_RootOrder
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_LocalPosition.x
@ -289,7 +327,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_RootOrder
value: 4
value: 5
objectReference: {fileID: 0}
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_LocalPosition.x
@ -351,7 +389,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_RootOrder
value: 3
value: 4
objectReference: {fileID: 0}
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_LocalPosition.x
@ -404,6 +442,76 @@ Transform:
m_CorrespondingSourceObject: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
m_PrefabInstance: {fileID: 5273357631831035851}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &5382002804764389994
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 4113497873755004013}
m_Modifications:
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_LocalPosition.x
value: -15.22
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_LocalPosition.y
value: -0.5
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349117, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: speed
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349117, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: xOffset
value: -5
objectReference: {fileID: 0}
- target: {fileID: 3453266731971349118, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
propertyPath: m_Name
value: Moving_Platform_Medium
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
--- !u!4 &7303924638498732051 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3453266731971349113, guid: 821831f062ee52848b6bda27fba0b001, type: 3}
m_PrefabInstance: {fileID: 5382002804764389994}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &8416596561142867036
PrefabInstance:
m_ObjectHideFlags: 0
@ -2581,7 +2689,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_RootOrder
value: 5
value: 6
objectReference: {fileID: 0}
- target: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
propertyPath: m_LocalPosition.x

View File

@ -95,5 +95,17 @@ namespace Platforms
return 0.0f;
}
private void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.CompareTag("Player"))
other.transform.SetParent(transform);
}
private void OnCollisionExit2D(Collision2D other)
{
if (other.gameObject.CompareTag("Player"))
other.transform.SetParent(null);
}
}
}
}