Skip to content

Commit

Permalink
Merge pull request #158 from 2024FALL-SWPP/chaehwan/codeCleaning
Browse files Browse the repository at this point in the history
Chaehwan/code cleaning
  • Loading branch information
Prown0 authored Nov 26, 2024
2 parents dc3c1d7 + 8d84a85 commit d47eadd
Show file tree
Hide file tree
Showing 34 changed files with 917 additions and 1,121 deletions.
3 changes: 1 addition & 2 deletions 302/Assets/Prefabs/Anomaly01/sittingGirl.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -881,9 +881,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 13b29b2cac673a5419b45e5853d126ec, type: 3}
m_Name:
m_EditorClassIdentifier:
nameCameraMain: Main Camera
prompt:
distanceInteractionMax: 2
distanceInteractionMax: 4
--- !u!1 &3815843599304427073
GameObject:
m_ObjectHideFlags: 0
Expand Down
4 changes: 2 additions & 2 deletions 302/Assets/Prefabs/Anomaly20/Anomaly20InteractableBack.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e3abf5127f1fd514eafeb2411741d79a, type: 3}
m_Name:
m_EditorClassIdentifier:
promptMessage: "\uD074\uB9AD\uD558\uC5EC \uC0C1\uD638\uC791\uC6A9"
interactionRange: 1
prompt:
distanceInteractionMax: 1.8
namePlayer: Player
nameBoard: BoardBack
zMin: -15.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fa6dee73251e9a04e8d20560af1f1997, type: 3}
m_Name:
m_EditorClassIdentifier:
promptMessage: "\uD074\uB9AD\uD558\uC5EC \uC0C1\uD638\uC791\uC6A9"
interactionRange: 1
prompt:
distanceInteractionMax: 1.8
namePlayer: Player
nameBoard: BoardFront
zMin: -11.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5c14879ba6f660e4196accbcc95dfe7a, type: 3}
m_Name:
m_EditorClassIdentifier:
promptMessage: "\uD074\uB9AD\uD558\uC5EC \uC0C1\uD638\uC791\uC6A9"
interactionRange: 1
prompt:
distanceInteractionMax: 1.8
namePlayer: Player
nameBoard: BoardRight (1)
x1Min: -25.2
Expand Down
1 change: 1 addition & 0 deletions 302/Assets/Prefabs/Anomaly20/PlayerAnomaly.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
namePlayer: Player
duration: 2
--- !u!1 &3565635857044313825
GameObject:
m_ObjectHideFlags: 0
Expand Down
6 changes: 3 additions & 3 deletions 302/Assets/Prefabs/Anomaly23/ghost.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -773,9 +773,9 @@ MonoBehaviour:
namePlayer: Player
nameCamera: Main Camera
position: {x: 24, y: 2, z: 0}
speedInit: 2
speedDelta: 4
durationChase: 20
speedInit: 1
speedDelta: 5
durationChase: 25
durationFade: 5
--- !u!1 &6612614341887459618
GameObject:
Expand Down
25 changes: 21 additions & 4 deletions 302/Assets/Scenes/DefaultGameScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -4919,6 +4919,24 @@ Transform:
m_CorrespondingSourceObject: {fileID: 1809372938388778512, guid: 474138867ca9be144953fa0ca636b7c9, type: 3}
m_PrefabInstance: {fileID: 241118524}
m_PrefabAsset: {fileID: 0}
--- !u!1 &243047807 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6482429499626390066, guid: e98bfaaf0938845d098edce033f7e7a2, type: 3}
m_PrefabInstance: {fileID: 2208074503459508080}
m_PrefabAsset: {fileID: 0}
--- !u!114 &243047810
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 243047807}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d755543348868a045964c1da73713696, type: 3}
m_Name:
m_EditorClassIdentifier:
anomalyScreenIndex: 12
--- !u!1001 &245510671
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -22951,9 +22969,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2960778f4e9343349a587d3d39be1a05, type: 3}
m_Name:
m_EditorClassIdentifier:
promptMessage: "\uD074\uB9AD\uD558\uC5EC \uC0C1\uD638\uC791\uC6A9"
interactionRange: 2
nameCamera: Main Camera
prompt:
distanceInteractionMax: 0
objectCamera: {fileID: 0}
thresholdDistance: 10
--- !u!1001 &1027390622
PrefabInstance:
Expand Down Expand Up @@ -40988,7 +41006,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 18e2c46eaa68afe458ec364512f84534, type: 3}
m_Name:
m_EditorClassIdentifier:
nameCameraMain: Main Camera
prompt:
distanceInteractionMax: 5
--- !u!65 &1875637180
Expand Down
63 changes: 46 additions & 17 deletions 302/Assets/Scripts/LaptopFaceController.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LaptopFaceController : LaptopScreenController
{
/**********
* fields *
**********/

public GameObject player;
/*************
* constants *
*************/

private int[] X0DATA = new int[] {
394, 391, 389, 387, 386, 385, 384, 383, 382, 381, 380, 379, 379, 378, 378, 377, 377,
Expand Down Expand Up @@ -36,6 +32,14 @@ public class LaptopFaceController : LaptopScreenController
306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322
};

/**********
* fields *
**********/

// 오브젝트
public GameObject player;

// 내부 수치
private int TANGENT_MAX = 25;
private float TANGENT_CONST = 12.5f;
private int ORIGIN_X = 38;
Expand All @@ -45,18 +49,14 @@ public class LaptopFaceController : LaptopScreenController
private bool _isGazing;
private int _tangent;

/**********************
* overridden methods *
**********************/
/************
* messages *
************/

// Start is called on the frame when a script is enabled just
// before any of the Update methods are called the first time.
void Start()
{
_colour = defaults[0].GetPixel(407, 297);
_isGazing = false;
_tangent = 0;

ResetScreen();
}

Expand All @@ -68,9 +68,34 @@ void Update()
}
}

