Skip to content

Commit

Permalink
이상현상 15 AbstractAnomalyObject 상속으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
seozzi committed Dec 11, 2024
1 parent 3cd2c96 commit ecaca48
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,55 @@
using UnityEngine;
using System.Collections;

public class Anomaly15Manager : MonoBehaviour

public class Anomaly15Controller : AbstractAnomalyObject
{
public override string Name { get; } = "Anomaly15Controller";

[Header("Spider Settings")]
public GameObject spiderPrefab;
private float spawnRadius = 0.5f;
private float spawnInterval = 0.3f;
private float moveSpeed = 1f;
private float fadeDistance = 2f;
private Vector3 basePosition = new Vector3(6.9f, 7.7f, -7.1f);

public bool isSpawningSpiders = true;
private GameObject interactionCube;
[Header("Audio Settings")]
public AudioClip spiderSoundClip;

private void Start()
public override bool StartAnomaly()
{
bool res = base.StartAnomaly();

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

// 거미 생성
isSpawningSpiders = true;
StartCoroutine(SpawnSpiderRoutine());

return res;
}

private void OnEnable()
// 이상현상을 초기화하는 메서드
public override bool ResetAnomaly()
{
isSpawningSpiders = true;
bool res = base.ResetAnomaly();

StopSpawning();

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

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

public void StopSpawning()
Expand Down
6 changes: 3 additions & 3 deletions 302/Assets/Scripts/SpecificAnomalyManager/Anomaly15_spider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ public class Anomaly15_spider : InteractableObject, IInteractable
[Header("Interaction Settings")]

private bool hasInteracted = false;
private Anomaly15Manager anomalyManager;
private Anomaly15Controller anomalyManager;
[Header("Audio Settings")]
public AudioClip spiderSoundClip;
private Transform cameraTransform;
private AudioSource audioSource;

private void Start()
{
anomalyManager = FindObjectOfType<Anomaly15Manager>();
anomalyManager = FindObjectOfType<Anomaly15Controller>();
GameObject mainCamera = GameObject.FindWithTag("MainCamera");

audioSource = gameObject.AddComponent<AudioSource>();
Expand Down Expand Up @@ -50,7 +50,7 @@ public void OnInteract()

hasInteracted = true;

// Call StopSpawning on Anomaly15Manager and start the delayed destroy
// Call StopSpawning on Anomaly15Controller and start the delayed destroy
if (anomalyManager != null)
{
anomalyManager.StopSpawning();
Expand Down

0 comments on commit ecaca48

Please sign in to comment.