diff --git a/Assets/Scripts/Behaviours/Ped/Ped.cs b/Assets/Scripts/Behaviours/Ped/Ped.cs index 82eb125d..b6a01ec0 100644 --- a/Assets/Scripts/Behaviours/Ped/Ped.cs +++ b/Assets/Scripts/Behaviours/Ped/Ped.cs @@ -25,6 +25,7 @@ namespace SanAndreasUnity.Behaviours private static List s_allPeds = new List (); public static Ped[] AllPeds { get { return s_allPeds.ToArray (); } } public static IEnumerable AllPedsEnumerable => s_allPeds; + public static int NumPeds => s_allPeds.Count; private WeaponHolder m_weaponHolder; public WeaponHolder WeaponHolder { get { return m_weaponHolder; } } diff --git a/Assets/Scripts/Behaviours/Ped/Ped_Networking.cs b/Assets/Scripts/Behaviours/Ped/Ped_Networking.cs index 828f232b..7040b394 100644 --- a/Assets/Scripts/Behaviours/Ped/Ped_Networking.cs +++ b/Assets/Scripts/Behaviours/Ped/Ped_Networking.cs @@ -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( () => { diff --git a/Assets/Scripts/Behaviours/Vehicles/Vehicle.cs b/Assets/Scripts/Behaviours/Vehicles/Vehicle.cs index 10aac97b..e2ab180f 100644 --- a/Assets/Scripts/Behaviours/Vehicles/Vehicle.cs +++ b/Assets/Scripts/Behaviours/Vehicles/Vehicle.cs @@ -37,6 +37,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles { static List s_vehicles = new List(); public static IEnumerable AllVehicles => s_vehicles; + public static int NumVehicles => s_vehicles.Count; private static int _sLayer = -1; diff --git a/Assets/Scripts/Stats/MiscStats.cs b/Assets/Scripts/Stats/MiscStats.cs index e69de29b..f816ada6 100644 --- a/Assets/Scripts/Stats/MiscStats.cs +++ b/Assets/Scripts/Stats/MiscStats.cs @@ -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); + + } + + } +}