Skip to content
Snippets Groups Projects
ArrowDespawner.cs 527 B
Newer Older
using UnityEngine;

// Removes all active Arrows from the play field at round end.
public class ArrowDespawner : MonoBehaviour, IRoundCallback
{
    void Start()
    {
        RoundController.instance.roundCallbacks.Add(this);
    }

    public void OnRoundEnd(bool won)
    {
        ArrowController[] arrows = FindObjectsOfType<ArrowController>();
        foreach (ArrowController arrow in arrows)
        {
            Destroy(arrow.gameObject);
        }
    }

    public void OnRoundStart()
    {