fix falling floor
This commit is contained in:
parent
e3fb789cc3
commit
f5630b4140
File diff suppressed because it is too large
Load Diff
|
@ -186,22 +186,42 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: -53.25
|
value: -53.25
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 20060037679400276, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
- target: {fileID: 144586784117801156, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: fallAwayTime
|
||||||
value: -42.600002
|
value: 0.1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 562383713938988229, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
- target: {fileID: 1942448527754983935, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: fallAwayTime
|
||||||
value: -45.86
|
value: 0.1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2798628020550802209, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
- target: {fileID: 2798628020550802209, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: -22.93
|
value: -22.93
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2965657895286721982, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3245217566131802716, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3281454039531256279, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
- target: {fileID: 3281454039531256279, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: -69.71
|
value: -69.71
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3360258782664561703, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3981923049291870994, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4156655533860185189, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4232342903992215198, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
- target: {fileID: 4232342903992215198, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 0.73425376
|
value: 0.73425376
|
||||||
|
@ -282,6 +302,22 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: -0.918
|
value: -0.918
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6266323790267379902, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7426531598355393719, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7942849190331623678, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8106824084488338523, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8164979977984596284, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
- target: {fileID: 8164979977984596284, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: -34.4
|
value: -34.4
|
||||||
|
@ -302,6 +338,14 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: -52.25
|
value: -52.25
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8651459415071025888, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8819770543696869825, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
|
propertyPath: fallAwayTime
|
||||||
|
value: 0.1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
||||||
--- !u!1001 &717263452
|
--- !u!1001 &717263452
|
||||||
|
@ -313,43 +357,47 @@ PrefabInstance:
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 0.9983446
|
value: 0.70522034
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: -0.000000029802322
|
value: 0.17927231
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: -0.057483047
|
value: 0.67019784
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: -0.0019679694
|
value: -0.14615275
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: 1.4999695
|
value: -0.03934002
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0.25224686
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: -0.72949576
|
value: -2.7196157
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 0.73425376
|
value: 0.9719741
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: -0.012565184
|
value: 0.22945173
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: -0.6786595
|
value: 0.0497995
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: -0.011613807
|
value: -0.011756055
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633831414007564, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633831414007564, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
|
@ -399,29 +447,45 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 0.9983446
|
value: 0.70522034
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: -0.000000029802322
|
value: 0.17927231
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: -0.057483047
|
value: 0.67019784
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832789495666, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: -0.0019679703
|
value: -0.14615275
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832858914731, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832858914731, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: 1.4999695
|
value: -0.03934002
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4676633832858914731, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0.25224686
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832858914731, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832858914731, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: -0.72949576
|
value: -2.7196157
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832858914731, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832858914731, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
|
@ -441,19 +505,19 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 1
|
value: 0.6771322
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: -0.00000005401671
|
value: 0.1721321
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: -0.000000059604645
|
value: 0.6990174
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: -9.313226e-10
|
value: -0.15243754
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
|
||||||
|
@ -476,25 +540,6 @@ MeshCollider:
|
||||||
m_Convex: 0
|
m_Convex: 0
|
||||||
m_CookingOptions: 30
|
m_CookingOptions: 30
|
||||||
m_Mesh: {fileID: 5640169193314376071, guid: 84d1abd228b21df47af6e0f4750ab193, type: 3}
|
m_Mesh: {fileID: 5640169193314376071, guid: 84d1abd228b21df47af6e0f4750ab193, type: 3}
|
||||||
--- !u!1 &1183116868 stripped
|
|
||||||
GameObject:
|
|
||||||
m_CorrespondingSourceObject: {fileID: 902459002871088767, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 287275404}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
--- !u!64 &1183116870
|
|
||||||
MeshCollider:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1183116868}
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_IsTrigger: 0
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 4
|
|
||||||
m_Convex: 0
|
|
||||||
m_CookingOptions: 30
|
|
||||||
m_Mesh: {fileID: 0}
|
|
||||||
--- !u!1 &1879987206
|
--- !u!1 &1879987206
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -588,22 +633,3 @@ Transform:
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||||
--- !u!1 &1929861194 stripped
|
|
||||||
GameObject:
|
|
||||||
m_CorrespondingSourceObject: {fileID: 7252998261761054088, guid: c34bb57a623bd394194f47d4b62e9c22, type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 287275404}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
--- !u!64 &1929861198
|
|
||||||
MeshCollider:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1929861194}
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_IsTrigger: 0
|
|
||||||
m_Enabled: 1
|
|
||||||
serializedVersion: 4
|
|
||||||
m_Convex: 0
|
|
||||||
m_CookingOptions: 30
|
|
||||||
m_Mesh: {fileID: 5640169193314376071, guid: 84d1abd228b21df47af6e0f4750ab193, type: 3}
|
|
||||||
|
|
|
@ -5,19 +5,19 @@ using System.Collections.Generic;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[RequireComponent(typeof(Rigidbody))]
|
|
||||||
public class FallawayFloor : MonoBehaviour
|
public class FallawayFloor : MonoBehaviour
|
||||||
{
|
{
|
||||||
// // Speed at which the object moves towards the ground.
|
// // Speed at which the object moves towards the ground.
|
||||||
public float speed;
|
public float speed;
|
||||||
|
|
||||||
// Time it takes for ogjecct to begin moving towards the ground.
|
// Time it takes for ogjecct to begin moving towards the ground.
|
||||||
public float fallAwayTime;
|
public float fallAwayTime;
|
||||||
|
|
||||||
[SerializeField] private TrapSettings _settings;
|
[SerializeField] private TrapSettings _settings;
|
||||||
[SerializeField] private GameObject _graphics;
|
[SerializeField] private GameObject _graphics;
|
||||||
|
|
||||||
private Rigidbody rb;
|
|
||||||
private Vector3 initialPosition;
|
private Vector3 initialPosition;
|
||||||
|
private Vector3 velocity;
|
||||||
|
|
||||||
public bool Falling => _triggered;
|
public bool Falling => _triggered;
|
||||||
private bool _triggered = false;
|
private bool _triggered = false;
|
||||||
|
@ -25,9 +25,6 @@ public class FallawayFloor : MonoBehaviour
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
initialPosition = transform.position;
|
initialPosition = transform.position;
|
||||||
|
|
||||||
// Get Rigidbody component.
|
|
||||||
rb = GetComponent<Rigidbody>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LateUpdate()
|
private void LateUpdate()
|
||||||
|
@ -50,6 +47,11 @@ public class FallawayFloor : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
|
transform.position += velocity * Time.fixedDeltaTime * _settings.ObjectTimeScale;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnTriggerEnter(Collider other)
|
private void OnTriggerEnter(Collider other)
|
||||||
{
|
{
|
||||||
if (!_triggered && other.CompareTag("Player"))
|
if (!_triggered && other.CompareTag("Player"))
|
||||||
|
@ -73,7 +75,7 @@ public class FallawayFloor : MonoBehaviour
|
||||||
if (_triggered) return;
|
if (_triggered) return;
|
||||||
|
|
||||||
// time stop
|
// time stop
|
||||||
if ( _settings.ObjectTimeScale.AsBool ) return;
|
if (_settings.ObjectTimeScale.AsBool) return;
|
||||||
|
|
||||||
StartCoroutine(FallCR());
|
StartCoroutine(FallCR());
|
||||||
}
|
}
|
||||||
|
@ -82,7 +84,7 @@ public class FallawayFloor : MonoBehaviour
|
||||||
{
|
{
|
||||||
_triggered = true;
|
_triggered = true;
|
||||||
|
|
||||||
_graphics.transform.DOShakePosition(
|
var shake = _graphics.transform.DOShakePosition(
|
||||||
fallAwayTime,
|
fallAwayTime,
|
||||||
_settings.FallawayFloor.ShakeStrength);
|
_settings.FallawayFloor.ShakeStrength);
|
||||||
FMODUnity.RuntimeManager.PlayOneShot(_settings.FallawayFloor.FMODEvent);
|
FMODUnity.RuntimeManager.PlayOneShot(_settings.FallawayFloor.FMODEvent);
|
||||||
|
@ -90,14 +92,22 @@ public class FallawayFloor : MonoBehaviour
|
||||||
// wait a moment
|
// wait a moment
|
||||||
yield return new WaitForSeconds(fallAwayTime);
|
yield return new WaitForSeconds(fallAwayTime);
|
||||||
|
|
||||||
|
float elapsed = 0f;
|
||||||
|
while (elapsed < fallAwayTime)
|
||||||
|
{
|
||||||
|
var dt = _settings.ObjectTimeScale;
|
||||||
|
elapsed += Time.deltaTime * dt;
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
// fall
|
// fall
|
||||||
rb.velocity = Vector3.down * speed;
|
velocity = Vector3.down * speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_triggered = false;
|
_triggered = false;
|
||||||
transform.position = initialPosition;
|
transform.position = initialPosition;
|
||||||
rb.velocity = Vector3.zero;
|
velocity = Vector3.zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue