Skip to content

Commit

Permalink
이상현상 15 refactoring 후 정상 작동하게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
seozzi committed Dec 14, 2024
1 parent cb3e813 commit ea81d7b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
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

0 comments on commit ea81d7b

Please sign in to comment.