Closed jaan242 closed 4 years ago
Vehicles.Radio
should not be singleton component. Actually, it can be completely removed. All radio-related code should be in Vehicle_Radio.cs
.m_ped == Ped.Instance
, but use m_ped.IsControlledByLocalPlayer
AudioManager.PlayStream()
which creates new game object every time, but instead use AudioManager.CreateAudioClipFromStream()
and assign the created clip to AudioSource. Also, destroy this clip after it's finished playing, or otherwise you will have memory leak.TouchInput.cs
and UI.prefab
.~Vehicle.Update()
, because if ped dies, noone will turn off radio.Driver has different touch input, so no changes there, but improved other things.
So, GameManager.prefab
can be reverted now ?
Reverted GameManager.prefab
Added not null check to Ped.Instance
Radio station and time randomized in Vehicle.Start
Let me tell you how I imagined radio station times. Each vehicle has it's own active station. But, stations in all vehicles have the same current time (song and song's time). So, if ped changes vehicles, and plays the same station, he should hear the same song.
With your setup, each vehicle has it's own current time for station. Plus, all stations have the same current position. It should not be like this. It should mimic the real world.
Radio station playback position is kept across vehicles and station switches.
Ok. Will test this tomorrow.
Implemented playing radio stations in vehicles. Sounds are played in the order they are stored in files. Only driver ped can change station using the same buttons which are used for switching weapons (E and Q on a PC, arrows at bottom of screen when using touch input). Selected radio station is not currently synced between players.