My scenario is this, player can cause different noises with different volumes. I'd like the deed impact change according to the sound volume (or other parameter). Is there a way for this or do I need to setup different deeds for different volumes?
Best regards,
Illustrator
Adjust Impact when reporting deed
Re: Adjust Impact when reporting deed
Hi,
You can add a small script to the character that implements the IWitnessDeedEventHandler interface. It just has one method, WitnessDeed(Rumor). Example:
You can check the impact of the Rumor that's passed to it. There's also an equivalent Faction Member Events component with one OnWitnessDeed(Rumor) UnityEvent that you can hook up in the Inspector.
You can add a small script to the character that implements the IWitnessDeedEventHandler interface. It just has one method, WitnessDeed(Rumor). Example:
Code: Select all
public class SoundOnDeed : MonoBehaviour, IWitnessDeedEventHandler
{
public void WitnessDeed(Rumor rumor)
{
var audioSource = GetComponent<AudioSource>();
audioSource.volume = Math.Abs(rumor.impact) / 100; // (Range [-100,+100])
audioSource.Play();
}
}