Open AdamLacko opened 4 years ago
TODO:
PlayerController.ReadEvents()
is used to read events, not states. With GetKey()
you are reading the state of the key. ReadStates()
is used for reading states.BaseScriptState
should not be aware of vehicles. Yes, it should have OnHornButtonPressed()
, but it should not handle the logic for this. The logic should be handled in VehicleSittingState
.Vehicle.IsHornOn
has a wrong name. It's name suggests in what state is the horn, but you are using it as 'was horn button pressed this frame'.CustomInput
- again, you don't understand the difference between key state and key event. GetKey()
is used for state, GetKeyDown()
is used for event.rip P/R
Umm,,mmmmmm
-Added GetKey method (modified copy of GetKeyDown method already present there) in CustomInput to operate continuous key pressing
-Looping of the horn sound is still not perfect yet. As we discussed before, problem is apparently in the original horn sounds SA engine was most probably modifying at runtime to better blend.
-I do have concerns about the method MakeSubclip() that is used to create loop-able sample for AudioSource, as it hasn't been tested for leaks yet. There are probably none, but it's a good practice to test it anyways. So should be tested horn AudioSource, since it has to be created additionally (due to new radio implementation which already uses one AudioSource), to prevent more of these components being created on, say, scene loads or whenever Awake is additionally called (but I reckon such scenario is not very common in game like this? I'm thinking this further as I work with RPGs where such scenario is quite common). I'll do all this in future commints.
-There is a doppler effect on horn sound. It sounds good in environment, although the effect is also laudable for the player inside car as well. This can be prevented pretty easily though, I'll implement that in next commit.