Merge branch 'main' of http://212.24.110.183:3000/IPSEITY/Unheimlich_POC
# Conflicts: # Assets/_Content/Scenes/BodiesInWater.unity # Assets/_Content/Scenes/Samyaza.unity
This commit is contained in:
@@ -56,8 +56,17 @@ public class Audio_FootstepsController : MonoBehaviour
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(transform.position + Vector3.up * 0.1f, Vector3.down, out hit, _rayDistance, _groundLayer))
|
||||
{
|
||||
|
||||
if (hit.collider.TryGetComponent<Audio_SoundSurface>(out var surface))
|
||||
Audio_SoundSurface surface = hit.collider.GetComponent<Audio_SoundSurface>();
|
||||
|
||||
// If not on the collider itself, check parent objects
|
||||
if (surface == null)
|
||||
surface = hit.collider.GetComponentInParent<Audio_SoundSurface>();
|
||||
|
||||
// If still not found, check children of the hit object
|
||||
if (surface == null)
|
||||
surface = hit.collider.GetComponentInChildren<Audio_SoundSurface>();
|
||||
|
||||
if (surface != null)
|
||||
{
|
||||
surface.wwiseSwitch.SetValue(gameObject);
|
||||
}
|
||||
@@ -66,8 +75,6 @@ public class Audio_FootstepsController : MonoBehaviour
|
||||
defaultSwitch.SetValue(gameObject);
|
||||
Debug.Log($"[Footsteps] No GroundSurface component on '{hit.collider.name}'. Utilisation du switch par défaut.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
footstepEvent.Post(gameObject);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using UnityEngine;
|
||||
using AK.Wwise;
|
||||
|
||||
public class Audio_TimerRTPCController : MonoBehaviour
|
||||
{
|
||||
[Header("Timer Settings")]
|
||||
[SerializeField] private float _duration = 10f;
|
||||
[SerializeField] private float _updateInterval = 0.5f;
|
||||
|
||||
[Header("Wwise")]
|
||||
[SerializeField] private string _rtpcName = "MyRTPC";
|
||||
|
||||
private float _elapsed = 0f;
|
||||
private float _timeSinceLastUpdate = 0f;
|
||||
private bool _isRunning = true;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
AkUnitySoundEngine.SetRTPCValue(_rtpcName, 0f);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!_isRunning) return;
|
||||
|
||||
_elapsed += Time.deltaTime;
|
||||
_timeSinceLastUpdate += Time.deltaTime;
|
||||
|
||||
if (_elapsed >= _duration)
|
||||
{
|
||||
AkUnitySoundEngine.SetRTPCValue(_rtpcName, _duration);
|
||||
_isRunning = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_timeSinceLastUpdate >= _updateInterval)
|
||||
{
|
||||
_timeSinceLastUpdate = 0f;
|
||||
AkUnitySoundEngine.SetRTPCValue(_rtpcName, _elapsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9530f0bda4b798e4aa2f62840f7baae1
|
||||
@@ -38,7 +38,7 @@ public static class SceneEditPresenceTool
|
||||
|
||||
static SceneEditPresenceTool()
|
||||
{
|
||||
_projectName = Directory.GetParent(Application.dataPath).Name;
|
||||
_projectName = "Unheimlich_POC";// Directory.GetParent(Application.dataPath).Name;
|
||||
_userId = LoadOrAskUserId();
|
||||
|
||||
EditorApplication.delayCall += OnStartup;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 573fc2a2745da7749946e6c481296f63
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class LevitationManager : MonoBehaviour
|
||||
{
|
||||
public static LevitationManager Instance { get; private set; }
|
||||
|
||||
[SerializeField, Range(0, 1)] private float _levitation;
|
||||
[SerializeField] private float _speed = 1;
|
||||
|
||||
public float Levitation => _levitation;
|
||||
public float Spped => _speed;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
if (Instance == this)
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
public void SetLevitation(float levitation)
|
||||
{
|
||||
_levitation = levitation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42b0f114188437f49b9c825c9af19f89
|
||||
@@ -0,0 +1,99 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class LevitationObject : MonoBehaviour
|
||||
{
|
||||
[System.Serializable]
|
||||
public class References
|
||||
{
|
||||
public Rigidbody Rigidbody;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class Settings
|
||||
{
|
||||
[Range(-1, 99)] public int Seed = -1;
|
||||
public Vector3 Offset = new Vector3(0, 3, 0);
|
||||
public Vector3 DivergeanceMin = new Vector3(-1, -2, -1);
|
||||
public Vector3 DivergeanceMax = new Vector3(1, 2, 1);
|
||||
public Vector3 Amplitude = new Vector3(.1f, .5f, .1f);
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class State
|
||||
{
|
||||
[Range(0, 1)] public float Levitating;
|
||||
}
|
||||
|
||||
[SerializeField] private References _references;
|
||||
[SerializeField] private Settings _settings;
|
||||
[SerializeField] private State _state;
|
||||
|
||||
private Vector3 _randomAxis;
|
||||
private Vector3 _originPos;
|
||||
private Quaternion _originRot;
|
||||
|
||||
void OnDrawGizmosSelected()
|
||||
//void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.color = Color.cyan;
|
||||
|
||||
Vector3 originPos = Application.isPlaying ? _originPos : transform.position;
|
||||
Vector3 targetCenter = GetTargetCenter();
|
||||
|
||||
Gizmos.DrawLine(transform.position, originPos + targetCenter);
|
||||
Gizmos.DrawWireSphere(originPos + targetCenter, .05f);
|
||||
}
|
||||
|
||||
void OnValidate()
|
||||
{
|
||||
if (!_references.Rigidbody)
|
||||
_references.Rigidbody = GetComponent<Rigidbody>();
|
||||
|
||||
if (_settings.Seed == -1)
|
||||
_settings.Seed = Random.Range(0, 100);
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_randomAxis = new Vector3(Mathf.Cos(_settings.Seed * 3.41f), Mathf.Cos(_settings.Seed * 9.23f), Mathf.Sin(_settings.Seed * 5.22f)).normalized;
|
||||
_originPos = transform.position;
|
||||
_originRot = transform.rotation;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (!LevitationManager.Instance)
|
||||
return;
|
||||
|
||||
_references.Rigidbody.isKinematic = true;
|
||||
_references.Rigidbody.useGravity = false;
|
||||
|
||||
float t = Time.timeSinceLevelLoad * LevitationManager.Instance.Spped;
|
||||
t += _settings.Seed * 7.63f;
|
||||
|
||||
float cosT0 = Mathf.Cos(t * .3f);
|
||||
float cosT1 = Mathf.Cos(t);
|
||||
float sinT0 = Mathf.Sin(t * .3f);
|
||||
|
||||
Vector3 offset = GetTargetCenter();
|
||||
offset.x += _settings.Amplitude.x * cosT0;
|
||||
offset.y += _settings.Amplitude.y * cosT1;
|
||||
offset.z += _settings.Amplitude.z * sinT0;
|
||||
|
||||
Vector3 targetPos = _originPos + offset;
|
||||
targetPos = Vector3.Slerp(_originPos, targetPos, LevitationManager.Instance.Levitation);
|
||||
targetPos = Vector3.Lerp(transform.position, targetPos, t / Mathf.Max(Vector3.Distance(transform.position, targetPos), 1) * .0002f);
|
||||
|
||||
Quaternion targetRot = Quaternion.AngleAxis(t * 10, _randomAxis);
|
||||
targetRot = Quaternion.Lerp(_originRot, targetRot, LevitationManager.Instance.Levitation);
|
||||
|
||||
_references.Rigidbody.Move(targetPos, targetRot);
|
||||
}
|
||||
|
||||
Vector3 GetTargetCenter()
|
||||
{
|
||||
Vector3 divergeance = Vector3.Lerp(_settings.DivergeanceMin, _settings.DivergeanceMax, (_settings.Seed * 6.72f) % 1);
|
||||
|
||||
return _settings.Offset + divergeance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e91f8dd05f086146b1c06cf5517f3fb
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3676ea73de0ff0249a9e86d29a1616ad
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
using UnityEngine;
|
||||
using static UnityEngine.Rendering.DebugUI;
|
||||
|
||||
public class TvHead : MonoBehaviour
|
||||
{
|
||||
[System.Serializable]
|
||||
public class References
|
||||
{
|
||||
public Renderer Head;
|
||||
public Renderer Ray;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class Settings
|
||||
{
|
||||
public float OffMin = 5f;
|
||||
public float OffMax = 9f;
|
||||
public float OnMin = 4f;
|
||||
public float OnMax = 8f;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class State
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[SerializeField] private References _references;
|
||||
[SerializeField] private Settings _settings;
|
||||
[SerializeField] private State _state;
|
||||
|
||||
private float _value;
|
||||
private float _seed;
|
||||
private float _offDuration;
|
||||
private float _onDuration;
|
||||
private Vector4 _headColor;
|
||||
private Vector4 _screenColor;
|
||||
|
||||
const string ColorAttribute = "_Color";
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_seed = transform.GetSiblingIndex();
|
||||
_offDuration = Mathf.Lerp(_settings.OffMin, _settings.OffMax, (_seed * 6.72f) % 1);
|
||||
_onDuration = Mathf.Lerp(_settings.OnMin, _settings.OnMax, (_seed * 4.56f) % 1);
|
||||
_headColor = _references.Ray.material.GetColor(ColorAttribute);
|
||||
_screenColor = _references.Head.materials[1].GetColor(ColorAttribute);
|
||||
|
||||
//Off();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
float t = Time.timeSinceLevelLoad + _seed * 13.23f;
|
||||
float totalDuration = _offDuration + _onDuration;
|
||||
float targetValue = (t / totalDuration) % 1;
|
||||
targetValue = targetValue * totalDuration < _offDuration ? 0 : 1;
|
||||
_value = Mathf.Lerp(_value, targetValue, Time.deltaTime * 10);
|
||||
|
||||
float noisedValue = _value + Mathf.Cos(Time.timeSinceLevelLoad * 50) * (1 - Mathf.Abs(_value * 2 - 1));
|
||||
noisedValue = Mathf.Clamp01(noisedValue);
|
||||
|
||||
Vector3 lookDir = (Camera.main.transform.position - _references.Head.transform.position).normalized;
|
||||
|
||||
Quaternion targetRot = Quaternion.Inverse(_references.Head.transform.parent.rotation);
|
||||
targetRot *= Quaternion.LookRotation(lookDir, Vector3.up);
|
||||
targetRot *= _references.Head.transform.parent.localRotation;
|
||||
targetRot = Quaternion.Lerp(Quaternion.Euler(0, 0, 0), targetRot, Mathf.Lerp(_value, noisedValue, .5f));
|
||||
|
||||
Color headColor = Color.Lerp(Color.black, _headColor , noisedValue);
|
||||
Color screenColor = Color.Lerp(Color.black, _screenColor, noisedValue);
|
||||
|
||||
_references.Ray.material.SetColor(ColorAttribute, headColor);
|
||||
_references.Head.materials[1].SetColor(ColorAttribute, screenColor);
|
||||
_references.Head.transform.localRotation = targetRot;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d04f75733f013d54ca416a2b37a625e0
|
||||
Reference in New Issue
Block a user