fixed time freeze not working

This commit is contained in:
cyndrdev 2021-04-13 15:33:59 +01:00
parent fffb50a6a2
commit 07c89104f9
7 changed files with 71 additions and 15 deletions

View File

@ -318,18 +318,54 @@ PrefabInstance:
propertyPath: m_Camera
value:
objectReference: {fileID: 4676633831388223340}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.size
value: 10
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[5].m_ActionId
value: 0eb55067-1328-4b0a-9494-b427befe049a
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[9].m_ActionId
value: 5b0a923b-469a-4829-8f31-6fcd7cb49281
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[5].m_ActionName
value: CoreMap/New action
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[9].m_ActionName
value: ArtefactPreview/LookEnable[/Mouse/leftButton]
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[8].m_PersistentCalls.m_Calls.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[8].m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 4676633831945762667}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[8].m_PersistentCalls.m_Calls.Array.data[0].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[5].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: Blink
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[8].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: Freeze
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[8].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: PlayerInputHandler, Assembly-CSharp
objectReference: {fileID: 0}
- target: {fileID: 13726836969441780, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_ActionEvents.Array.data[8].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
value: UnityEngine.Object, UnityEngine
objectReference: {fileID: 0}
- target: {fileID: 13726836969441781, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: m_Name
value: Player
@ -342,6 +378,18 @@ PrefabInstance:
propertyPath: _freeze
value:
objectReference: {fileID: 11400000, guid: 0cd9cf6494bb6f54d9b97631010d780e, type: 2}
- target: {fileID: 13726837176080779, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: _cheatBlink
value: 1
objectReference: {fileID: 0}
- target: {fileID: 13726837176080779, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: _cheatBoost
value: 1
objectReference: {fileID: 0}
- target: {fileID: 13726837176080779, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
propertyPath: _cheatFreeze
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
--- !u!4 &4676633831945762709 stripped
@ -349,6 +397,17 @@ Transform:
m_CorrespondingSourceObject: {fileID: 13726836969441544, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
m_PrefabInstance: {fileID: 4672055586710847133}
m_PrefabAsset: {fileID: 0}
--- !u!114 &4676633831945762667 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 13726836969441782, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}
m_PrefabInstance: {fileID: 4672055586710847133}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e12816fc78a8ca3429be019aa4e51fdd, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &3150647428828152554 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7741442472643640439, guid: 5efe0b059275dbe48a4108d03ad03fd9, type: 3}

View File

@ -2314,14 +2314,6 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y
value: 0.15792163
objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z
value: -0.0165495
objectReference: {fileID: 0}
- target: {fileID: 4676633831414007564, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_Name
value: PlayerObjects

View File

@ -171,15 +171,20 @@ public class PlayerController : MonoBehaviour
{
_powers.Freeze.Consume();
objectTimeScale.Value = 0f;
Debug.Log( "[PlayerController] time frozen" );
}
if (_powers.Freeze.timeSinceConsume > frozenTime)
if ( _powers.Freeze.timeSinceConsume > frozenTime && TimeIsFrozen )
{
UnfreezeTime();
Debug.Log( "[PlayerController] time unfrozen" );
}
}
public bool TimeIsFrozen
=> objectTimeScale.AsBool;
private void UnfreezeTime()
{
objectTimeScale.Value = 1f;

View File

@ -73,7 +73,7 @@ public class FallawayFloor : MonoBehaviour
if (_triggered) return;
// time stop
if (_settings.ObjectTimeScale == 0) return;
if ( _settings.ObjectTimeScale.AsBool ) return;
StartCoroutine(FallCR());
}

View File

@ -14,7 +14,7 @@ public class TrapSettings : ScriptableObject
// in a safe zone
[SerializeField] private SerialFloat _safeTime;
public float ObjectTimeScale => _objectTimeScale;
public SerialFloat ObjectTimeScale => _objectTimeScale;
[SerializeField] private SerialFloat _objectTimeScale;
[Serializable]

View File

@ -7,5 +7,6 @@ namespace Ktyl.Util
[CreateAssetMenu(menuName = "ktyl/Util/Float")]
public class SerialFloat : SerialVar<float>
{
public bool AsBool => Mathf.Abs( Value ) <= float.Epsilon;
}
}

View File

@ -12,13 +12,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 93dc605253d04fe45a05492fb3feacc2, type: 3}
m_Name: Trap Settings
m_EditorClassIdentifier:
_safeTime: {fileID: 11400000, guid: 27c10a061baeec8469e96d4f995c1445, type: 2}
_objectTimeScale: {fileID: 11400000, guid: 9b68e167db44c0c42837e9a679da964e, type: 2}
_fallawayFloor:
_prefab: {fileID: 8773676356524340268, guid: d145f0e5906f91a4fad7f384f1b2a6ec, type: 3}
_safeResetTime: 0
_fmodEvent: event:/Environment/Traps/FallingPlatform
_respawnTime: {fileID: 11400000, guid: 1d2951ab5083d4d48a319ff00a9eb8bd, type: 2}
_safeTime: {fileID: 11400000, guid: 27c10a061baeec8469e96d4f995c1445, type: 2}
_shakeStrength: 0.1
_popInEase: 27
_arrowWall:
delay: 2
_safeResetTime: 0