diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly15Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly15Manager.cs index f9b1744..4adc442 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly15Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly15Manager.cs @@ -18,11 +18,11 @@ public class Anomaly15Manager : MonoBehaviour private void Start() { - // Create and set up the interactive cube + // 상호작용할 수 있는 투명한 큐브 interactionCube = CreateInteractionCube(); StartCoroutine(SetTransparency(interactionCube)); - // Start spawning spiders + // 거미 생성 StartCoroutine(SpawnSpiderRoutine()); } @@ -100,22 +100,19 @@ private GameObject CreateInteractionCube() return cube; } - // Coroutine to set the transparency of the cube + // 투명하게 fadeout private IEnumerator SetTransparency(GameObject cube) { yield return null; // Wait for one frame to ensure setup is complete Renderer cubeRenderer = cube.GetComponent(); - // Ensure it's using a unique material instance cubeRenderer.material = new Material(Shader.Find("Standard")); - // Set the rendering mode to Transparent cubeRenderer.material.SetFloat("_Mode", 3); // 3 = Transparent cubeRenderer.material.color = new Color(0f, 0f, 0f, 0f); // Black albedo with 0 alpha cubeRenderer.material.renderQueue = 3000; // Force render in transparent queue - // Additional settings to enforce transparency cubeRenderer.material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha); cubeRenderer.material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); cubeRenderer.material.SetInt("_ZWrite", 0); diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly15_spider.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly15_spider.cs index efaeda3..cb7172e 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly15_spider.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly15_spider.cs @@ -6,50 +6,29 @@ public class Anomaly15_spider : InteractableObject, IInteractable [Header("Interaction Settings")] private bool hasInteracted = false; - private Anomaly15Manager anomalyManager; // Reference to Anomaly15Manager + private Anomaly15Manager anomalyManager; [Header("Audio Settings")] public AudioClip spiderSoundClip; - private Transform cameraTransform; // Reference to the Main Camera's transform - - private AudioSource audioSource; // Reference to the AudioSource component + private Transform cameraTransform; + private AudioSource audioSource; private void Start() { - // Find the Anomaly15Manager in the scene anomalyManager = FindObjectOfType(); - if (anomalyManager == null) - { - Debug.LogError("Anomaly15Manager not found in the scene!"); - } - GameObject mainCamera = GameObject.FindWithTag("MainCamera"); - if (mainCamera != null) - { - cameraTransform = mainCamera.transform; - } + audioSource = gameObject.AddComponent(); audioSource.clip = spiderSoundClip; audioSource.loop = true; + audioSource.spatialBlend = 2f; // 3D 음향으로 설정 + audioSource.Play(); } private void Update() { - // Check the distance to the camera and play sound if within 5f - float distanceToCamera = Vector3.Distance(transform.position, cameraTransform.position); - Debug.Log(distanceToCamera); - if (distanceToCamera <= 10f && !hasInteracted) - { - if (!audioSource.isPlaying) // Start playing if not already playing - { - audioSource.Play(); - } - } - else + if (hasInteracted && audioSource.isPlaying) { - if (audioSource.isPlaying) // Stop playing if out of range - { - audioSource.Stop(); - } + audioSource.Stop(); } } @@ -75,7 +54,6 @@ public void OnInteract() if (anomalyManager != null) { anomalyManager.StopSpawning(); - audioSource.Stop(); } // Start coroutine to wait 2 seconds before destroying