/***************
* new methods *
***************/
/*********************************
* implementation: SCH_Behaviour *
*********************************/

// 필드를 초기화하는 메서드
protected override bool InitFields()
{
bool res = base.InitFields();

// _colour
_colour = defaults[0].GetPixel(407, 297);
Log("Initialize `_colour`: success: "
+ $"Color({_colour.r}, {_colour.g}, {_colour.b}, {_colour.a})");

// _isGazing
_isGazing = false;
Log("Initialize `_isGazing`: success");

// _tangent
_tangent = 0;
Log("Initialize `_tangent`: success");

return res;
}

/******************************************
* implementation: LaptopScreenController *
******************************************/

// 화면을 초기화하는 메서드
public override void ResetScreen()
Expand All @@ -95,6 +120,10 @@ public override void ResetScreen()
screen.Apply();
}

/***********
* methods *
***********/

// 쳐다보기 시작하는 메서드
public void StartGazing()
{
Expand Down
25 changes: 13 additions & 12 deletions 302/Assets/Scripts/LaptopScreenController.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LaptopScreenController : MonoBehaviour
public class LaptopScreenController : SCH_Behaviour
{
/**********
* fields *
**********/

// 텍스처
public Texture2D screen;
public Texture2D[] defaults;

// 가변 수치
public int screenXMin;
public int screenXMax;
public int screenYMin;
Expand All @@ -21,12 +21,13 @@ public class LaptopScreenController : MonoBehaviour
public int defaultYMin;
public int defaultYMax;

public bool isFlipped;

/**************
* properties *
**************/

// 클래스 이름
public override string Name { get; } = "LaptopScreenController";

private int _index = 0;
public int Index {
get => _index;
Expand All @@ -39,9 +40,9 @@ public int Index {
}
}

/**********************
* overridden methods *
**********************/
/************
* messages *
************/

// Start is called on the frame when a script is enabled just
// before any of the Update methods are called the first time.
Expand All @@ -50,9 +51,9 @@ void Start()
ResetScreen();
}

/***************
* new methods *
***************/
/***********
* methods *
***********/

public virtual void ResetScreen()
{
Expand All @@ -79,4 +80,4 @@ public void ChangeScreen(int index)
Index = index;
ResetScreen();
}
}
}
27 changes: 6 additions & 21 deletions 302/Assets/Scripts/SCH_AnomalyInteractable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ public class SCH_AnomalyInteractable : SCH_AnomalyObject, IInteractable
* fields *
**********/

// 오브젝트 이름
public string nameCameraMain;

// 가변 수치
public string prompt;
public float distanceInteractionMax;

// 오브젝트
protected GameObject _objectCameraMain;

// 기타 수치
protected bool _canInteract;
protected bool canInteract;

/**************
* properties *
Expand Down Expand Up @@ -50,13 +44,13 @@ public void OnInteract()
Log("Call `Manager.InteractionSuccess`: failed", mode: 1);
}

_canInteract = false;
canInteract = false;
}

// 현재 상호작용 가능한지 여부 반환
public bool CanInteract(float distance)
{
return _canInteract && distance <= distanceInteractionMax;
return canInteract && distance <= distanceInteractionMax;
}

/*********************************
Expand All @@ -68,18 +62,9 @@ protected override bool InitFields()
{
bool res = base.InitFields();

// _objectCameraMain
_objectCameraMain = GameObject.Find(nameCameraMain);
if (_objectCameraMain != null) {
Log("Initialize `_objectCameraMain`: success");
} else {
Log("Initialize `_objectCameraMain`: failed", mode: 1);
res = false;
}

// _canInteract
_canInteract = true;
Log("Initialize `_canInteract`: success");
// canInteract
canInteract = true;
Log("Initialize `canInteract`: success");

return res;
}
Expand Down
Loading

0 comments on commit d47eadd

Please sign in to comment.