diff --git a/302/Assets/Scripts/SCH_AnomalyManager.cs b/302/Assets/Scripts/AbstractAnomalyController.cs similarity index 70% rename from 302/Assets/Scripts/SCH_AnomalyManager.cs rename to 302/Assets/Scripts/AbstractAnomalyController.cs index 10974e6..d695b72 100644 --- a/302/Assets/Scripts/SCH_AnomalyManager.cs +++ b/302/Assets/Scripts/AbstractAnomalyController.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using UnityEngine; -public class SCH_AnomalyManager : SCH_AnomalyObject +public abstract class AbstractAnomalyController : AbstractAnomalyObject { /********** * fields * @@ -14,38 +14,34 @@ public class SCH_AnomalyManager : SCH_AnomalyObject public GameObject[] prefabs; // 이상현상 오브젝트 리스트 - protected List objects; + protected List objects; /************** * properties * **************/ // 클래스 이름 - public override string Name { get; } = "SCH_AnomalyManager"; + public override string Name { get; } = "AbstractAnomalyController"; - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // 필드를 초기화하는 메서드 protected override bool InitFields() { bool res = base.InitFields(); - // Manager - Manager = this; - Log("Initialize `Manager` success"); - // objects - objects = new List(); + objects = new List(); Log("Initialize `objects` success"); return res; } - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 시작하는 메서드 public override bool StartAnomaly() @@ -60,7 +56,7 @@ public override bool StartAnomaly() res = false; } - foreach (SCH_AnomalyObject obj in objects) { + foreach (AbstractAnomalyObject obj in objects) { Log($"Call `{obj.Name}.StartAnomaly` for {obj.gameObject.name} begin"); if (obj.StartAnomaly()) { Log($"Call `{obj.Name}.StartAnomaly` success"); @@ -78,7 +74,7 @@ public override bool ResetAnomaly() { bool res = base.ResetAnomaly(); - foreach (SCH_AnomalyObject obj in objects) { + foreach (AbstractAnomalyObject obj in objects) { Log($"Call `{obj.Name}.ResetAnomaly` for {obj.gameObject.name} begin"); if (obj.ResetAnomaly()) { Log($"Call `{obj.Name}.ResetAnomaly` success"); @@ -95,26 +91,6 @@ public override bool ResetAnomaly() * virtual methods * *******************/ - // 상호작용 성공 시 불리는 메서드 - public virtual bool InteractionSuccess() - { - bool res = true; - - Log("Call `GameManager.SetStageClear` begin"); - GameManager.Instance.SetStageClear(); - Log("Call `GameManager.SetStageClear` end"); - - Log("Call `ResetAnomaly` begin"); - if (ResetAnomaly()) { - Log("Call `ResetAnomaly` success"); - } else { - Log("Call `ResetAnomaly` failed", mode: 1); - res = false; - } - - return res; - } - // 오브젝트를 초기화하는 메서드 protected virtual bool InitObjects() { @@ -125,11 +101,10 @@ protected virtual bool InitObjects() GameObject gameObj = GameObject.Find(name); if (gameObj != null) { - SCH_AnomalyObject obj = gameObj.GetComponent(); + AbstractAnomalyObject obj = gameObj.GetComponent(); if (obj != null) { obj.enabled = true; - obj.Manager = this; objects.Add(obj); Log($"Find `{name}` success: {obj.Name}"); } else { @@ -147,10 +122,9 @@ protected virtual bool InitObjects() GameObject gameObj = Instantiate(prefab); if (gameObj != null) { - SCH_AnomalyObject obj = gameObj.GetComponent(); + AbstractAnomalyObject obj = gameObj.GetComponent(); if (obj != null) { - obj.Manager = this; objects.Add(obj); Log($"Instantiate `{prefab.name}` success: {obj.Name}"); } else { diff --git a/302/Assets/Scripts/SCH_AnomalyManager.cs.meta b/302/Assets/Scripts/AbstractAnomalyController.cs.meta similarity index 100% rename from 302/Assets/Scripts/SCH_AnomalyManager.cs.meta rename to 302/Assets/Scripts/AbstractAnomalyController.cs.meta diff --git a/302/Assets/Scripts/SCH_AnomalyInteractable.cs b/302/Assets/Scripts/AbstractAnomalyInteractable.cs similarity index 67% rename from 302/Assets/Scripts/SCH_AnomalyInteractable.cs rename to 302/Assets/Scripts/AbstractAnomalyInteractable.cs index 80a34b5..a383274 100644 --- a/302/Assets/Scripts/SCH_AnomalyInteractable.cs +++ b/302/Assets/Scripts/AbstractAnomalyInteractable.cs @@ -1,7 +1,7 @@ using UnityEngine; [RequireComponent(typeof(Collider))] -public class SCH_AnomalyInteractable : SCH_AnomalyObject, IInteractable +public class AbstractAnomalyInteractable : AbstractAnomalyObject, IInteractable { /********** * fields * @@ -19,43 +19,34 @@ public class SCH_AnomalyInteractable : SCH_AnomalyObject, IInteractable **************/ // 클래스 이름 - public override string Name { get; } = "SCH_AnomalyInteractable"; + public override string Name { get; } = "AbstractAnomalyInteractable"; /********************************* * implementation: IInteractable * *********************************/ // 상호작용 프롬프트 텍스트 반환 (예: "E키를 눌러 책상 조사하기") - public string GetInteractionPrompt() + public virtual string GetInteractionPrompt() { return prompt; } // 상호작용 시 실행될 메서드 - public void OnInteract() + public virtual void OnInteract() { Log($"Interaction with `{gameObject.name}`"); - - if (Manager != null) { - Log($"Call `{Manager.Name}.InteractionSuccess` begin"); - Manager.InteractionSuccess(); - Log($"Call `{Manager.Name}.InteractionSuccess` end"); - } else { - Log($"Call `{Manager.Name}.InteractionSuccess` failed", mode: 1); - } - canInteract = false; } // 현재 상호작용 가능한지 여부 반환 - public bool CanInteract(float distance) + public virtual bool CanInteract(float distance) { return canInteract && distance <= distanceInteractionMax; } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // 필드를 초기화하는 메서드 protected override bool InitFields() diff --git a/302/Assets/Scripts/SCH_AnomalyInteractable.cs.meta b/302/Assets/Scripts/AbstractAnomalyInteractable.cs.meta similarity index 100% rename from 302/Assets/Scripts/SCH_AnomalyInteractable.cs.meta rename to 302/Assets/Scripts/AbstractAnomalyInteractable.cs.meta diff --git a/302/Assets/Scripts/SCH_AnomalyObject.cs b/302/Assets/Scripts/AbstractAnomalyObject.cs similarity index 67% rename from 302/Assets/Scripts/SCH_AnomalyObject.cs rename to 302/Assets/Scripts/AbstractAnomalyObject.cs index ab68b37..20349a0 100644 --- a/302/Assets/Scripts/SCH_AnomalyObject.cs +++ b/302/Assets/Scripts/AbstractAnomalyObject.cs @@ -1,14 +1,11 @@ -public class SCH_AnomalyObject : SCH_Behaviour +public abstract class AbstractAnomalyObject : AbstractBehaviour { /************** * properties * **************/ // 클래스 이름 - public override string Name { get; } = "SCH_AnomalyObject"; - - // 이상현상 매니저 - public SCH_AnomalyManager Manager { get; set; } + public override string Name { get; } = "AbstractAnomalyObject"; /******************* * virtual methods * diff --git a/302/Assets/Scripts/SCH_AnomalyObject.cs.meta b/302/Assets/Scripts/AbstractAnomalyObject.cs.meta similarity index 100% rename from 302/Assets/Scripts/SCH_AnomalyObject.cs.meta rename to 302/Assets/Scripts/AbstractAnomalyObject.cs.meta diff --git a/302/Assets/Scripts/SCH_Behaviour.cs b/302/Assets/Scripts/AbstractBehaviour.cs similarity index 92% rename from 302/Assets/Scripts/SCH_Behaviour.cs rename to 302/Assets/Scripts/AbstractBehaviour.cs index 8cb97f9..7568b67 100644 --- a/302/Assets/Scripts/SCH_Behaviour.cs +++ b/302/Assets/Scripts/AbstractBehaviour.cs @@ -1,13 +1,13 @@ using UnityEngine; -public class SCH_Behaviour : MonoBehaviour +public abstract class AbstractBehaviour : MonoBehaviour { /************** * properties * **************/ // 클래스 이름 - public virtual string Name { get; } = "SCH_Behaviour"; + public virtual string Name { get; } = "AbstractBehaviour"; /************ * messages * diff --git a/302/Assets/Scripts/SCH_Behaviour.cs.meta b/302/Assets/Scripts/AbstractBehaviour.cs.meta similarity index 100% rename from 302/Assets/Scripts/SCH_Behaviour.cs.meta rename to 302/Assets/Scripts/AbstractBehaviour.cs.meta diff --git a/302/Assets/Scripts/Interactable.cs b/302/Assets/Scripts/IInteractable.cs similarity index 100% rename from 302/Assets/Scripts/Interactable.cs rename to 302/Assets/Scripts/IInteractable.cs diff --git a/302/Assets/Scripts/Interactable.cs.meta b/302/Assets/Scripts/IInteractable.cs.meta similarity index 100% rename from 302/Assets/Scripts/Interactable.cs.meta rename to 302/Assets/Scripts/IInteractable.cs.meta diff --git a/302/Assets/Scripts/IStageObserver.cs b/302/Assets/Scripts/IStageObserver.cs new file mode 100644 index 0000000..25ca207 --- /dev/null +++ b/302/Assets/Scripts/IStageObserver.cs @@ -0,0 +1,5 @@ +public interface IStageObserver +{ + // 단계 변경 시 불리는 메서드 + public bool UpdateStage(); +} diff --git a/302/Assets/Scripts/IStageObserver.cs.meta b/302/Assets/Scripts/IStageObserver.cs.meta new file mode 100644 index 0000000..ca0e2a1 --- /dev/null +++ b/302/Assets/Scripts/IStageObserver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 57867e77324d93b449afa89a74a9135d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/302/Assets/Scripts/LaptopFaceController.cs b/302/Assets/Scripts/LaptopFaceController.cs index 14b1642..f6a4371 100644 --- a/302/Assets/Scripts/LaptopFaceController.cs +++ b/302/Assets/Scripts/LaptopFaceController.cs @@ -69,9 +69,9 @@ void Update() } } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // 필드를 초기화하는 메서드 protected override bool InitFields() @@ -121,9 +121,9 @@ public override void ResetScreen() screen.Apply(); } - /*********** - * methods * - ***********/ + /*************** + * new methods * + ***************/ // 쳐다보기 시작하는 메서드 public void StartGazing() diff --git a/302/Assets/Scripts/LaptopScreenController.cs b/302/Assets/Scripts/LaptopScreenController.cs index 0928165..ccf69b3 100644 --- a/302/Assets/Scripts/LaptopScreenController.cs +++ b/302/Assets/Scripts/LaptopScreenController.cs @@ -1,6 +1,6 @@ using UnityEngine; -public class LaptopScreenController : SCH_Behaviour +public class LaptopScreenController : AbstractBehaviour { /********** * fields * @@ -40,9 +40,9 @@ public int Index { } } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // `Awake` 메시지 용 메서드 protected override bool Awake_() @@ -56,9 +56,9 @@ protected override bool Awake_() return res; } - /*********** - * methods * - ***********/ + /*************** + * new methods * + ***************/ public virtual void ResetScreen() { diff --git a/302/Assets/Scripts/SlideController.cs b/302/Assets/Scripts/SlideController.cs index 067e8bc..973dbef 100644 --- a/302/Assets/Scripts/SlideController.cs +++ b/302/Assets/Scripts/SlideController.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class SlideController : SCH_Behaviour +public class SlideController : AbstractBehaviour { /********** * fields * @@ -54,9 +54,9 @@ void Update() UpdateTrickling(); } - /******************************** - * implmentation: SCH_Behaviour * - ********************************/ + /************************************ + * implmentation: AbstractBehaviour * + ************************************/ // 필드를 초기화하는 메서드 protected override bool InitFields() diff --git a/302/Assets/Scripts/SlideManager.cs b/302/Assets/Scripts/SlideManager.cs index c42c055..dc9b884 100644 --- a/302/Assets/Scripts/SlideManager.cs +++ b/302/Assets/Scripts/SlideManager.cs @@ -1,6 +1,6 @@ using UnityEngine; -public class SlideManager : SCH_Behaviour +public class SlideManager : AbstractBehaviour, IStageObserver { /********** * fields * @@ -38,9 +38,51 @@ public class SlideManager : SCH_Behaviour // 클래스 인자 public static SlideManager Instance { get; private set; } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /********************************** + * implementation: IStageObserver * + **********************************/ + + public bool UpdateStage() + { + int stage = GameManager.Instance.GetCurrentStage(); + bool res = true; + + if (stage == 0) { + GenerateSlideList(); + if (FindSlides()) { + _objectLeft.transform.Translate(Vector3.down * 100.0f); + _objectRight.transform.Translate(Vector3.down * 100.0f); + Log("Set slide success: off"); + } else { + Log("Set slide failed", mode: 1); + res = false; + } + } else if (stage > 0 && stage <= numStage) { + if (FindSlides()) { + int index = _slideList[stage - 1]; + + _controllerLeft.Index = index; + _controllerRight.Index = index; + + _controllerLeft.ResetSlide(); + _controllerRight.ResetSlide(); + + Log($"Set slide success: {index}"); + } else { + Log("Set slide failed", mode: 1); + res = false; + } + } else { + Log($"Invalid stage: {stage}", mode: 1); + res = false; + } + + return res; + } + + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // `Awake` 메시지 용 메서드 protected override bool Awake_() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18Manager.cs index da8998f..2b59f17 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18Manager.cs @@ -1,6 +1,4 @@ -using UnityEngine; - -public class Anomaly18Manager : SCH_AnomalyManager +public class Anomaly18Manager : AbstractAnomalyController { /************** * properties * @@ -9,9 +7,9 @@ public class Anomaly18Manager : SCH_AnomalyManager // 클래스 이름 public override string Name { get; } = "Anomaly18Manager"; - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // `Awake` 메시지 용 메서드 protected override bool Awake_() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Interactable.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Interactable.cs index 4432f04..88c1f38 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Interactable.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Interactable.cs @@ -1,7 +1,7 @@ using System.Collections; using UnityEngine; -public class Anomaly18_Interactable : SCH_AnomalyInteractable +public class Anomaly18_Interactable : AbstractAnomalyInteractable { /********** * fields * @@ -17,9 +17,34 @@ public class Anomaly18_Interactable : SCH_AnomalyInteractable // 클래스 이름 public override string Name { get; } = "Anomaly18_Prefab"; - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /********************************* + * implementation: IInteractable * + *********************************/ + + // 상호작용 시 실행될 메서드 + public override void OnInteract() + { + base.OnInteract(); + + Log("Call `GameManager.SetStageClear` begin"); + GameManager.Instance.SetStageClear(); + Log("Call `GameManager.SetStageClear` end"); + + // Code used before `GameManager` updates begin + AbstractAnomalyController controller = FindAnyObjectByType(); + + Log($"Call `{controller.Name}.ResetAnomaly` begin"); + if (controller.ResetAnomaly()) { + Log($"Call `{controller.Name}.ResetAnomaly` success"); + } else { + Log($"Call `{controller.Name}.ResetAnomaly` failed", mode: 1); + } + // Code used before `GameManager` updates end + } + + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 초기화하는 메서드 public override bool ResetAnomaly() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Object.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Object.cs index be71a1a..1a07f1c 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Object.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Object.cs @@ -1,7 +1,7 @@ using System.Collections; using UnityEngine; -public class Anomaly18_Object : SCH_AnomalyObject +public class Anomaly18_Object : AbstractAnomalyObject { /********** * fields * @@ -23,9 +23,9 @@ public class Anomaly18_Object : SCH_AnomalyObject // 클래스 이름 public override string Name { get; } = "Anomaly18_Object"; - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 시작하는 메서드 public override bool StartAnomaly() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Prefab.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Prefab.cs index 45484d0..b4f428b 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Prefab.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Prefab.cs @@ -1,7 +1,7 @@ using System.Collections; using UnityEngine; -public class Anomaly18_Prefab : SCH_AnomalyObject +public class Anomaly18_Prefab : AbstractAnomalyObject { /********** * fields * @@ -17,9 +17,9 @@ public class Anomaly18_Prefab : SCH_AnomalyObject // 클래스 이름 public override string Name { get; } = "Anomaly18_Prefab"; - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 초기화하는 메서드 public override bool ResetAnomaly() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19Manager.cs index 8fcdf5f..d89612f 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19Manager.cs @@ -1,6 +1,4 @@ -using UnityEngine; - -public class Anomaly19Manager : SCH_AnomalyManager +public class Anomaly19Manager : AbstractAnomalyController { /************** * properties * @@ -9,9 +7,9 @@ public class Anomaly19Manager : SCH_AnomalyManager // 클래스 이름 public override string Name { get; } = "Anomaly19Manager"; - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // `Awake` 메시지 용 메서드 protected override bool Awake_() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19_Slide.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19_Slide.cs index ba83a05..3652e1c 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19_Slide.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19_Slide.cs @@ -1,7 +1,7 @@ using UnityEngine; [RequireComponent(typeof(SlideController))] -public class Anomaly19_Slide : SCH_AnomalyInteractable +public class Anomaly19_Slide : AbstractAnomalyInteractable { /********** * fields * @@ -41,9 +41,34 @@ void Update() } /********************************* - * implementation: SCH_Behaviour * + * implementation: IInteractable * *********************************/ + // 상호작용 시 실행될 메서드 + public override void OnInteract() + { + base.OnInteract(); + + Log("Call `GameManager.SetStageClear` begin"); + GameManager.Instance.SetStageClear(); + Log("Call `GameManager.SetStageClear` end"); + + // Code used before `GameManager` updates begin + AbstractAnomalyController controller = FindAnyObjectByType(); + + Log($"Call `{controller.Name}.ResetAnomaly` begin"); + if (controller.ResetAnomaly()) { + Log($"Call `{controller.Name}.ResetAnomaly` success"); + } else { + Log($"Call `{controller.Name}.ResetAnomaly` failed", mode: 1); + } + // Code used before `GameManager` updates end + } + + /************************************* + * implementation: AbstractBehaviour * + *************************************/ + // 필드를 초기화하는 메서드 protected override bool InitFields() { @@ -65,9 +90,9 @@ protected override bool InitFields() return res; } - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 시작하는 메서드 public override bool StartAnomaly() @@ -100,9 +125,9 @@ public override bool ResetAnomaly() return res; } - /*********** - * methods * - ***********/ + /*************** + * new methods * + ***************/ // 카메라와의 거리를 구하는 메서드 private float DistanceToCamera() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1Manager.cs index ae0139c..4e5f27b 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1Manager.cs @@ -1,9 +1,5 @@ -using UnityEngine; - -public class Anomaly1Manager : SCH_AnomalyManager +public class Anomaly1Manager : AbstractAnomalyController { - public Vector3 positionChair; - /************** * properties * **************/ @@ -11,9 +7,9 @@ public class Anomaly1Manager : SCH_AnomalyManager // 클래스 이름 public override string Name { get; } = "Anomaly1Manager"; - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // `Awake` 메시지 용 메서드 protected override bool Awake_() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Chair.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Chair.cs index 5f16cd1..5c8366d 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Chair.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Chair.cs @@ -1,6 +1,6 @@ using UnityEngine; -public class Anomaly1_Chair : SCH_AnomalyObject +public class Anomaly1_Chair : AbstractAnomalyObject { /********** * fields * @@ -16,9 +16,9 @@ public class Anomaly1_Chair : SCH_AnomalyObject // 클래스 이름 public override string Name { get; } = "Anomaly1_Chair"; - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 시작하는 메서드 public override bool StartAnomaly() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Girl.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Girl.cs index 7da141e..e5e63db 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Girl.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Girl.cs @@ -1,7 +1,7 @@ using UnityEngine; [RequireComponent(typeof(Animator))] -public class Anomaly1_Girl : SCH_AnomalyInteractable +public class Anomaly1_Girl : AbstractAnomalyInteractable { /************** * properties * @@ -10,9 +10,34 @@ public class Anomaly1_Girl : SCH_AnomalyInteractable // 클래스 이름 public override string Name { get; } = "Anomaly1_Girl"; - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /********************************* + * implementation: IInteractable * + *********************************/ + + // 상호작용 시 실행될 메서드 + public override void OnInteract() + { + base.OnInteract(); + + Log("Call `GameManager.SetStageClear` begin"); + GameManager.Instance.SetStageClear(); + Log("Call `GameManager.SetStageClear` end"); + + // Code used before `GameManager` updates begin + AbstractAnomalyController controller = FindAnyObjectByType(); + + Log($"Call `{controller.Name}.ResetAnomaly` begin"); + if (controller.ResetAnomaly()) { + Log($"Call `{controller.Name}.ResetAnomaly` success"); + } else { + Log($"Call `{controller.Name}.ResetAnomaly` failed", mode: 1); + } + // Code used before `GameManager` updates end + } + + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 초기화하는 메서드 public override bool ResetAnomaly() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20Manager.cs index 7618680..513dbf1 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20Manager.cs @@ -1,6 +1,4 @@ -using UnityEngine; - -public class Anomaly20Manager : SCH_AnomalyManager +public class Anomaly20Manager : AbstractAnomalyController { /************** * properties * @@ -9,9 +7,9 @@ public class Anomaly20Manager : SCH_AnomalyManager // 클래스 이름 public override string Name { get; } = "Anomaly20Manager"; - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // `Awake` 메시지 용 메서드 protected override bool Awake_() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Interactable.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Interactable.cs index a9f6539..1d817c7 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Interactable.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Interactable.cs @@ -1,6 +1,6 @@ using UnityEngine; -public class Anomaly20_Interactable : SCH_AnomalyInteractable +public class Anomaly20_Interactable : AbstractAnomalyInteractable { /********** * fields * @@ -22,9 +22,34 @@ public class Anomaly20_Interactable : SCH_AnomalyInteractable public override string Name { get; } = "Anomaly20_Interactable"; /********************************* - * implementation: SCH_Behaviour * + * implementation: IInteractable * *********************************/ + // 상호작용 시 실행될 메서드 + public override void OnInteract() + { + base.OnInteract(); + + Log("Call `GameManager.SetStageClear` begin"); + GameManager.Instance.SetStageClear(); + Log("Call `GameManager.SetStageClear` end"); + + // Code used before `GameManager` updates begin + AbstractAnomalyController controller = FindAnyObjectByType(); + + Log($"Call `{controller.Name}.ResetAnomaly` begin"); + if (controller.ResetAnomaly()) { + Log($"Call `{controller.Name}.ResetAnomaly` success"); + } else { + Log($"Call `{controller.Name}.ResetAnomaly` failed", mode: 1); + } + // Code used before `GameManager` updates end + } + + /************************************* + * implementation: AbstractBehaviour * + *************************************/ + // 필드를 초기화하는 메서드 protected override bool InitFields() { @@ -51,9 +76,9 @@ protected override bool InitFields() return res; } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // 이상현상을 초기화하는 메서드 public override bool ResetAnomaly() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableBack.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableBack.cs index 05b8603..a6c9dc5 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableBack.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableBack.cs @@ -36,9 +36,9 @@ void Update() } } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // 필드를 초기화하는 메서드 protected override bool InitFields() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableFront.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableFront.cs index 388cd26..2c58352 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableFront.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableFront.cs @@ -36,9 +36,9 @@ void Update() } } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // 필드를 초기화하는 메서드 protected override bool InitFields() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableRight.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableRight.cs index 93208f1..90f6676 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableRight.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableRight.cs @@ -38,9 +38,9 @@ void Update() } } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // 필드를 초기화하는 메서드 protected override bool InitFields() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Player.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Player.cs index 1c07ebb..ddd6d7d 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Player.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Player.cs @@ -1,7 +1,7 @@ using System.Collections; using UnityEngine; -public class Anomaly20_Player : SCH_AnomalyObject +public class Anomaly20_Player : AbstractAnomalyObject { /********** * fields * @@ -36,9 +36,9 @@ void Update() transform.rotation = Quaternion.Euler(0.0f, playerTransform.rotation.eulerAngles.y, 0.0f); } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // 필드를 초기화하는 메서드 protected override bool InitFields() @@ -57,9 +57,9 @@ protected override bool InitFields() return res; } - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 초기화하는 메서드 public override bool ResetAnomaly() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Manager.cs index 1d10be3..026a05c 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Manager.cs @@ -1,6 +1,4 @@ -using UnityEngine; - -public class Anomaly23Manager : SCH_AnomalyManager +public class Anomaly23Manager : AbstractAnomalyController { /************** * properties * @@ -9,9 +7,9 @@ public class Anomaly23Manager : SCH_AnomalyManager // 클래스 이름 public override string Name { get; } = "Anomaly23Manager"; - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // `Awake` 메시지 용 메서드 protected override bool Awake_() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Ghost.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Ghost.cs index e06819f..3513403 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Ghost.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Ghost.cs @@ -3,7 +3,7 @@ [RequireComponent(typeof(Animator))] [RequireComponent(typeof(AudioSource))] -public class Anomaly23_Ghost : SCH_AnomalyObject +public class Anomaly23_Ghost : AbstractAnomalyObject { /********** * fields * @@ -86,16 +86,27 @@ void Update() } else if (!_isCatched) { _isChasing = false; - Log("Call `Manager.InteractionSuccess` begin"); - Manager.InteractionSuccess(); - Log("Call `Manager.InteractionSuccess` end"); + Log("Call `GameManager.SetStageClear` begin"); + GameManager.Instance.SetStageClear(); + Log("Call `GameManager.SetStageClear` end"); + + // Code used before `GameManager` updates begin + AbstractAnomalyController controller = FindAnyObjectByType(); + + Log($"Call `{controller.Name}.ResetAnomaly` begin"); + if (controller.ResetAnomaly()) { + Log($"Call `{controller.Name}.ResetAnomaly` success"); + } else { + Log($"Call `{controller.Name}.ResetAnomaly` failed", mode: 1); + } + // Code used before `GameManager` updates end } } } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // 필드를 초기화하는 메서드 protected override bool InitFields() @@ -153,9 +164,9 @@ protected override bool InitFields() return res; } - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 시작하는 메서드 public override bool StartAnomaly() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Laptop.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Laptop.cs index f47a228..d1c5322 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Laptop.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Laptop.cs @@ -1,7 +1,7 @@ using UnityEngine; [RequireComponent(typeof(LaptopScreenController))] -public class Anomaly23_Laptop : SCH_AnomalyObject +public class Anomaly23_Laptop : AbstractAnomalyObject { /********** * fields * @@ -36,9 +36,9 @@ void Update() } } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // 필드를 초기화하는 메서드 protected override bool InitFields() @@ -61,9 +61,9 @@ protected override bool InitFields() return res; } - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 시작하는 메서드 public override bool StartAnomaly() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2Manager.cs index f84754e..4cff72d 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2Manager.cs @@ -1,6 +1,4 @@ -using UnityEngine; - -public class Anomaly2Manager : SCH_AnomalyManager +public class Anomaly2Manager : AbstractAnomalyController { /************** * properties * @@ -9,9 +7,9 @@ public class Anomaly2Manager : SCH_AnomalyManager // 클래스 이름 public override string Name { get; } = "Anomaly2Manager"; - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // `Awake` 메시지 용 메서드 protected override bool Awake_() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2_Laptop.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2_Laptop.cs index cc8dff5..a9ce138 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2_Laptop.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2_Laptop.cs @@ -1,7 +1,7 @@ using UnityEngine; [RequireComponent(typeof(LaptopFaceController))] -public class Anomaly2_Laptop : SCH_AnomalyInteractable +public class Anomaly2_Laptop : AbstractAnomalyInteractable { /********** * fields * @@ -21,9 +21,34 @@ public class Anomaly2_Laptop : SCH_AnomalyInteractable public override string Name { get; } = "Anomaly2_Laptop"; /********************************* - * implementation: SCH_Behaviour * + * implementation: IInteractable * *********************************/ + // 상호작용 시 실행될 메서드 + public override void OnInteract() + { + base.OnInteract(); + + Log("Call `GameManager.SetStageClear` begin"); + GameManager.Instance.SetStageClear(); + Log("Call `GameManager.SetStageClear` end"); + + // Code used before `GameManager` updates begin + AbstractAnomalyController controller = FindAnyObjectByType(); + + Log($"Call `{controller.Name}.ResetAnomaly` begin"); + if (controller.ResetAnomaly()) { + Log($"Call `{controller.Name}.ResetAnomaly` success"); + } else { + Log($"Call `{controller.Name}.ResetAnomaly` failed", mode: 1); + } + // Code used before `GameManager` updates end + } + + /************************************* + * implementation: AbstractBehaviour * + *************************************/ + // 필드를 초기화하는 메서드 protected override bool InitFields() { @@ -41,9 +66,9 @@ protected override bool InitFields() return res; } - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 시작하는 메서드 public override bool StartAnomaly() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6Manager.cs index 373a0f0..378099a 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6Manager.cs @@ -1,6 +1,4 @@ -using UnityEngine; - -public class Anomaly6Manager : SCH_AnomalyManager +public class Anomaly6Manager : AbstractAnomalyController { /************** * properties * @@ -9,9 +7,9 @@ public class Anomaly6Manager : SCH_AnomalyManager // 클래스 이름 public override string Name { get; } = "Anomaly6Manager"; - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + /************************************* + * implementation: AbstractBehaviour * + *************************************/ // `Awake` 메시지 용 메서드 protected override bool Awake_() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6_Cake.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6_Cake.cs index 2b32d19..e7deb98 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6_Cake.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6_Cake.cs @@ -1,7 +1,7 @@ using System.Collections; using UnityEngine; -public class Anomaly6_Cake : SCH_AnomalyInteractable +public class Anomaly6_Cake : AbstractAnomalyInteractable { /********** * fields * @@ -16,9 +16,34 @@ public class Anomaly6_Cake : SCH_AnomalyInteractable // 클래스 이름 public override string Name { get; } = "Anomaly6_Cake"; - /************************************* - * implementation: SCH_AnomalyObject * - *************************************/ + /********************************* + * implementation: IInteractable * + *********************************/ + + // 상호작용 시 실행될 메서드 + public override void OnInteract() + { + base.OnInteract(); + + Log("Call `GameManager.SetStageClear` begin"); + GameManager.Instance.SetStageClear(); + Log("Call `GameManager.SetStageClear` end"); + + // Code used before `GameManager` updates begin + AbstractAnomalyController controller = FindAnyObjectByType(); + + Log($"Call `{controller.Name}.ResetAnomaly` begin"); + if (controller.ResetAnomaly()) { + Log($"Call `{controller.Name}.ResetAnomaly` success"); + } else { + Log($"Call `{controller.Name}.ResetAnomaly` failed", mode: 1); + } + // Code used before `GameManager` updates end + } + + /***************************************** + * implementation: AbstractAnomalyObject * + *****************************************/ // 이상현상을 초기화하는 메서드 public override bool ResetAnomaly()