Fixes? and side channels.
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Statistics;
|
||||
using UnityEngine;
|
||||
|
||||
internal class Log
|
||||
public class Log
|
||||
{
|
||||
public int damageTakenByDefs = 0;
|
||||
public int damageTakenByAtc = 0;
|
||||
@ -13,7 +15,8 @@ internal class Log
|
||||
|
||||
public class StatisticManager : MonoBehaviour
|
||||
{
|
||||
private Log log = new Log();
|
||||
private Log _log = new Log();
|
||||
private LoggerSideChannel _myLoggerSideChannel;
|
||||
private void Awake()
|
||||
{
|
||||
foreach (var npc in GameObject.FindObjectsOfType<NPC>())
|
||||
@ -21,31 +24,32 @@ public class StatisticManager : MonoBehaviour
|
||||
|
||||
GlobalEventManager.OnCaptureFlag += RegisterWin;
|
||||
GlobalEventManager.OnTimeLeft += RegisterTimeOut;
|
||||
GameManager.OnResetScene += SendMessage;
|
||||
}
|
||||
|
||||
private void RegisterDamage(int damage, Team team)
|
||||
{
|
||||
if (team == Team.Attackers)
|
||||
log.damageTakenByAtc += damage;
|
||||
_log.damageTakenByAtc += damage;
|
||||
else
|
||||
log.damageTakenByDefs += damage;
|
||||
_log.damageTakenByDefs += damage;
|
||||
}
|
||||
|
||||
private void RegisterWin(Team team)
|
||||
{
|
||||
if (team == Team.Attackers)
|
||||
log.AtcWin += 1;
|
||||
_log.AtcWin += 1;
|
||||
else
|
||||
log.DefWin += 1;
|
||||
_log.DefWin += 1;
|
||||
}
|
||||
|
||||
private void RegisterTimeOut()
|
||||
{
|
||||
log.TimeOuts += 1;
|
||||
_log.TimeOuts += 1;
|
||||
}
|
||||
|
||||
private void OnApplicationQuit()
|
||||
private void SendMessage()
|
||||
{
|
||||
Logger.SaveLog<Log>(log);
|
||||
_myLoggerSideChannel.SendLog(_log);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user