mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-14 00:07:15 +00:00
Working on misc stats
This commit is contained in:
parent
eedc0f1e62
commit
e9ef2e583d
4 changed files with 33 additions and 0 deletions
|
@ -25,6 +25,7 @@ namespace SanAndreasUnity.Behaviours
|
||||||
private static List<Ped> s_allPeds = new List<Ped> ();
|
private static List<Ped> s_allPeds = new List<Ped> ();
|
||||||
public static Ped[] AllPeds { get { return s_allPeds.ToArray (); } }
|
public static Ped[] AllPeds { get { return s_allPeds.ToArray (); } }
|
||||||
public static IEnumerable<Ped> AllPedsEnumerable => s_allPeds;
|
public static IEnumerable<Ped> AllPedsEnumerable => s_allPeds;
|
||||||
|
public static int NumPeds => s_allPeds.Count;
|
||||||
|
|
||||||
private WeaponHolder m_weaponHolder;
|
private WeaponHolder m_weaponHolder;
|
||||||
public WeaponHolder WeaponHolder { get { return m_weaponHolder; } }
|
public WeaponHolder WeaponHolder { get { return m_weaponHolder; } }
|
||||||
|
|
|
@ -26,6 +26,8 @@ namespace SanAndreasUnity.Behaviours
|
||||||
//[SyncVar(hook=nameof(Net_OnStateChanged))] string m_net_state = "";
|
//[SyncVar(hook=nameof(Net_OnStateChanged))] string m_net_state = "";
|
||||||
//[SyncVar] Weapon m_net_weapon = null;
|
//[SyncVar] Weapon m_net_weapon = null;
|
||||||
|
|
||||||
|
public static int NumStateChangesReceived { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Awake_Net()
|
void Awake_Net()
|
||||||
|
@ -129,6 +131,8 @@ namespace SanAndreasUnity.Behaviours
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NumStateChangesReceived ++;
|
||||||
|
|
||||||
// forcefully change the state
|
// forcefully change the state
|
||||||
|
|
||||||
F.RunExceptionSafe( () => {
|
F.RunExceptionSafe( () => {
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
||||||
{
|
{
|
||||||
static List<Vehicle> s_vehicles = new List<Vehicle>();
|
static List<Vehicle> s_vehicles = new List<Vehicle>();
|
||||||
public static IEnumerable<Vehicle> AllVehicles => s_vehicles;
|
public static IEnumerable<Vehicle> AllVehicles => s_vehicles;
|
||||||
|
public static int NumVehicles => s_vehicles.Count;
|
||||||
|
|
||||||
private static int _sLayer = -1;
|
private static int _sLayer = -1;
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue