This commit is contained in:
Cat Flynn 2021-03-10 17:41:09 +00:00
parent 091b078713
commit 762bbf6486
3 changed files with 60 additions and 14 deletions

View File

@ -26,6 +26,7 @@ GameObject:
- component: {fileID: 980120856895548940}
- component: {fileID: 980120856895548939}
- component: {fileID: 980120856895548943}
- component: {fileID: 3536778402394572832}
m_Layer: 0
m_Name: FallawayFloor
m_TagString: Untagged
@ -100,8 +101,36 @@ Rigidbody:
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_Constraints: 122
m_CollisionDetection: 0
--- !u!114 &3536778402394572832
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8773676356524340268}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0a5de09a27d949d4db67034f55c57e6b, type: 3}
m_Name:
m_EditorClassIdentifier:
_event: {fileID: 11400000, guid: 6e31084a96bb93a44a85563a6208d0da, type: 2}
_response:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 980120856895548939}
m_TargetAssemblyTypeName: FallawayFloor, Assembly-CSharp
m_MethodName: Reset
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1001 &5711263752094586620
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -2538,11 +2538,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y
value: -0.017264403
value: -0.017264389
objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z
value: 0.009297725
value: 0.009297717
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalPosition.x
@ -2558,19 +2558,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.w
value: 0.9680315
value: 0.968031
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.x
value: 0.24655113
value: 0.24655096
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y
value: 0.044697873
value: 0.044709474
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z
value: -0.011384248
value: -0.011387202
objectReference: {fileID: 0}
- target: {fileID: 4676633831414007564, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_Name
@ -2702,19 +2702,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.w
value: 0.9996367
value: 0.9996364
objectReference: {fileID: 0}
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.x
value: 0.0047710985
value: 0.0047711134
objectReference: {fileID: 0}
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y
value: 0.023356276
value: 0.023366831
objectReference: {fileID: 0}
- target: {fileID: 4676633832928372887, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z
value: -0.012578499
value: -0.0125841815
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}

View File

@ -1,8 +1,10 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class FallawayFloor : MonoBehaviour
{
// Speed at which the object moves towards the ground.
@ -16,6 +18,7 @@ public class FallawayFloor : MonoBehaviour
[SerializeField] private Renderer _renderer;
Rigidbody rb;
private Vector3 _initialPosition;
private void Start()
{
@ -29,7 +32,7 @@ public class FallawayFloor : MonoBehaviour
{
// Start the Destroy floor coroutine and switch to the dissolve material.
StartCoroutine(DestroyFloor());
_renderer.material = dissolve;
// _renderer.material = dissolve;
}
}
@ -37,9 +40,23 @@ public class FallawayFloor : MonoBehaviour
{
// Take fallAwayTime, speed, and destroyObjectTime from editor and apply
yield return new WaitForSeconds(fallAwayTime);
rb.velocity = Vector3.down * speed;
yield return new WaitForSeconds(destroyObjectTime);
Destroy(gameObject);
// Destroy(gameObject);
}
public void Reset()
{
transform.position = _initialPosition;
}
}
#if UNITY_EDITOR
public class FallawayFloorEditor : Editor
{
}
#endif