Skip to content

Commit

Permalink
Code Cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Prown0 committed Dec 2, 2024
1 parent 9ead406 commit e005d52
Show file tree
Hide file tree
Showing 39 changed files with 389 additions and 497 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ac9ccff8bcade466eaa77e3dfd322477, type: 3}
m_Name:
m_EditorClassIdentifier:
nameGameManager: GameManager
names:
- SlideRight
prefabs: []
nameSlide: SlideRight
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 71a8eeeaaa8fe4e91b0707e40548c7dc, type: 3}
m_Name:
m_EditorClassIdentifier:
nameGameManager: GameManager
names:
- LaptopFace
prefabs: []
nameLaptop: LaptopFace
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
4 changes: 2 additions & 2 deletions 302/Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private void Start()

// Added by 신 채 환
// 슬라이드 초기화
SlideManager.Instance.InitSlideList();
SlideManager.Instance.GenerateSlideList();
StartCoroutine(InitializeSlideAfterLoad());
}
private void InitializeGame()
Expand Down Expand Up @@ -93,7 +93,7 @@ public void Sleep()

// Added by 신 채 환
// 슬라이드 색인 배열 재생성
SlideManager.Instance.InitSlideList();
SlideManager.Instance.GenerateSlideList();
}
currentStageClear = false; // 클리어 상태 초기화
LoadDefaultScene();
Expand Down
6 changes: 3 additions & 3 deletions 302/Assets/Scripts/LaptopFaceController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 8 additions & 6 deletions 302/Assets/Scripts/LaptopScreenController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/***********
Expand Down
22 changes: 16 additions & 6 deletions 302/Assets/Scripts/SCH_AnomalyInteractable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class SCH_AnomalyInteractable : SCH_AnomalyObject, IInteractable
public string prompt;
public float distanceInteractionMax;

// 기타 수치
// 내부 수치
protected bool canInteract;

/**************
Expand All @@ -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;
Expand All @@ -60,11 +60,21 @@ public bool CanInteract(float distance)
// 필드를 초기화하는 메서드
protected override bool InitFields()
{
Collider collider = GetComponent<Collider>();
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;
}
Expand Down
100 changes: 91 additions & 9 deletions 302/Assets/Scripts/SCH_AnomalyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ public class SCH_AnomalyManager : SCH_AnomalyObject
* fields *
**********/

// 오브젝트 이름 배열
public string[] names;

// 프리팹 배열
public GameObject[] prefabs;

// 이상현상 오브젝트 리스트
protected List<SCH_AnomalyObject> objects;

Expand All @@ -28,11 +34,11 @@ protected override bool InitFields()

// Manager
Manager = this;
Log("Initialize `Manager`: success");
Log("Initialize `Manager` success");

// objects
objects = new List<SCH_AnomalyObject>();
Log("Initialize `objects`: success");
Log("Initialize `objects` success");

return res;
}
Expand All @@ -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;
}
}
Expand All @@ -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<SCH_AnomalyObject>();

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<SCH_AnomalyObject>();

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;
}
}
Loading

0 comments on commit e005d52

Please sign in to comment.