Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anomaly27 start time delayed #162

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4ff09b028cdd2394e82a6885f68c804d, type: 3}
m_Name:
m_EditorClassIdentifier:
scaleIncreaseRate: -10
scaleIncreaseRate: -100
scaleStartDelay: 5
--- !u!65 &-88205578807635617
BoxCollider:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
public class Anomaly27_magnifyingclock : MonoBehaviour
{
[SerializeField] private float scaleIncreaseRate = 0.1f; // 초당 증가할 스케일 크기
[SerializeField] private float scaleStartDelay = 5f; // 스케일 증가 시작 딜레이
private bool isScaling = false; // 스케일 증가 여부
private bool isStageClear = true;
private Collider objectCollider;

Expand All @@ -13,13 +15,25 @@ void Start()
isStageClear = true;
objectCollider = GetComponent<Collider>();
objectCollider.isTrigger = false; // Trigger 대신 물리 충돌로 처리

// 5초 후 스케일 증가 시작
Invoke(nameof(StartScaling), scaleStartDelay);
}

void Update()
{
// 시간에 따라 점점 오브젝트와 콜라이더의 스케일을 증가
float scaleIncrease = scaleIncreaseRate * Time.deltaTime;
transform.localScale += new Vector3(scaleIncrease, scaleIncrease, scaleIncrease);
if (isScaling)
{
// 시간에 따라 점점 오브젝트와 콜라이더의 스케일을 증가
float scaleIncrease = scaleIncreaseRate * Time.deltaTime;
transform.localScale += new Vector3(scaleIncrease, scaleIncrease, scaleIncrease);
}
}

private void StartScaling()
{
isScaling = true;
Debug.Log("MagnifyingClock: Scaling has started after delay.");
}

private void OnCollisionEnter(Collision collision)
Expand Down