Working on misc stats

This commit is contained in:
in0finite 2019-05-26 01:51:29 +02:00
parent eedc0f1e62
commit e9ef2e583d
4 changed files with 33 additions and 0 deletions

View file

@ -25,6 +25,7 @@ namespace SanAndreasUnity.Behaviours
private static List<Ped> s_allPeds = new List<Ped> ();
public static Ped[] AllPeds { get { return s_allPeds.ToArray (); } }
public static IEnumerable<Ped> AllPedsEnumerable => s_allPeds;
public static int NumPeds => s_allPeds.Count;
private WeaponHolder m_weaponHolder;
public WeaponHolder WeaponHolder { get { return m_weaponHolder; } }

View file

@ -26,6 +26,8 @@ namespace SanAndreasUnity.Behaviours
//[SyncVar(hook=nameof(Net_OnStateChanged))] string m_net_state = "";
//[SyncVar] Weapon m_net_weapon = null;
public static int NumStateChangesReceived { get; private set; }
void Awake_Net()
@ -129,6 +131,8 @@ namespace SanAndreasUnity.Behaviours
return;
}
NumStateChangesReceived ++;
// forcefully change the state
F.RunExceptionSafe( () => {

View file

@ -37,6 +37,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
{
static List<Vehicle> s_vehicles = new List<Vehicle>();
public static IEnumerable<Vehicle> AllVehicles => s_vehicles;
public static int NumVehicles => s_vehicles.Count;
private static int _sLayer = -1;

View file

@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using SanAndreasUnity.Behaviours;
using SanAndreasUnity.Behaviours.Vehicles;
namespace SanAndreasUnity.Stats
{
public class MiscStats : MonoBehaviour
{
void Start()
{
Utilities.Stats.RegisterStat(new Utilities.Stats.Entry(){category = "MISC", onGUI = OnStatGUI});
}
void OnStatGUI()
{
GUILayout.Label("Num peds: " + Ped.NumPeds);
GUILayout.Label("Num vehicles: " + Vehicle.NumVehicles);
GUILayout.Label("Num ped state changes received: " + Ped.NumStateChangesReceived);
}
}
}