This commit is contained in:
2026-06-05 21:24:41 +07:00
parent 91183760fb
commit 98806b862d
16 changed files with 6386 additions and 3028 deletions

View File

@@ -0,0 +1,32 @@
using UnityEngine;
namespace Hallucinate.AI
{
public class NoiseEmitter : MonoBehaviour
{
[Header("Settings")]
public float defaultNoiseRange = 10f;
public LayerMask npcLayer;
public void EmitNoise(float volumeMultiplier = 1f)
{
float range = defaultNoiseRange * volumeMultiplier;
Collider[] hitColliders = Physics.OverlapSphere(transform.position, range, npcLayer);
foreach (var hit in hitColliders)
{
EnemyAI npc = hit.GetComponentInParent<EnemyAI>();
if (npc != null)
{
npc.HearNoise(transform.position, volumeMultiplier);
}
}
}
private void OnDrawGizmosSelected()
{
Gizmos.color = new Color(1, 1, 0, 0.3f);
Gizmos.DrawWireSphere(transform.position, defaultNoiseRange);
}
}
}