fix : triggering dizziness
This commit is contained in:
@@ -15391,6 +15391,10 @@ PrefabInstance:
|
|||||||
propertyPath: _stressLevel
|
propertyPath: _stressLevel
|
||||||
value: 0.3
|
value: 0.3
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1476756471834662335, guid: 6493d77978c5c1246a0410d1f9204524, type: 3}
|
||||||
|
propertyPath: _fadeDuration
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1476756471834662335, guid: 6493d77978c5c1246a0410d1f9204524, type: 3}
|
- target: {fileID: 1476756471834662335, guid: 6493d77978c5c1246a0410d1f9204524, type: 3}
|
||||||
propertyPath: _idleAmplitude
|
propertyPath: _idleAmplitude
|
||||||
value: 0.5
|
value: 0.5
|
||||||
@@ -15419,6 +15423,10 @@ PrefabInstance:
|
|||||||
propertyPath: _debugSustainStress
|
propertyPath: _debugSustainStress
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1476756471834662335, guid: 6493d77978c5c1246a0410d1f9204524, type: 3}
|
||||||
|
propertyPath: _masterIntensityInspector
|
||||||
|
value: 1.5
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5295567073180248356, guid: 6493d77978c5c1246a0410d1f9204524, type: 3}
|
- target: {fileID: 5295567073180248356, guid: 6493d77978c5c1246a0410d1f9204524, type: 3}
|
||||||
propertyPath: _settings.CanRun
|
propertyPath: _settings.CanRun
|
||||||
value: 1
|
value: 1
|
||||||
|
|||||||
@@ -36,8 +36,11 @@ namespace Unheimlich.World.CameraSystem
|
|||||||
[Tooltip("Enable or disable the whole rig (with fade). Can also be toggled at runtime via SetActive().")]
|
[Tooltip("Enable or disable the whole rig (with fade). Can also be toggled at runtime via SetActive().")]
|
||||||
[SerializeField] private bool _isActive = true;
|
[SerializeField] private bool _isActive = true;
|
||||||
|
|
||||||
[Tooltip("Master scale applied to ALL effects (noise amplitude, jolt amplitude, inertia strength, spin strength). 0 = off, 1 = nominal.")]
|
[Tooltip("Master scale applied to ALL effects. This is the target value restored on Enable().")]
|
||||||
[SerializeField] [Range(0f, 3f)] private float _masterIntensity = 1f;
|
[SerializeField] [Range(0f, 3f)] private float _masterIntensityInspector = 1f;
|
||||||
|
|
||||||
|
// Runtime value — starts at 0 if disabled, lerps to _masterIntensityInspector on Enable().
|
||||||
|
private float _masterIntensity;
|
||||||
|
|
||||||
// ── Inspector — Stress ────────────────────────────────────────────────────
|
// ── Inspector — Stress ────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -140,7 +143,7 @@ namespace Unheimlich.World.CameraSystem
|
|||||||
// ── Runtime state ─────────────────────────────────────────────────────────
|
// ── Runtime state ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
private float _weight;
|
private float _weight;
|
||||||
private float _initialMasterIntensity; // value set in inspector, restored on Enable()
|
private bool _started;
|
||||||
private float _noiseTimer;
|
private float _noiseTimer;
|
||||||
private float _spinTimer;
|
private float _spinTimer;
|
||||||
private Vector3 _noiseOffset;
|
private Vector3 _noiseOffset;
|
||||||
@@ -165,17 +168,16 @@ namespace Unheimlich.World.CameraSystem
|
|||||||
Random.Range(0f, 100f)
|
Random.Range(0f, 100f)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Spin uses its own offset to decouple from the main noise.
|
|
||||||
_spinTimer = Random.Range(0f, 100f);
|
_spinTimer = Random.Range(0f, 100f);
|
||||||
|
|
||||||
|
// _masterIntensity is a pure runtime field (not serialized) so this zero
|
||||||
|
// will never be overwritten by Unity's deserialization.
|
||||||
|
_masterIntensity = _isActive ? _masterIntensityInspector : 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
// Store the inspector value so Enable() can restore it even if the rig
|
_started = true;
|
||||||
// started disabled (and _masterIntensity was faded to 0).
|
|
||||||
_initialMasterIntensity = _masterIntensity;
|
|
||||||
|
|
||||||
// Sync inspector toggle on first frame.
|
|
||||||
IsActive = _isActive;
|
IsActive = _isActive;
|
||||||
_weight = _isActive ? 1f : 0f;
|
_weight = _isActive ? 1f : 0f;
|
||||||
|
|
||||||
@@ -190,8 +192,7 @@ namespace Unheimlich.World.CameraSystem
|
|||||||
|
|
||||||
private void OnValidate()
|
private void OnValidate()
|
||||||
{
|
{
|
||||||
// Allow toggling _isActive from the inspector during Play mode.
|
if (!Application.isPlaying || !_started) return;
|
||||||
if (!Application.isPlaying) return;
|
|
||||||
SetActive(_isActive);
|
SetActive(_isActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +291,7 @@ namespace Unheimlich.World.CameraSystem
|
|||||||
// ── Public API ────────────────────────────────────────────────────────────
|
// ── Public API ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
/// <summary>UnityEvent-friendly wrapper — enables with the inspector master intensity.</summary>
|
/// <summary>UnityEvent-friendly wrapper — enables with the inspector master intensity.</summary>
|
||||||
public void Enable() => Enable(_initialMasterIntensity, _stressLevel);
|
public void Enable() => Enable(_masterIntensityInspector, _stressLevel);
|
||||||
|
|
||||||
/// <summary>UnityEvent-friendly wrapper — disables with a fade to 0.</summary>
|
/// <summary>UnityEvent-friendly wrapper — disables with a fade to 0.</summary>
|
||||||
public void Disable() => Disable(0f);
|
public void Disable() => Disable(0f);
|
||||||
|
|||||||
Reference in New Issue
Block a user