mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-16 21:08:28 +00:00
add stats about current vehicle's radio
This commit is contained in:
parent
d29a1e1a4e
commit
ea840f8b5e
3 changed files with 27 additions and 1 deletions
|
@ -7,12 +7,18 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
public partial class Vehicle
|
||||
{
|
||||
private int m_currentRadioStationIndex;
|
||||
|
||||
public int CurrentRadioStationIndex => m_currentRadioStationIndex;
|
||||
|
||||
private AudioSource m_radioAudioSource;
|
||||
public AudioSource RadioAudioSource => m_radioAudioSource;
|
||||
|
||||
bool m_isPlayingRadio = false;
|
||||
public bool IsPlayingRadio => m_isPlayingRadio;
|
||||
|
||||
bool m_radio_pedAssignedToVehicleLastFrame = false;
|
||||
|
||||
bool m_isWaitingForNewRadioSound = false;
|
||||
public bool IsWaitingForNewRadioSound => m_isWaitingForNewRadioSound;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -106,6 +106,21 @@ namespace SanAndreasUnity.Stats
|
|||
objects.Add(Vector3.Distance(closestSeat.position, ped.transform.position));
|
||||
}
|
||||
|
||||
// radio
|
||||
|
||||
texts.Add("radio");
|
||||
objects.Add("");
|
||||
|
||||
texts.AddRange(new string[] { "\tis playing", "\tstation index", "\tis waiting for new sound" });
|
||||
objects.AddRange(new object[] { vehicle.IsPlayingRadio, vehicle.CurrentRadioStationIndex, vehicle.IsWaitingForNewRadioSound });
|
||||
|
||||
if (vehicle.RadioAudioSource != null && vehicle.RadioAudioSource.clip != null)
|
||||
{
|
||||
var clip = vehicle.RadioAudioSource.clip;
|
||||
texts.AddRange(new string[] { "\tclip time", "\tclip length", "\tclip size" });
|
||||
objects.AddRange(new object[] { vehicle.RadioAudioSource.time, clip.length, (Utilities.F.GetAudioClipSizeInBytes(clip) / 1024.0f) + " KB" });
|
||||
}
|
||||
|
||||
|
||||
sb.AppendFormat("Current vehicle:\n");
|
||||
for (int i = 0; i < objects.Count; i++)
|
||||
|
|
|
@ -835,5 +835,10 @@ namespace SanAndreasUnity.Utilities
|
|||
public static bool ScreenHasHighDensity => Application.isMobilePlatform;
|
||||
|
||||
|
||||
public static int GetAudioClipSizeInBytes(AudioClip clip)
|
||||
{
|
||||
return clip.samples * sizeof(float);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue