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

이상현상 15 refactoring 후 정상 작동하게 수정 #199

Merged
merged 1 commit into from
Dec 14, 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 @@ -42,14 +42,10 @@ public override bool ResetAnomaly()

return res;
}

private void Start()
{
// 상호작용할 수 있는 투명한 큐브
interactionCube = CreateInteractionCube();
StartCoroutine(SetTransparency(interactionCube));

// 거미 생성
StartCoroutine(SpawnSpiderRoutine());
StartAnomaly();
}

public void StopSpawning()
Expand Down
27 changes: 19 additions & 8 deletions 302/Assets/Scripts/SpecificAnomalyManager/Anomaly15_spider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ public class Anomaly15_spider : AbstractAnomalyInteractable
private Transform cameraTransform;
private AudioSource audioSource;

private void Start()
{
StartAnomaly();
}

public override bool StartAnomaly()
{
bool res = base.StartAnomaly();
Expand All @@ -22,7 +27,10 @@ public override bool StartAnomaly()
audioSource = gameObject.AddComponent<AudioSource>();
audioSource.clip = spiderSoundClip;
audioSource.loop = true;
audioSource.spatialBlend = 2f; // 3D 음향으로 설정
audioSource.spatialBlend = 1.0f; // 3D 음향으로 설정
audioSource.minDistance = 1.0f;
audioSource.maxDistance = 10.0f;

audioSource.Play();

return res;
Expand All @@ -34,26 +42,29 @@ public override bool ResetAnomaly()
bool res = base.ResetAnomaly();

audioSource.Stop();
if (anomalyManager != null)
{
anomalyManager.StopSpawning();
}

StartCoroutine(DelayedDestroy());

return res;
}

public override virtual OnInteract()
public override void OnInteract()
{
base.OnInteract();
GameManager.Instance.SetStageClear();

ResetAnomaly();
anomalyManager.ResetAnomaly();
}

public override bool CanInteract(float distance)
{
if (distance < 5.0f) return true;
else return false;
}

private IEnumerator DelayedDestroy()
{
yield return new WaitForSeconds(2f); // Wait for 2 seconds
Destroy(gameObject); // Destroy this spider object
GameManager.Instance.SetStageClear(); // Mark the stage as clear
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public override bool StartAnomaly()

// Start the drawing coroutine with a delay
StartCoroutine(StartDrawingWithDelay());

return true;
}

public override bool ResetAnomaly()
Expand All @@ -71,9 +73,10 @@ public override bool ResetAnomaly()
anomalyManager.DestroyMarkerLineWithSound();
audioSource.Stop();
}
return true;
}

public override virtual OnInteract()
public override void OnInteract()
{
base.OnInteract();
GameManager.Instance.SetStageClear();
Expand Down
Loading