using Photon.Pun;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "GameEvent_PhotonView", menuName = "Wavefunction/Event/New GameEvent PhotonView", order = 1)]
public class GameEvent_PhotonView : ScriptableObject
{
    private List<GameEventListener_PhotonView> listeners = new List<GameEventListener_PhotonView>();

    public void Raise(PhotonView photonView)
    {
        for (int i = listeners.Count - 1; i >= 0; i--)
        {
            listeners[i].OnEventRaised(photonView);
        }
    }

    public void RegisterListener(GameEventListener_PhotonView listener)
    {
        listeners.Add(listener);
    }

    public void UnRegisterListener(GameEventListener_PhotonView listener)
    {
        listeners.Remove(listener);
    }
}
