You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

54 lines
1.3 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class GameModeEvents : MonoBehaviour
{
[Header("Reference")]
[SerializeField]
private GameModeReference Reference;
[Header("Events")]
public UnityEvent OnRoundStart = new UnityEvent();
public UnityEvent OnPlayersMoved = new UnityEvent();
public UnityEvent OnRoundEnd = new UnityEvent();
public UnityEvent OnGameOver = new UnityEvent();
private void OnEnable()
{
Reference.Value.RoundStartEvent += RoundStart;
Reference.Value.AllPlayersMovedEvent += PlayersMoved;
Reference.Value.RoundEndEvent += RoundEnd;
Reference.Value.OnGameOverEvent += GameOver;
}
private void OnDisable()
{
Reference.Value.RoundStartEvent -= RoundStart;
Reference.Value.AllPlayersMovedEvent -= PlayersMoved;
Reference.Value.RoundEndEvent -= RoundEnd;
Reference.Value.OnGameOverEvent -= GameOver;
}
private void RoundStart()
{
OnRoundStart.Invoke();
}
private void PlayersMoved()
{
OnPlayersMoved.Invoke();
}
private void RoundEnd()
{
OnRoundEnd.Invoke();
}
private void GameOver()
{
OnGameOver.Invoke();
}
}