diff --git a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (1).prefab b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (1).prefab index 4316fba..2b8df49 100644 --- a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (1).prefab +++ b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (1).prefab @@ -44,7 +44,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b3698bbfa0cfc4b73bc9dd4d3b8c5468, type: 3} m_Name: m_EditorClassIdentifier: - nameGameManager: GameManager - nameChair: chair (20) + names: + - chair (20) + prefabs: + - {fileID: 3766714381938235252, guid: 63dac8321736a9a4587f4fd967a5d0d8, type: 3} + nameChair: prefabGirl: {fileID: 3766714381938235252, guid: 63dac8321736a9a4587f4fd967a5d0d8, type: 3} positionChair: {x: -5.83, y: 0.72, z: 13.4} diff --git a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (18).prefab b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (18).prefab index 84d5d1b..bd1d127 100644 --- a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (18).prefab +++ b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (18).prefab @@ -44,23 +44,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 921b5d489d0fd473a90b2648020b6981, type: 3} m_Name: m_EditorClassIdentifier: - nameWall: WallBack - nameClock: clock - positionWall: {x: 0, y: 0, z: 0} - positionClock: {x: -18.5, y: 7.06, z: 1.84} - directionWall: {x: -1, y: 0, z: 0} - directionClock: {x: -1, y: 0, z: 0} - positionNormal: 0 - positionAnomaly: 6.6 - prefabDesks: {fileID: 3135954807459457769, guid: d37030a3e9613de409491dab9c926a06, type: 3} - prefabChairs: {fileID: 2824771154171234484, guid: d314417c861d1174caaa974bcaeb1a14, type: 3} - prefabInteractables: - - {fileID: 6330698921243240140, guid: 67be1e6b104df81468a52f46aba49d8c, type: 3} - - {fileID: 8989905498966388834, guid: 6b079452df3a5da44aae624404efe648, type: 3} - - {fileID: 5419280097993429686, guid: 8009063ebbca7d14b9f119abdf467f48, type: 3} - - {fileID: 661700201260497465, guid: 147a5b1985730a849bd4568b4c7dd68d, type: 3} - - {fileID: 5839778339388796868, guid: e756aae9e6d5a2c4aa53edf63a90a73e, type: 3} - - {fileID: 1761092321075197500, guid: 189843821322f8d46a0c044b91aecd8a, type: 3} + names: + - WallBack + - clock prefabs: - {fileID: 3135954807459457769, guid: d37030a3e9613de409491dab9c926a06, type: 3} - {fileID: 2824771154171234484, guid: d314417c861d1174caaa974bcaeb1a14, type: 3} @@ -70,5 +56,5 @@ MonoBehaviour: - {fileID: 661700201260497465, guid: 147a5b1985730a849bd4568b4c7dd68d, type: 3} - {fileID: 5839778339388796868, guid: e756aae9e6d5a2c4aa53edf63a90a73e, type: 3} - {fileID: 1761092321075197500, guid: 189843821322f8d46a0c044b91aecd8a, type: 3} - durationMove: 5 - durationFade: 2 + nameWall: WallBack + nameClock: clock diff --git a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (19).prefab b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (19).prefab index 3069145..f58f205 100644 --- a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (19).prefab +++ b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (19).prefab @@ -44,5 +44,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ac9ccff8bcade466eaa77e3dfd322477, type: 3} m_Name: m_EditorClassIdentifier: - nameGameManager: GameManager + names: + - SlideRight + prefabs: [] nameSlide: SlideRight diff --git a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (2).prefab b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (2).prefab index 33d0f48..05c606e 100644 --- a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (2).prefab +++ b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (2).prefab @@ -44,5 +44,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 71a8eeeaaa8fe4e91b0707e40548c7dc, type: 3} m_Name: m_EditorClassIdentifier: - nameGameManager: GameManager + names: + - LaptopFace + prefabs: [] nameLaptop: LaptopFace diff --git a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (20).prefab b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (20).prefab index 3d5ba08..93dd60f 100644 --- a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (20).prefab +++ b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (20).prefab @@ -44,10 +44,14 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 085c515f4a72f447ca184b2322523ea7, type: 3} m_Name: m_EditorClassIdentifier: - nameGameManager: GameManager + names: [] + prefabs: + - {fileID: 1585356450965799673, guid: f6f048eaa6cbbd149a13d00c9d48bd32, type: 3} + - {fileID: 6007555188655779168, guid: 0852fbf6270b3594ca9d568aa073d9f0, type: 3} + - {fileID: 6352980353013582430, guid: 0668cb8fc4c4adf4d89c5576aa49baa3, type: 3} + - {fileID: 8359328002521216368, guid: 20dd6377462426d459e214f2050cbf9e, type: 3} prefabPlayer: {fileID: 1585356450965799673, guid: f6f048eaa6cbbd149a13d00c9d48bd32, type: 3} prefabsInteractable: - {fileID: 6007555188655779168, guid: 0852fbf6270b3594ca9d568aa073d9f0, type: 3} - {fileID: 6352980353013582430, guid: 0668cb8fc4c4adf4d89c5576aa49baa3, type: 3} - {fileID: 8359328002521216368, guid: 20dd6377462426d459e214f2050cbf9e, type: 3} - duration: 2 diff --git a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (23).prefab b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (23).prefab index 4e24163..9546661 100644 --- a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (23).prefab +++ b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (23).prefab @@ -44,6 +44,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 88057b82d9de4412ab8dbda29fc6b064, type: 3} m_Name: m_EditorClassIdentifier: - nameGameManager: GameManager + names: + - Laptop + prefabs: + - {fileID: 6383441288876432308, guid: 81c28fcb68ce14547b921480ce36bbed, type: 3} nameLaptop: Laptop prefabGhost: {fileID: 6383441288876432308, guid: 81c28fcb68ce14547b921480ce36bbed, type: 3} diff --git a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (6).prefab b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (6).prefab index 51d0743..7189a3a 100644 --- a/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (6).prefab +++ b/302/Assets/Prefabs/SpecificAnomalyManager/AnomalyManager (6).prefab @@ -44,5 +44,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b5cacf602dde845d8a9e49737c5381f2, type: 3} m_Name: m_EditorClassIdentifier: - nameGameManager: GameManager + names: [] + prefabs: + - {fileID: 1113413758793249629, guid: dae6286e84063a94a93a349b3da00e3f, type: 3} prefabCake: {fileID: 1113413758793249629, guid: dae6286e84063a94a93a349b3da00e3f, type: 3} diff --git a/302/Assets/Scripts/GameManager.cs b/302/Assets/Scripts/GameManager.cs index e94f6c6..3150519 100644 --- a/302/Assets/Scripts/GameManager.cs +++ b/302/Assets/Scripts/GameManager.cs @@ -41,7 +41,7 @@ private void Start() // Added by 신 채 환 // 슬라이드 초기화 - SlideManager.Instance.InitSlideList(); + SlideManager.Instance.GenerateSlideList(); StartCoroutine(InitializeSlideAfterLoad()); } private void InitializeGame() @@ -93,7 +93,7 @@ public void Sleep() // Added by 신 채 환 // 슬라이드 색인 배열 재생성 - SlideManager.Instance.InitSlideList(); + SlideManager.Instance.GenerateSlideList(); } currentStageClear = false; // 클리어 상태 초기화 LoadDefaultScene(); diff --git a/302/Assets/Scripts/LaptopFaceController.cs b/302/Assets/Scripts/LaptopFaceController.cs index f4ac2f7..14b1642 100644 --- a/302/Assets/Scripts/LaptopFaceController.cs +++ b/302/Assets/Scripts/LaptopFaceController.cs @@ -80,16 +80,16 @@ protected override bool InitFields() // _colour _colour = defaults[0].GetPixel(407, 297); - Log("Initialize `_colour`: success: " + Log("Initialize `_colour` success: " + $"Color({_colour.r}, {_colour.g}, {_colour.b}, {_colour.a})"); // _isGazing _isGazing = false; - Log("Initialize `_isGazing`: success"); + Log("Initialize `_isGazing` success"); // _tangent _tangent = 0; - Log("Initialize `_tangent`: success"); + Log("Initialize `_tangent` success"); return res; } diff --git a/302/Assets/Scripts/LaptopScreenController.cs b/302/Assets/Scripts/LaptopScreenController.cs index 85068cc..0928165 100644 --- a/302/Assets/Scripts/LaptopScreenController.cs +++ b/302/Assets/Scripts/LaptopScreenController.cs @@ -40,18 +40,20 @@ public int Index { } } - /************ - * messages * - ************/ + /********************************* + * implementation: SCH_Behaviour * + *********************************/ - // This function is called when the object becomes enabled and active. - protected override void OnEnable() + // `Awake` 메시지 용 메서드 + protected override bool Awake_() { - base.OnEnable(); + bool res = base.Awake_(); Log("Call `ResetScreen` begin"); ResetScreen(); Log("Call `ResetScreen` end"); + + return res; } /*********** diff --git a/302/Assets/Scripts/SCH_AnomalyInteractable.cs b/302/Assets/Scripts/SCH_AnomalyInteractable.cs index 8495b34..80a34b5 100644 --- a/302/Assets/Scripts/SCH_AnomalyInteractable.cs +++ b/302/Assets/Scripts/SCH_AnomalyInteractable.cs @@ -11,7 +11,7 @@ public class SCH_AnomalyInteractable : SCH_AnomalyObject, IInteractable public string prompt; public float distanceInteractionMax; - // 기타 수치 + // 내부 수치 protected bool canInteract; /************** @@ -34,14 +34,14 @@ public string GetInteractionPrompt() // 상호작용 시 실행될 메서드 public void OnInteract() { - Log("Interaction occurs."); + Log($"Interaction with `{gameObject.name}`"); if (Manager != null) { - Log("Call `Manager.InteractionSuccess` begin"); + Log($"Call `{Manager.Name}.InteractionSuccess` begin"); Manager.InteractionSuccess(); - Log("Call `Manager.InteractionSuccess` end"); + Log($"Call `{Manager.Name}.InteractionSuccess` end"); } else { - Log("Call `Manager.InteractionSuccess`: failed", mode: 1); + Log($"Call `{Manager.Name}.InteractionSuccess` failed", mode: 1); } canInteract = false; @@ -60,11 +60,21 @@ public bool CanInteract(float distance) // 필드를 초기화하는 메서드 protected override bool InitFields() { + Collider collider = GetComponent(); bool res = base.InitFields(); + // collider.isTrigger + if (collider != null) { + collider.isTrigger = false; + Log("Set `collider.isTrigger` success"); + } else { + Log("Set `collider.isTrigger` failed", mode: 1); + res = false; + } + // canInteract canInteract = true; - Log("Initialize `canInteract`: success"); + Log("Initialize `canInteract` success"); return res; } diff --git a/302/Assets/Scripts/SCH_AnomalyManager.cs b/302/Assets/Scripts/SCH_AnomalyManager.cs index d1d0a4b..5fe199f 100644 --- a/302/Assets/Scripts/SCH_AnomalyManager.cs +++ b/302/Assets/Scripts/SCH_AnomalyManager.cs @@ -7,6 +7,12 @@ public class SCH_AnomalyManager : SCH_AnomalyObject * fields * **********/ + // 오브젝트 이름 배열 + public string[] names; + + // 프리팹 배열 + public GameObject[] prefabs; + // 이상현상 오브젝트 리스트 protected List objects; @@ -28,11 +34,11 @@ protected override bool InitFields() // Manager Manager = this; - Log("Initialize `Manager`: success"); + Log("Initialize `Manager` success"); // objects objects = new List(); - Log("Initialize `objects`: success"); + Log("Initialize `objects` success"); return res; } @@ -41,17 +47,43 @@ protected override bool InitFields() * implementation: SCH_AnomalyObject * *************************************/ + // 이상현상을 시작하는 메서드 + public override bool StartAnomaly() + { + bool res = base.StartAnomaly(); + + Log("Call `InitObjects` begin"); + if (InitObjects()) { + Log("Call `InitObjects` success"); + } else { + Log("Call `InitObjects` failed", mode: 1); + res = false; + } + + foreach (SCH_AnomalyObject obj in objects) { + Log($"Call `{obj.Name}.StartAnomaly` for {obj.gameObject.name} begin"); + if (obj.StartAnomaly()) { + Log($"Call `{obj.Name}.StartAnomaly` success"); + } else { + Log($"Call `{obj.Name}.StartAnomaly` failed", mode: 1); + res = false; + } + } + + return res; + } + // 이상현상을 초기화하는 메서드 public override bool ResetAnomaly() { bool res = base.ResetAnomaly(); foreach (SCH_AnomalyObject obj in objects) { - Log($"Call `{obj.Name}.ResetAnomaly` for `{obj.gameObject.name}` begin"); + Log($"Call `{obj.Name}.ResetAnomaly` for {obj.gameObject.name} begin"); if (obj.ResetAnomaly()) { - Log($"Call `{obj.Name}.ResetAnomaly` for `{obj.gameObject.name}` end: success"); + Log($"Call `{obj.Name}.ResetAnomaly` success"); } else { - Log($"Call `{obj.Name}.ResetAnomaly` for `{obj.gameObject.name}` end: failed", mode: 1); + Log($"Call `{obj.Name}.ResetAnomaly` failed", mode: 1); res = false; } } @@ -68,18 +100,68 @@ public virtual bool InteractionSuccess() { bool res = true; - Log("Call `_manager.SetStageClear` begin"); + Log("Call `GameManager.SetStageClear` begin"); GameManager.Instance.SetStageClear(); - Log("Call `_manager.SetStageClear` end"); + Log("Call `GameManager.SetStageClear` end"); Log("Call `ResetAnomaly` begin"); if (ResetAnomaly()) { - Log("Call `ResetAnomaly` end: success"); + Log("Call `ResetAnomaly` success"); } else { - Log("Call `ResetAnomaly` end: failed", mode: 1); + Log("Call `ResetAnomaly` failed", mode: 1); res = false; } return res; } + + // 오브젝트를 초기화하는 메서드 + protected virtual bool InitObjects() + { + bool res = true; + + // 오브젝트 + foreach (string name in names) { + GameObject gameObj = GameObject.Find(name); + + if (gameObj != null) { + SCH_AnomalyObject obj = gameObj.GetComponent(); + + if (obj != null) { + obj.Manager = this; + objects.Add(obj); + Log($"Find `{name}` success: {obj.Name}"); + } else { + Log($"Find `{name}` failed", mode: 1); + res = false; + } + } else { + Log($"Find `{name}` failed", mode: 1); + res = false; + } + } + + // 프리팹 + foreach (GameObject prefab in prefabs) { + GameObject gameObj = Instantiate(prefab); + + if (gameObj != null) { + SCH_AnomalyObject obj = gameObj.GetComponent(); + + if (obj != null) { + obj.Manager = this; + objects.Add(obj); + Log($"Instantiate `{prefab.name}` success: {obj.Name}"); + } else { + Log($"Instantiate `{prefab.name}` failed", mode: 1); + res = false; + } + } else { + Log($"Instantiate `{prefab.name}` failed", mode: 1); + res = false; + } + } + + return res; + } } diff --git a/302/Assets/Scripts/SCH_AnomalyObject.cs b/302/Assets/Scripts/SCH_AnomalyObject.cs index da9e9d4..ab68b37 100644 --- a/302/Assets/Scripts/SCH_AnomalyObject.cs +++ b/302/Assets/Scripts/SCH_AnomalyObject.cs @@ -1,5 +1,3 @@ -using UnityEngine; - public class SCH_AnomalyObject : SCH_Behaviour { /************** @@ -12,29 +10,12 @@ public class SCH_AnomalyObject : SCH_Behaviour // 이상현상 매니저 public SCH_AnomalyManager Manager { get; set; } - /************ - * messages * - ************/ - - // This function is called when the object becomes enabled and active. - protected override void OnEnable() - { - base.OnEnable(); - - Log("Call `SetAnomaly` begin"); - if (SetAnomaly()) { - Log("Call `SetAnomaly` end: success"); - } else { - Log("Call `SetAnomaly` end: failed", mode: 1); - } - } - /******************* * virtual methods * *******************/ // 이상현상을 시작하는 메서드 - protected virtual bool SetAnomaly() + public virtual bool StartAnomaly() { return true; } diff --git a/302/Assets/Scripts/SCH_Behaviour.cs b/302/Assets/Scripts/SCH_Behaviour.cs index a5f9ba7..8cb97f9 100644 --- a/302/Assets/Scripts/SCH_Behaviour.cs +++ b/302/Assets/Scripts/SCH_Behaviour.cs @@ -13,14 +13,14 @@ public class SCH_Behaviour : MonoBehaviour * messages * ************/ - // This function is called when the object becomes enabled and active. - protected virtual void OnEnable() + // Unity calls `Awake` when an enabled script instance is being loaded. + void Awake() { - Log("Call `InitFields` begin"); - if (InitFields()) { - Log("Call `InitFields` end: success"); + Log("Call `Awake_` begin"); + if (Awake_()) { + Log("Call `Awake_` success"); } else { - Log("Call `InitFields` end: failed", mode: 1); + Log("Call `Awake_` failed", mode: 1); } } @@ -28,28 +28,44 @@ protected virtual void OnEnable() * virtual methods * *******************/ + // `Awake` 메시지 용 메서드 + protected virtual bool Awake_() + { + bool res = true; + + Log("Call `InitFields` begin"); + if (InitFields()) { + Log("Call `InitFields` success"); + } else { + Log("Call `InitFields` failed", mode: 1); + res = false; + } + + return res; + } + // 필드를 초기화하는 메서드 protected virtual bool InitFields() { return true; } - /**************** - * util methods * - ****************/ + /*********** + * methods * + ***********/ // 로깅 용 메서드 - protected void Log(string messege, int mode = 0) + protected void Log(string message, int mode = 0) { switch (mode) { case 0: - Debug.Log($"[{Name}] {messege}"); + Debug.Log($"[{Name}] {message}"); break; case 1: - Debug.LogWarning($"[{Name}] {messege}"); + Debug.LogWarning($"[{Name}] {message}"); break; case 2: - Debug.LogError($"[{Name}] {messege}"); + Debug.LogError($"[{Name}] {message}"); break; } } diff --git a/302/Assets/Scripts/SlideController.cs b/302/Assets/Scripts/SlideController.cs index b3acd63..067e8bc 100644 --- a/302/Assets/Scripts/SlideController.cs +++ b/302/Assets/Scripts/SlideController.cs @@ -65,26 +65,26 @@ protected override bool InitFields() // 난수 _random = new SCH_Random(); - Log("Initialize `_random`: success"); + Log("Initialize `_random` success"); // 흘러내림 관련 필드 _trickleXMinList = new List(); - Log("Initialize `_trickleXMinList`: success"); + Log("Initialize `_trickleXMinList` success"); _trickleXMaxList = new List(); - Log("Initialize `_trickleXMinList`: success"); + Log("Initialize `_trickleXMinList` success"); _trickleYPrevList = new List(); - Log("Initialize `_trickleYPrevList`: success"); + Log("Initialize `_trickleYPrevList` success"); _trickleYCurrList = new List(); - Log("Initialize `_trickleYCurrList`: success"); + Log("Initialize `_trickleYCurrList` success"); _trickleSpeedList = new List(); - Log("Initialize `_trickleSpeedList`: success"); + Log("Initialize `_trickleSpeedList` success"); _isTrickling = false; - Log("Initialize `_isTrickling`: success"); + Log("Initialize `_isTrickling` success"); return res; } diff --git a/302/Assets/Scripts/SlideManager.cs b/302/Assets/Scripts/SlideManager.cs index 1e1a346..c42c055 100644 --- a/302/Assets/Scripts/SlideManager.cs +++ b/302/Assets/Scripts/SlideManager.cs @@ -32,30 +32,30 @@ public class SlideManager : SCH_Behaviour * properties * **************/ - // 클래스 인자 - public static SlideManager Instance { get; private set; } - // 클래스 이름 public override string Name { get; } = "SlideManager"; - /************ - * messages * - ************/ + // 클래스 인자 + public static SlideManager Instance { get; private set; } + + /********************************* + * implementation: SCH_Behaviour * + *********************************/ - // Unity calls Awake when an enabled script instance is being loaded. - private void Awake() + // `Awake` 메시지 용 메서드 + protected override bool Awake_() { if (Instance == null) { + Log($"`Instance` has not been set => set `Instance` as `{Name}`"); Instance = this; DontDestroyOnLoad(gameObject); } else { + Log($"`Instance` has already been set => destroy `{gameObject.name}`"); Destroy(gameObject); } - } - /********************************* - * implementation: SCH_Behaviour * - *********************************/ + return base.Awake_(); + } // 필드를 초기화하는 메서드 protected override bool InitFields() @@ -64,11 +64,11 @@ protected override bool InitFields() // _random _random = new SCH_Random(); - Log("Initialize `_random`: success"); + Log("Initialize `_random` success"); // _slideList _slideList = new int[numStage]; - Log("Initialize `_slideList`: success"); + Log("Initialize `_slideList` success"); return res; } @@ -78,10 +78,10 @@ protected override bool InitFields() ***************/ // 슬라이드 색인 배열을 초기화하는 메서드 - public void InitSlideList() + public void GenerateSlideList() { _slideList = _random.Combination(numSlide, numStage); - Log($"Set `_slideList`: success: [{string.Join(", ", _slideList)}]"); + Log($"Generate `_slideList` success: [{string.Join(", ", _slideList)}]"); } // 슬라이드를 초기화하는 메서드 @@ -89,7 +89,7 @@ public void SetSlide(int stage) { Log("Call `FindSlides` begin"); if (FindSlides()) { - Log("Call `FindSlides` end: success"); + Log("Call `FindSlides` success"); if (stage > 0) { int index = _slideList[stage - 1]; @@ -99,13 +99,13 @@ public void SetSlide(int stage) _controllerLeft.ResetSlide(); _controllerRight.ResetSlide(); - Log($"Set slide: success: {index}"); + Log($"Set slide success: {index}"); } else { _objectLeft.transform.Translate(Vector3.down * 100.0f); _objectRight.transform.Translate(Vector3.down * 100.0f); } } else { - Log("Call `FindSlides` end: failed", mode: 1); + Log("Call `FindSlides` failed", mode: 1); } } @@ -117,36 +117,36 @@ private bool FindSlides() // `_objectLeft` 찾기 _objectLeft = GameObject.Find(nameLeft); if (_objectLeft != null) { - Log("Find `_objectLeft`: success"); + Log("Find `_objectLeft` success"); // `_controllerLeft` 찾기 _controllerLeft = _objectLeft.GetComponent(); if (_controllerLeft != null) { - Log("Find `_controllerLeft`: success"); + Log("Find `_controllerLeft` success"); } else { - Log("Find `_controllerLeft`: failed", mode: 1); + Log("Find `_controllerLeft` failed", mode: 1); res = false; } } else { - Log("Find `_objectLeft`: failed", mode: 1); + Log("Find `_objectLeft` failed", mode: 1); res = false; } // `_objectRight` 찾기 _objectRight = GameObject.Find(nameRight); if (_objectRight != null) { - Log("Find `_objectRight`: success"); + Log("Find `_objectRight` success"); // `_controllerRight` 찾기 _controllerRight = _objectRight.GetComponent(); if (_controllerRight != null) { - Log("Find `_controllerRight`: success"); + Log("Find `_controllerRight` success"); } else { - Log("Find `_controllerRight`: failed", mode: 1); + Log("Find `_controllerRight` failed", mode: 1); res = false; } } else { - Log("Find `_objectRight`: failed", mode: 1); + Log("Find `_objectRight` failed", mode: 1); res = false; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18Manager.cs index 3119b49..da8998f 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18Manager.cs @@ -2,21 +2,6 @@ public class Anomaly18Manager : SCH_AnomalyManager { - /********** - * fields * - **********/ - - // 오브젝트 이름 - public string nameWall; - public string nameClock; - - // 프리팹 - public GameObject[] prefabs; - - // 오브젝트 - private SCH_AnomalyObject _objectWall; - private SCH_AnomalyObject _objectClock; - /************** * properties * **************/ @@ -28,72 +13,19 @@ public class Anomaly18Manager : SCH_AnomalyManager * implementation: SCH_Behaviour * *********************************/ - // 필드를 초기화하는 메서드 - protected override bool InitFields() + // `Awake` 메시지 용 메서드 + protected override bool Awake_() { - bool res = base.InitFields(); + bool res = base.Awake_(); - // _objectWall - _objectWall = GameObject.Find(nameWall).GetComponent(); - if (_objectWall != null) { - objects.Add(_objectWall); - Log("Initialize `_objectWall`: success"); + Log("Call `StartAnomaly` begin"); + if (StartAnomaly()) { + Log("Call `StartAnomaly` success"); } else { - Log("Initialize `_objectWall`: failed", mode: 1); + Log("Call `StartAnomaly` failed", mode: 1); res = false; } - // _objectClock - _objectClock = GameObject.Find(nameClock).GetComponent(); - if (_objectClock != null) { - objects.Add(_objectClock); - Log("Initialize `_objectClock`: success"); - } else { - Log("Initialize `_objectClock`: failed", mode: 1); - res = false; - } - - return res; - } - - /************************************** - * implementation: SCH_AnomalyManager * - **************************************/ - - // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() - { - bool res = base.SetAnomaly(); - - // 벽 - if (_objectWall) { - _objectWall.enabled = true; - _objectWall.Manager = this; - Log("Set `_objectWall`: success"); - } else { - Log("Set `_objectWall`: failed", mode: 1); - res = false; - } - - // 시계 - if (_objectClock) { - _objectClock.enabled = true; - _objectClock.Manager = this; - Log("Set `_objectClock`: success"); - } else { - Log("Set `_objectClock`: failed", mode: 1); - res = false; - } - - // 프리팹 - foreach (GameObject prefab in prefabs) { - SCH_AnomalyObject obj = Instantiate(prefab).GetComponent(); - - obj.Manager = this; - objects.Add(obj); - Log($"Set `{prefab.name}`: success"); - } - return res; } } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Interactable.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Interactable.cs index 1f713cc..4432f04 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Interactable.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Interactable.cs @@ -32,9 +32,9 @@ public override bool ResetAnomaly() return res; } - /*********** - * methods * - ***********/ + /*************** + * new methods * + ***************/ // 지속시간 동안 투명해지다가 사라지는 메서드 private IEnumerator FadeAsync() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Object.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Object.cs index 4b247dd..a019a69 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Object.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Object.cs @@ -28,12 +28,12 @@ public class Anomaly18_Object : SCH_AnomalyObject *************************************/ // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() + public override bool StartAnomaly() { - bool res = base.SetAnomaly(); + bool res = base.StartAnomaly(); transform.position = position + direction * valueAnomaly; - Log("Set position: success"); + Log("Set position success"); return res; } @@ -49,9 +49,9 @@ public override bool ResetAnomaly() return res; } - /*********** - * methods * - ***********/ + /*************** + * new methods * + ***************/ // 초기 위치부터 최종 위치까지 지속시간 동안 움직이는 메서드 private IEnumerator MoveAsync() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Prefab.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Prefab.cs index a4334dd..45484d0 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Prefab.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly18_Prefab.cs @@ -32,9 +32,9 @@ public override bool ResetAnomaly() return res; } - /*********** - * methods * - ***********/ + /*************** + * new methods * + ***************/ // 지속시간 동안 투명해지다가 사라지는 메서드 private IEnumerator FadeAsync() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19Manager.cs index 80c560c..8fcdf5f 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19Manager.cs @@ -2,16 +2,6 @@ public class Anomaly19Manager : SCH_AnomalyManager { - /********** - * fields * - **********/ - - // 오브젝트 이름 - public string nameSlide; - - // 오브젝트 - private SCH_AnomalyObject _objectSlide; - /************** * properties * **************/ @@ -23,40 +13,16 @@ public class Anomaly19Manager : SCH_AnomalyManager * implementation: SCH_Behaviour * *********************************/ - // 필드를 초기화하는 메서드 - protected override bool InitFields() - { - bool res = base.InitFields(); - - // _objectSlide - _objectSlide = GameObject.Find(nameSlide).GetComponent(); - if (_objectSlide != null) { - objects.Add(_objectSlide); - Log("Initialize `_objectSlide`: success"); - } else { - Log("Initialize `_objectSlide`: failed", mode: 1); - res = false; - } - - return res; - } - - /************************************** - * implementation: SCH_AnomalyManager * - **************************************/ - - // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() + // `Awake` 메시지 용 메서드 + protected override bool Awake_() { - bool res = base.SetAnomaly(); + bool res = base.Awake_(); - // 슬라이드 - if (_objectSlide != null) { - _objectSlide.enabled = true; - _objectSlide.Manager = this; - Log("Set `_objectSlide`: success"); + Log("Call `StartAnomaly` begin"); + if (StartAnomaly()) { + Log("Call `StartAnomaly` success"); } else { - Log("Set `_objectSlide`: failed", mode: 1); + Log("Call `StartAnomaly` failed", mode: 1); res = false; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19_Slide.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19_Slide.cs index f685fff..ba83a05 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19_Slide.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly19_Slide.cs @@ -52,15 +52,15 @@ protected override bool InitFields() // _script _script = GetComponent(); if (_script != null) { - Log("Initialize `_script`: success"); + Log("Initialize `_script` success"); } else { - Log("Initialize `_script`: failed", mode: 1); + Log("Initialize `_script` failed", mode: 1); res = false; } // _isTrickling _isTrickling = false; - Log("Initialize `_isTrickling`: success"); + Log("Initialize `_isTrickling` success"); return res; } @@ -70,13 +70,13 @@ protected override bool InitFields() *************************************/ // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() + public override bool StartAnomaly() { - bool res = base.SetAnomaly(); + bool res = base.StartAnomaly(); // 슬라이드 레이어(3: 상호작용 레이어) gameObject.layer = 3; - Log("Set slide layer: success"); + Log("Set slide layer success"); return res; } @@ -88,7 +88,7 @@ public override bool ResetAnomaly() // 슬라이드 레이어(0: 일반 레이어) gameObject.layer = 0; - Log("Reset slide layer: success"); + Log("Reset slide layer success"); // 슬라이드 화면 Log("Call `_script.ResetAsync` asynchronously"); diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1Manager.cs index a754c06..ae0139c 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1Manager.cs @@ -2,17 +2,6 @@ public class Anomaly1Manager : SCH_AnomalyManager { - /********** - * fields * - **********/ - - // 오브젝트 이름 - public string nameChair; - - // 프리팹 - public GameObject prefabGirl; - - // 가변 수치 public Vector3 positionChair; /************** @@ -22,34 +11,20 @@ public class Anomaly1Manager : SCH_AnomalyManager // 클래스 이름 public override string Name { get; } = "Anomaly1Manager"; - /************************************** - * implementation: SCH_AnomalyManager * - **************************************/ + /********************************* + * implementation: SCH_Behaviour * + *********************************/ - // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() + // `Awake` 메시지 용 메서드 + protected override bool Awake_() { - GameObject objectChair = GameObject.Find(nameChair); - bool res = base.SetAnomaly(); - - // 의자 - if (objectChair != null) { - objectChair.transform.position = positionChair; - Log("Set `objectChair`: success"); - } else { - Log("Set `objectChair`: failed", mode: 1); - res = false; - } - - // 여학생 - if (prefabGirl != null) { - SCH_AnomalyObject obj = Instantiate(prefabGirl).GetComponent(); + bool res = base.Awake_(); - obj.Manager = this; - objects.Add(obj); - Log("Set `prefabGirl`: success"); + Log("Call `StartAnomaly` begin"); + if (StartAnomaly()) { + Log("Call `StartAnomaly` success"); } else { - Log("Set `prefabGirl`: failed", mode: 1); + Log("Call `StartAnomaly` failed", mode: 1); res = false; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Chair.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Chair.cs new file mode 100644 index 0000000..5f16cd1 --- /dev/null +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Chair.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +public class Anomaly1_Chair : SCH_AnomalyObject +{ + /********** + * fields * + **********/ + + // 가변 수치 + public Vector3 position; + + /************** + * properties * + **************/ + + // 클래스 이름 + public override string Name { get; } = "Anomaly1_Chair"; + + /************************************* + * implementation: SCH_AnomalyObject * + *************************************/ + + // 이상현상을 시작하는 메서드 + public override bool StartAnomaly() + { + bool res = base.StartAnomaly(); + + transform.position = position; + Log("Set chair success"); + + return res; + } +} diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Chair.cs.meta b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Chair.cs.meta new file mode 100644 index 0000000..bd94a9c --- /dev/null +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Chair.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5dc5b8d84ca9e044194aa4abaf491948 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Girl.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Girl.cs index 045706a..7da141e 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Girl.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly1_Girl.cs @@ -22,9 +22,9 @@ public override bool ResetAnomaly() if (animator != null) { animator.SetBool("Sitting_b", true); - Log("Reset pose: success"); + Log("Reset pose success"); } else { - Log("Reset pose: failed", mode: 1); + Log("Reset pose failed", mode: 1); res = false; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20Manager.cs index 16d57a8..7618680 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20Manager.cs @@ -2,17 +2,6 @@ public class Anomaly20Manager : SCH_AnomalyManager { - /********** - * fields * - **********/ - - // 프리팹 - public GameObject prefabPlayer; - public GameObject[] prefabsInteractable; - - // 가변 수치 - public float duration; - /************** * properties * **************/ @@ -20,36 +9,23 @@ public class Anomaly20Manager : SCH_AnomalyManager // 클래스 이름 public override string Name { get; } = "Anomaly20Manager"; - /************************************** - * implementation: SCH_AnomalyManager * - **************************************/ + /********************************* + * implementation: SCH_Behaviour * + *********************************/ - // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() + // `Awake` 메시지 용 메서드 + protected override bool Awake_() { - bool res = base.SetAnomaly(); - - // 플레이어 - if (prefabPlayer != null) { - SCH_AnomalyObject obj = Instantiate(prefabPlayer).GetComponent(); + bool res = base.Awake_(); - obj.Manager = this; - objects.Add(obj); - Log("Set `prefabPlayer`: success"); + Log("Call `StartAnomaly` begin"); + if (StartAnomaly()) { + Log("Call `StartAnomaly` success"); } else { - Log("Set `prefabPlayer`: failed", mode: 1); + Log("Call `StartAnomaly` failed", mode: 1); res = false; } - // 상호작용용 오브젝트 - foreach (GameObject prefab in prefabsInteractable) { - SCH_AnomalyObject obj = Instantiate(prefab).GetComponent(); - - obj.Manager = this; - objects.Add(obj); - Log($"Set `{prefab.name}`: success"); - } - return res; } } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Interactable.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Interactable.cs index e0042fa..a9f6539 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Interactable.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Interactable.cs @@ -33,18 +33,18 @@ protected override bool InitFields() // objectPlayer objectPlayer = GameObject.Find(namePlayer); if (objectPlayer != null) { - Log("Initialize `objectPlayer`: success"); + Log("Initialize `objectPlayer` success"); } else { - Log("Initialize `objectPlayer`: failed", mode: 1); + Log("Initialize `objectPlayer` failed", mode: 1); res = false; } // objectBoard objectBoard = GameObject.Find(nameBoard); if (objectBoard != null) { - Log("Initialize `objectBoard`: success"); + Log("Initialize `objectBoard` success"); } else { - Log("Initialize `objectBoard`: failed", mode: 1); + Log("Initialize `objectBoard` failed", mode: 1); res = false; } @@ -61,7 +61,7 @@ public override bool ResetAnomaly() bool res = base.ResetAnomaly(); Destroy(gameObject); - Log("Destroy game object: success"); + Log("Destroy game object success"); return res; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableBack.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableBack.cs index 2b03135..05b8603 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableBack.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableBack.cs @@ -47,7 +47,7 @@ protected override bool InitFields() // _x _x = objectBoard.transform.position.x + 0.01f; - Log("Initialize `_x`: success"); + Log("Initialize `_x` success"); return res; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableFront.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableFront.cs index ca6262e..388cd26 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableFront.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableFront.cs @@ -47,7 +47,7 @@ protected override bool InitFields() // _x _x = objectBoard.transform.position.x - 0.01f; - Log("Initialize `_x`: success"); + Log("Initialize `_x` success"); return res; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableRight.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableRight.cs index 5ca69ce..93208f1 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableRight.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_InteractableRight.cs @@ -49,7 +49,7 @@ protected override bool InitFields() // _z _z = objectBoard.transform.position.z + 0.01f; - Log("Initialize `_z`: success"); + Log("Initialize `_z` success"); return res; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Player.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Player.cs index c8e4b07..1c07ebb 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Player.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly20_Player.cs @@ -48,9 +48,9 @@ protected override bool InitFields() // _objectPlayer _objectPlayer = GameObject.Find(namePlayer); if (_objectPlayer != null) { - Log("Initialize `_objectPlayer`: success"); + Log("Initialize `_objectPlayer` success"); } else { - Log("Initialize `_objectPlayer`: failed", mode: 1); + Log("Initialize `_objectPlayer` failed", mode: 1); res = false; } @@ -72,9 +72,9 @@ public override bool ResetAnomaly() return res; } - /*********** - * methods * - ***********/ + /*************** + * new methods * + ***************/ // 지속시간 동안 투명해지다가 사라지는 메서드 private IEnumerator FadeAsync() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Manager.cs index 7ed8764..1d10be3 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23Manager.cs @@ -2,19 +2,6 @@ public class Anomaly23Manager : SCH_AnomalyManager { - /********** - * fields * - **********/ - - // 오브젝트 이름 - public string nameLaptop; - - // 프리팹 - public GameObject prefabGhost; - - // 오브젝트 - private SCH_AnomalyObject _objectLaptop; - /************** * properties * **************/ @@ -26,52 +13,16 @@ public class Anomaly23Manager : SCH_AnomalyManager * implementation: SCH_Behaviour * *********************************/ - // 필드를 초기화하는 메서드 - protected override bool InitFields() + // `Awake` 메시지 용 메서드 + protected override bool Awake_() { - bool res = base.InitFields(); - - // _objectLaptop - _objectLaptop = GameObject.Find(nameLaptop).GetComponent(); - if (_objectLaptop != null) { - objects.Add(_objectLaptop); - Log("Initialize `_objectLaptop`: success"); - } else { - Log("Initialize `_objectLaptop`: failed", mode: 1); - res = false; - } - - return res; - } - - /************************************** - * implementation: SCH_AnomalyManager * - **************************************/ - - // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() - { - bool res = base.SetAnomaly(); - - // 노트북 - if (_objectLaptop != null) { - _objectLaptop.enabled = true; - _objectLaptop.Manager = this; - Log("Set `_objectLaptop`: success"); - } else { - Log("Set `_objectLaptop`: failed", mode: 1); - res = false; - } - - // 유령 - if (prefabGhost != null) { - SCH_AnomalyObject obj = Instantiate(prefabGhost).GetComponent(); + bool res = base.Awake_(); - obj.Manager = this; - objects.Add(obj); - Log("Set `prefabGhost`: success"); + Log("Call `StartAnomaly` begin"); + if (StartAnomaly()) { + Log("Call `StartAnomaly` success"); } else { - Log("Set `prefabGhost`: failed", mode: 1); + Log("Call `StartAnomaly` failed", mode: 1); res = false; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Ghost.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Ghost.cs index b47c367..e06819f 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Ghost.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Ghost.cs @@ -63,7 +63,7 @@ void OnCollisionEnter(Collision other) Log("Call `FadeAudioAsync` asynchronously"); StartCoroutine(FadeAudioAsync()); } else { - Log("Call `script.GameOver`: failed", mode: 1); + Log("Call `script.GameOver` failed", mode: 1); } } } @@ -105,50 +105,50 @@ protected override bool InitFields() // _animator _animator = GetComponent(); if (_animator != null) { - Log("Initialize `_animator`: success"); + Log("Initialize `_animator` success"); } else { - Log("Initialize `_animator`: failed", mode: 1); + Log("Initialize `_animator` failed", mode: 1); res = false; } // _audioSource _audioSource = GetComponent(); if (_audioSource != null) { - Log("Initialize `_audioSource`: success"); + Log("Initialize `_audioSource` success"); } else { - Log("Initialize `_audioSource`: failed", mode: 1); + Log("Initialize `_audioSource` failed", mode: 1); res = false; } // _objectPlayer _objectPlayer = GameObject.Find(namePlayer); if (_objectPlayer != null) { - Log("Initialize `_objectPlayer`: success"); + Log("Initialize `_objectPlayer` success"); } else { - Log("Initialize `_objectPlayer`: failed", mode: 1); + Log("Initialize `_objectPlayer` failed", mode: 1); res = false; } // _objectCamera _objectCamera = GameObject.Find(nameCamera); if (_objectCamera != null) { - Log("Initialize `_objectCamera`: success"); + Log("Initialize `_objectCamera` success"); } else { - Log("Initialize `_objectCamera`: failed", mode: 1); + Log("Initialize `_objectCamera` failed", mode: 1); res = false; } // _timeStart _timeStart = Time.time; - Log($"Initialize `_timeStart`: success: {_timeStart}"); + Log($"Initialize `_timeStart` success: {_timeStart}"); // _isChasing _isChasing = true; - Log("Initialize `_isChasing`: success"); + Log("Initialize `_isChasing` success"); // _isCatched _isCatched = false; - Log("Initialize `_isChasing`: success"); + Log("Initialize `_isChasing` success"); return res; } @@ -158,12 +158,12 @@ protected override bool InitFields() *************************************/ // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() + public override bool StartAnomaly() { - bool res = base.SetAnomaly(); + bool res = base.StartAnomaly(); transform.position = position; - Log("Set position: success"); + Log("Set position success"); Log("Call `StartAudioAsync` asynchronously"); StartCoroutine(StartAudioAsync()); @@ -177,7 +177,7 @@ public override bool ResetAnomaly() bool res = base.ResetAnomaly(); _audioSource.enabled = false; - Log("Reset audio source: success"); + Log("Reset audio source success"); Log("Call `BlowAsync` asynchronously"); StartCoroutine(BlowAsync()); @@ -185,9 +185,9 @@ public override bool ResetAnomaly() return res; } - /*********** - * methods * - ***********/ + /*************** + * new methods * + ***************/ // 시작하고 일정 시간 후 오디오 소스를 시작하는 메서드 private IEnumerator StartAudioAsync() diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Laptop.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Laptop.cs index b8c4588..f47a228 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Laptop.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly23_Laptop.cs @@ -48,15 +48,15 @@ protected override bool InitFields() // _script _script = GetComponent(); if (_script != null) { - Log("Initialize `_script`: success"); + Log("Initialize `_script` success"); } else { - Log("Initialize `_script`: failed", mode: 1); + Log("Initialize `_script` failed", mode: 1); res = false; } // _index _index = 0; - Log("Initialize `_index`: success"); + Log("Initialize `_index` success"); return res; } @@ -66,17 +66,17 @@ protected override bool InitFields() *************************************/ // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() + public override bool StartAnomaly() { - bool res = base.SetAnomaly(); + bool res = base.StartAnomaly(); // 노트북 화면 if (_script != null) { _index = _script.Index; _script.ChangeScreen(anomalyScreenIndex); - Log("Set laptop screen: success"); + Log("Set laptop screen success"); } else { - Log("Set laptop screen: failed", mode: 1); + Log("Set laptop screen failed", mode: 1); res = false; } @@ -91,9 +91,9 @@ public override bool ResetAnomaly() // 노트북 화면 if (_script != null) { _script.ChangeScreen(_index); - Log("Reset laptop screen: success"); + Log("Reset laptop screen success"); } else { - Log("Reset laptop screen: failed", mode: 1); + Log("Reset laptop screen failed", mode: 1); res = false; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2Manager.cs index fc21d6a..f84754e 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2Manager.cs @@ -2,16 +2,6 @@ public class Anomaly2Manager : SCH_AnomalyManager { - /********** - * fields * - **********/ - - // 오브젝트 이름 - public string nameLaptop; - - // 오브젝트 - private SCH_AnomalyObject _objectLaptop; - /************** * properties * **************/ @@ -23,40 +13,16 @@ public class Anomaly2Manager : SCH_AnomalyManager * implementation: SCH_Behaviour * *********************************/ - // 필드를 초기화하는 메서드 - protected override bool InitFields() - { - bool res = base.InitFields(); - - // _objectLaptop - _objectLaptop = GameObject.Find(nameLaptop).GetComponent(); - if (_objectLaptop != null) { - objects.Add(_objectLaptop); - Log("Initialize `_objectLaptop`: success"); - } else { - Log("Initialize `_objectLaptop`: failed", mode: 1); - res = false; - } - - return res; - } - - /************************************** - * implementation: SCH_AnomalyManager * - **************************************/ - - // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() + // `Awake` 메시지 용 메서드 + protected override bool Awake_() { - bool res = base.SetAnomaly(); + bool res = base.Awake_(); - // 노트북 화면 - if (_objectLaptop != null) { - _objectLaptop.enabled = true; - _objectLaptop.Manager = this; - Log("Set `_objectLaptop`: success"); + Log("Call `StartAnomaly` begin"); + if (StartAnomaly()) { + Log("Call `StartAnomaly` success"); } else { - Log("Set `_objectLaptop`: failed", mode: 1); + Log("Call `StartAnomaly` failed", mode: 1); res = false; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2_Laptop.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2_Laptop.cs index 38ffa4a..cc8dff5 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2_Laptop.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly2_Laptop.cs @@ -32,9 +32,9 @@ protected override bool InitFields() // _script _script = GetComponent(); if (_script != null) { - Log("Initialize `_script`: success"); + Log("Initialize `_script` success"); } else { - Log("Initialize `_script`: failed", mode: 1); + Log("Initialize `_script` failed", mode: 1); res = false; } @@ -46,22 +46,22 @@ protected override bool InitFields() *************************************/ // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() + public override bool StartAnomaly() { - bool res = base.SetAnomaly(); + bool res = base.StartAnomaly(); // 노트북 화면 if (_script != null) { _script.StartGazing(); - Log("Set laptop screen: success"); + Log("Set laptop screen success"); } else { - Log("Set laptop screen: failed", mode: 1); + Log("Set laptop screen failed", mode: 1); res = false; } // 노트북 레이어(3: 상호작용 레이어) gameObject.layer = 3; - Log("Set laptop layer: success"); + Log("Set laptop layer success"); return res; } @@ -72,12 +72,12 @@ public override bool ResetAnomaly() bool res = base.ResetAnomaly(); // 노트북 화면 - Log("Call `_script.ResetAsync` asynchronously"); + Log($"Call `{_script.Name}.ResetAsync` asynchronously"); StartCoroutine(_script.ResetAsync(duration)); // 노트북 레이어(0: 일반 레이어) gameObject.layer = 0; - Log("Reset laptop layer: success"); + Log("Reset laptop layer success"); // 실행 종료 enabled = false; diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6Manager.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6Manager.cs index 5bc298f..373a0f0 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6Manager.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6Manager.cs @@ -2,13 +2,6 @@ public class Anomaly6Manager : SCH_AnomalyManager { - /********** - * fields * - **********/ - - // 프리팹 - public GameObject prefabCake; - /************** * properties * **************/ @@ -16,24 +9,20 @@ public class Anomaly6Manager : SCH_AnomalyManager // 클래스 이름 public override string Name { get; } = "Anomaly6Manager"; - /************************************** - * implementation: SCH_AnomalyManager * - **************************************/ + /********************************* + * implementation: SCH_Behaviour * + *********************************/ - // 이상현상을 시작하는 메서드 - protected override bool SetAnomaly() + // `Awake` 메시지 용 메서드 + protected override bool Awake_() { - bool res = base.SetAnomaly(); - - // 케이크 - if (prefabCake != null) { - SCH_AnomalyObject obj = Instantiate(prefabCake).GetComponent(); + bool res = base.Awake_(); - obj.Manager = this; - objects.Add(obj); - Log("Set `prefabCake`: success"); + Log("Call `StartAnomaly` begin"); + if (StartAnomaly()) { + Log("Call `StartAnomaly` success"); } else { - Log("Set `prefabCake`: failed", mode: 1); + Log("Call `StartAnomaly` failed", mode: 1); res = false; } diff --git a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6_Cake.cs b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6_Cake.cs index f31239b..2b32d19 100644 --- a/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6_Cake.cs +++ b/302/Assets/Scripts/SpecificAnomalyManager/Anomaly6_Cake.cs @@ -31,9 +31,9 @@ public override bool ResetAnomaly() return res; } - /*********** - * methods * - ***********/ + /*************** + * new methods * + ***************/ // 지속시간 동안 투명해지다가 사라지는 메서드 private IEnumerator FadeAsync()