diff --git a/302/Assets/Course Library/Anomalies/Anomaly26/fire/Fire.unitypackage.meta b/302/Assets/Course Library/Anomalies/Anomaly26/fire/Fire.unitypackage.meta new file mode 100644 index 0000000..a819dbb --- /dev/null +++ b/302/Assets/Course Library/Anomalies/Anomaly26/fire/Fire.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9e44e6e8c6b4444818d678344091a86d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/302/Assets/Course Library/Anomalies/Anomaly26/fireEx/fireEx.unitypackage.meta b/302/Assets/Course Library/Anomalies/Anomaly26/fireEx/fireEx.unitypackage.meta new file mode 100644 index 0000000..ac7fa65 --- /dev/null +++ b/302/Assets/Course Library/Anomalies/Anomaly26/fireEx/fireEx.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 905a3c281cc5d471d99e87d04d99c4c0 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/302/Assets/Prefabs/sideGirlPrefab/sideGirl.prefab b/302/Assets/Prefabs/sideGirlPrefab/sideGirl.prefab index 61ed5ae..db6a4ee 100644 --- a/302/Assets/Prefabs/sideGirlPrefab/sideGirl.prefab +++ b/302/Assets/Prefabs/sideGirlPrefab/sideGirl.prefab @@ -134,10 +134,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 63791c65d79f24b35ab1c6fecdb85dd9, type: 3} m_Name: m_EditorClassIdentifier: - promptMessage: "\uD074\uB9AD\uD558\uC5EC \uC0C1\uD638\uC791\uC6A9" - interactionRange: 2 - interactSound: {fileID: 0} - fadeOutDuration: 2 + prompt: + distanceInteractionMax: 2 --- !u!65 &2250832690799726206 BoxCollider: m_ObjectHideFlags: 0 diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly05Controller.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly05Controller.cs index 1829f44..38ba1ba 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly05Controller.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly05Controller.cs @@ -26,7 +26,14 @@ protected override bool Awake_() { Instantiate(sideGirlPrefab, spawnPosition, Quaternion.Euler(0, 180, 0)); } + StartAnomaly(); + return res; + } + + public override bool StartAnomaly() + { + bool res = base.StartAnomaly(); StartCoroutine(PlayMusicAfterDelay()); return res; } diff --git a/302/Assets/Scripts/SideGirl.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly05_SideGirl.cs similarity index 78% rename from 302/Assets/Scripts/SideGirl.cs rename to 302/Assets/Scripts/SpecificAnomalyManager/Anomaly05_SideGirl.cs index 48fafb9..a6b06b1 100644 --- a/302/Assets/Scripts/SideGirl.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly05_SideGirl.cs @@ -2,31 +2,32 @@ using System.Collections.Generic; using UnityEngine; -public class SideGirl : InteractableObject +public class Anomaly05_SideGirl : AbstractAnomalyInteractable { - [Header("Side Girl Settings")] - - private MeshRenderer meshRenderer; - private bool hasInteracted = false; - private Anomaly05Controller anomalyManager; - - private void Awake() - { - meshRenderer = GetComponent(); - // Anomaly5Manager 찾기 - anomalyManager = FindObjectOfType(); - } + public override string Name { get; } = "SideGirl"; + [Header("Side Girl Settings")] + private MeshRenderer meshRenderer; + private bool hasInteracted = false; + private Anomaly05Controller anomalyManager; + protected override bool Awake_() + { + bool res = base.Awake_(); + meshRenderer = GetComponent(); + // Anomaly5Manager 찾기 + anomalyManager = FindObjectOfType(); + return res; + } - public override void OnInteract() - { - if (hasInteracted) return; + public override void OnInteract() + { + base.OnInteract(); if (anomalyManager != null){ anomalyManager.StopAnomalyMusic(); } hasInteracted = true; StartCoroutine(FadeOutAllMeshRenderers(gameObject)); GameManager.Instance.SetStageClear(); - } + } private IEnumerator FadeOutAllMeshRenderers(GameObject target) { diff --git a/302/Assets/Scripts/SideGirl.cs.meta b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly05_SideGirl.cs.meta similarity index 100% rename from 302/Assets/Scripts/SideGirl.cs.meta rename to 302/Assets/Scripts/SpecificAnomalyManager/Anomaly05_SideGirl.cs.meta diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly07Controller.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly07Controller.cs index b45fbdb..d7a7299 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly07Controller.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly07Controller.cs @@ -1,6 +1,6 @@ using UnityEngine; -public class Anomaly07Controller : MonoBehaviour +public class Anomaly07Controller : AbstractAnomalyComposite { [Header("Russian Roulette Settings")] [SerializeField] private GameObject gunPrefab; diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly7_Gun.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly07_Gun.cs similarity index 97% rename from 302/Assets/Scripts/SpecificAnomalyManager/Anomaly7_Gun.cs rename to 302/Assets/Scripts/SpecificAnomalyManager/Anomaly07_Gun.cs index 5fe9406..8810b2c 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly7_Gun.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly07_Gun.cs @@ -1,8 +1,9 @@ using UnityEngine; using System.Collections; -public class Anomaly7_Gun : InteractableObject +public class Anomaly07_Gun : AbstractAnomalyInteractable { + public override string Name { get; } = "Gun"; [Header("Gun Settings")] [SerializeField] private Vector3 holdPosition = new Vector3(0.6f, 0f, 0.6f); [SerializeField] private Vector3 holdRotation = new Vector3(0f, -120f, 0f); @@ -33,8 +34,9 @@ public class Anomaly7_Gun : InteractableObject private Camera mainCamera; private float currentFlashAlpha = 0f; - private void Awake() + protected override bool Awake_() { + bool res = base.Awake_(); originalPosition = transform.position; originalRotation = transform.rotation; @@ -53,6 +55,7 @@ private void Awake() flashMaterial.SetInt("_Cull", (int)UnityEngine.Rendering.CullMode.Off); flashMaterial.SetInt("_ZWrite", 0); flashMaterial.SetInt("_ZTest", (int)UnityEngine.Rendering.CompareFunction.Always); + return res; } private void OnEnable() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly7_Gun.cs.meta b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly07_Gun.cs.meta similarity index 100% rename from 302/Assets/Scripts/SpecificAnomalyManager/Anomaly7_Gun.cs.meta rename to 302/Assets/Scripts/SpecificAnomalyManager/Anomaly07_Gun.cs.meta diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly09Controller.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly09Controller.cs index 143c4d4..8d6e90c 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly09Controller.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly09Controller.cs @@ -2,8 +2,9 @@ using System.Collections; using System.Collections.Generic; -public class Anomaly09Controller : MonoBehaviour +public class Anomaly09Controller : AbstractAnomalyComposite { + public override string Name { get; } = "Anomaly09Controller"; [Header("Anomaly Settings")] public float anomalyDelay = 15f; @@ -60,13 +61,15 @@ public class Anomaly09Controller : MonoBehaviour private List spawnedLights = new List(); private Coroutine anomalyCoroutine; - void Awake() + protected override bool Awake_() { + bool res = base.Awake_(); audioSource = gameObject.AddComponent(); audioSource.clip = anomalyMusic; audioSource.volume = musicVolume; audioSource.loop = true; audioSource.playOnAwake = false; + return res; } void Start() @@ -77,12 +80,26 @@ void Start() void OnEnable() { - anomalyCoroutine = StartCoroutine(StartAnomalyWithDelay()); + StartAnomaly(); Debug.Log($"이상현상 발생 - {anomalyDelay}초 후 나타납니다."); } void OnDisable() { + ResetAnomaly(); + } + + public override bool StartAnomaly() + { + bool res = base.StartAnomaly(); + anomalyCoroutine = StartCoroutine(StartAnomalyWithDelay()); + return res; + } + + public override bool ResetAnomaly() + { + bool res = base.ResetAnomaly(); + if (anomalyCoroutine != null) { StopCoroutine(anomalyCoroutine); @@ -92,6 +109,8 @@ void OnDisable() StopAnomalyMusic(); CleanupSpawnedObjects(); RestoreOriginalLightIntensities(); + + return res; } IEnumerator StartAnomalyWithDelay() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly14Controller.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly14Controller.cs index 209c1e6..012f988 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly14Controller.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly14Controller.cs @@ -4,8 +4,9 @@ using UnityEngine; -public class Anomaly14Controller : MonoBehaviour +public class Anomaly14Controller : AbstractAnomalyComposite { + public override string Name { get; } = "Anomaly14Controller"; public GameObject SweaterSitGirlPrefab; public GameObject DifferentPrefab; // 다른 종류의 프리팹 public float yRotation = 180f; @@ -15,9 +16,11 @@ private void Start() { audioSource = GetComponent(); } - - private void OnEnable() + // 이상현상을 시작하는 메서드 + public override bool StartAnomaly() { + bool res = base.StartAnomaly(); + if (audioSource != null) { audioSource.Play(); @@ -62,13 +65,30 @@ private void OnEnable() } } } + + return res; } - private void OnDisable() + public override bool ResetAnomaly() { + bool res = base.ResetAnomaly(); + if (audioSource != null && audioSource.isPlaying) { audioSource.Stop(); } + + return res; + } + + private void OnEnable() + { + StartAnomaly(); + } + + + private void OnDisable() + { + ResetAnomaly(); } } \ No newline at end of file diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly25Controller.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly25Controller.cs index 593aa84..07c324c 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly25Controller.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly25Controller.cs @@ -2,14 +2,24 @@ using System.Collections.Generic; using UnityEngine; -public class Anomaly25Controller : MonoBehaviour +public class Anomaly25Controller : AbstractAnomalyComposite { - public AudioSource audioSource; // Inspector에서 할당 + public override string Name { get; } = "Anomaly25Controller"; + public AudioSource audioSource; // Inspector에서 할당 - void Start() { - StartCoroutine(ActivateFloatingEffect()); - CreateInvisibleCeiling(); - } + void Start() { + StartAnomaly(); + } + + public override bool StartAnomaly() + { + bool res = base.StartAnomaly(); + + StartCoroutine(ActivateFloatingEffect()); + CreateInvisibleCeiling(); + + return res; + } IEnumerator ActivateFloatingEffect() { yield return new WaitForSeconds(15f); diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly26Controller.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly26Controller.cs index 94d2300..df224a3 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly26Controller.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly26Controller.cs @@ -2,8 +2,9 @@ using System.Collections; using System.Collections.Generic; -public class Anomaly26Controller : MonoBehaviour +public class Anomaly26Controller : AbstractAnomalyComposite { + public override string Name { get; } = "Anomaly26Controller"; [Header("Fire Settings")] [SerializeField] private GameObject firePrefab; [SerializeField] private int totalFiresToSpawn = 30; @@ -26,7 +27,16 @@ public class Anomaly26Controller : MonoBehaviour private void OnEnable() { + StartAnomaly(); + } + + public override bool StartAnomaly() + { + bool res = base.StartAnomaly(); + StartCoroutine(InitialFireSpawnDelay()); + + return res; } private void OnDisable()