diff --git a/game/Assets/Scripts/Traps/objectTimeScale.asset b/game/Assets/Data/Variables/objectTimeScale.asset similarity index 100% rename from game/Assets/Scripts/Traps/objectTimeScale.asset rename to game/Assets/Data/Variables/objectTimeScale.asset diff --git a/game/Assets/Scripts/Traps/objectTimeScale.asset.meta b/game/Assets/Data/Variables/objectTimeScale.asset.meta similarity index 100% rename from game/Assets/Scripts/Traps/objectTimeScale.asset.meta rename to game/Assets/Data/Variables/objectTimeScale.asset.meta diff --git a/game/Assets/Scripts/Traps/FallawayFloor.cs b/game/Assets/Scripts/Traps/FallawayFloor.cs index 40e1571..560fb90 100644 --- a/game/Assets/Scripts/Traps/FallawayFloor.cs +++ b/game/Assets/Scripts/Traps/FallawayFloor.cs @@ -1,9 +1,5 @@ -using Ktyl.Util; -using System; using System.Collections; -using System.Collections.Generic; using DG.Tweening; -using Ktyl.Util; using UnityEngine; [RequireComponent(typeof(Rigidbody))] @@ -51,10 +47,9 @@ public class FallawayFloor : MonoBehaviour if (!_triggered.HasValue && other.CompareTag("Player")) { // Start the Destroy floor coroutine and switch to the dissolve material. - if (objectTimeScale != 0) + if (_settings.ObjectTimeScale != 0) { StartCoroutine(Fall()); - _renderer.material = dissolve; } } @@ -63,13 +58,12 @@ public class FallawayFloor : MonoBehaviour //The platform gets destroyed after the player resumes frozen time on a platform private void OnTriggerStay(Collider other) { - if (!_triggered && other.CompareTag("Player")) + if (!_triggered.HasValue && other.CompareTag("Player")) { // Start the Destroy floor coroutine and switch to the dissolve material. - if (objectTimeScale != 0) + if (_settings.ObjectTimeScale != 0) { StartCoroutine(Fall()); - _renderer.material = dissolve; } } } diff --git a/game/Assets/Scripts/Traps/TrapSettings.cs b/game/Assets/Scripts/Traps/TrapSettings.cs index 4e2eb54..b53b067 100644 --- a/game/Assets/Scripts/Traps/TrapSettings.cs +++ b/game/Assets/Scripts/Traps/TrapSettings.cs @@ -13,6 +13,9 @@ public class TrapSettings : ScriptableObject // how long the player has currently been safe for. -1 while the player is not // in a safe zone [SerializeField] private SerialFloat _safeTime; + + public float ObjectTimeScale => _objectTimeScale; + [SerializeField] private SerialFloat _objectTimeScale; [Serializable] public struct FallawayFloorSettings diff --git a/game/Assets/Settings/Traps/Trap Settings.asset b/game/Assets/Settings/Traps/Trap Settings.asset index 6e60573..102d1bf 100644 --- a/game/Assets/Settings/Traps/Trap Settings.asset +++ b/game/Assets/Settings/Traps/Trap Settings.asset @@ -13,6 +13,7 @@ MonoBehaviour: m_Name: Trap Settings m_EditorClassIdentifier: _safeTime: {fileID: 11400000, guid: 27c10a061baeec8469e96d4f995c1445, type: 2} + _objectTimeScale: {fileID: 11400000, guid: 9b68e167db44c0c42837e9a679da964e, type: 2} _fallawayFloor: _safeResetTime: 5 _fmodEvent: event:/Environment/Traps/FallingPlatform