Re: How can i add my logic when game end
The event system could prove useful to suit your score needs.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
private void OnEnable()
{
UFE.OnRoundEnds += OnRoundEnds;
UFE.OnGameEnds += OnGameEnds;
}
private void OnDisable()
{
UFE.OnRoundEnds -= OnRoundEnds;
UFE.OnGameEnds -= OnGameEnds;
}
private void OnRoundEnds(ControlsScript winner, ControlsScript loser)
{
if (winner != null)
{
// Score logic
}
}
private void OnGameEnds(ControlsScript winner, ControlsScript loser)
{
if (winner != null)
{
// Score logic
}
}
}