clean : deleted all useless scripts
This commit is contained in:
@@ -1,106 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Unheimlich.Core.Audio;
|
||||
|
||||
namespace Unheimlich.Editor
|
||||
{
|
||||
[CustomEditor(typeof(AudioListenable))]
|
||||
public class AudioListenableEditor : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
|
||||
AudioListenable listenable = (AudioListenable)target;
|
||||
|
||||
EditorGUILayout.Space(10);
|
||||
EditorGUILayout.LabelField("Quick Setup", EditorStyles.boldLabel);
|
||||
|
||||
if (GUILayout.Button("Setup as Wall"))
|
||||
SetupAsType(listenable, AudioEmitterType.Wall, 200f, 20f, true);
|
||||
|
||||
if (GUILayout.Button("Setup as Metal Object"))
|
||||
SetupAsType(listenable, AudioEmitterType.Metal, 800f, 100f, false);
|
||||
|
||||
if (GUILayout.Button("Setup as Wood Object"))
|
||||
SetupAsType(listenable, AudioEmitterType.Wood, 300f, 50f, false);
|
||||
|
||||
if (GUILayout.Button("Setup as Glass"))
|
||||
SetupAsType(listenable, AudioEmitterType.Glass, 1200f, 150f, false);
|
||||
|
||||
if (GUILayout.Button("Setup as Mechanical"))
|
||||
SetupAsType(listenable, AudioEmitterType.Mechanical, 500f, 80f, false);
|
||||
|
||||
EditorGUILayout.Space(5);
|
||||
|
||||
if (GUILayout.Button("Test Sound (Play Mode Only)", GUILayout.Height(30)))
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
listenable.StartListening(Camera.main != null ? Camera.main.transform.position : Vector3.zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox("Enter Play Mode to test sounds", MessageType.Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupAsType(AudioListenable listenable, AudioEmitterType type, float baseFreq, float freqVar, bool isGeneric)
|
||||
{
|
||||
SerializedObject so = new SerializedObject(listenable);
|
||||
|
||||
so.FindProperty("_emitterType").enumValueIndex = (int)type;
|
||||
so.FindProperty("_useProceduralAudio").boolValue = true;
|
||||
so.FindProperty("_baseFrequency").floatValue = baseFreq;
|
||||
so.FindProperty("_frequencyVariation").floatValue = freqVar;
|
||||
|
||||
if (isGeneric)
|
||||
{
|
||||
so.FindProperty("_volumeMin").floatValue = 0.2f;
|
||||
so.FindProperty("_volumeMax").floatValue = 0.4f;
|
||||
}
|
||||
|
||||
so.ApplyModifiedProperties();
|
||||
EditorUtility.SetDirty(listenable);
|
||||
}
|
||||
}
|
||||
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(Transform))]
|
||||
public class TransformEditorExtension : UnityEditor.Editor
|
||||
{
|
||||
private UnityEditor.Editor defaultEditor;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
defaultEditor = CreateEditor(targets, System.Type.GetType("UnityEditor.TransformInspector, UnityEditor"));
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (defaultEditor != null)
|
||||
DestroyImmediate(defaultEditor);
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (defaultEditor != null)
|
||||
defaultEditor.OnInspectorGUI();
|
||||
|
||||
EditorGUILayout.Space(10);
|
||||
|
||||
if (targets.Length == 1)
|
||||
{
|
||||
Transform t = (Transform)target;
|
||||
if (t.GetComponent<AudioListenable>() == null)
|
||||
{
|
||||
if (GUILayout.Button("Add Audio Listenable", GUILayout.Height(25)))
|
||||
{
|
||||
Undo.AddComponent<AudioListenable>(t.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b606ceac9567f9746b716e63b0e644ee
|
||||
@@ -1,63 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unheimlich.Audio
|
||||
{
|
||||
public class AudioSourceInspector : MonoBehaviour
|
||||
{
|
||||
[Header("Debug Settings")]
|
||||
[SerializeField] private float _logInterval = 1f;
|
||||
|
||||
private AudioSource _source;
|
||||
private float _lastLogTime;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_source = GetComponent<AudioSource>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_source == null) return;
|
||||
|
||||
if (Time.time - _lastLogTime >= _logInterval)
|
||||
{
|
||||
LogAudioSourceState();
|
||||
_lastLogTime = Time.time;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
Debug.Log($"<color=cyan>[AudioInspector] OnEnable called on {gameObject.name}</color>");
|
||||
if (_source != null)
|
||||
LogAudioSourceState();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
Debug.Log($"<color=magenta>[AudioInspector] OnDisable called on {gameObject.name}</color>");
|
||||
if (_source != null)
|
||||
LogAudioSourceState();
|
||||
}
|
||||
|
||||
private void LogAudioSourceState()
|
||||
{
|
||||
if (_source == null)
|
||||
{
|
||||
Debug.LogWarning($"[AudioInspector] No AudioSource on {gameObject.name}");
|
||||
return;
|
||||
}
|
||||
|
||||
string clipName = _source.clip != null ? _source.clip.name : "NULL";
|
||||
Debug.Log($"<color=yellow>[AudioInspector] {gameObject.name} | " +
|
||||
$"Clip: {clipName} | " +
|
||||
$"Time: {_source.time:F2}s | " +
|
||||
$"isPlaying: {_source.isPlaying} | " +
|
||||
$"enabled: {_source.enabled} | " +
|
||||
$"volume: {_source.volume:F2} | " +
|
||||
$"mute: {_source.mute} | " +
|
||||
$"loop: {_source.loop} | " +
|
||||
$"Active: {gameObject.activeInHierarchy}</color>");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65fea0a39ddb811419ec546ea98e5917
|
||||
Reference in New Issue
Block a user