added probability to voicetagdefs, to make voice clips play at random intervals

This commit is contained in:
c0ffee 2024-05-04 08:58:07 -07:00
parent c24416e043
commit 964a861d30
3 changed files with 14 additions and 1 deletions

View File

@ -35,7 +35,17 @@ namespace Rimworld_Animations
{
if (tick == keyframe.tick)
{
return (keyframe as ExtendedKeyframe).voice;
VoiceTagDef voiceTag = (keyframe as ExtendedKeyframe).voice;
//probability checking
if (Rand.Chance(voiceTag.probability))
{
return voiceTag;
}
else
{
return null;
}
}
}

View File

@ -9,5 +9,8 @@ namespace Rimworld_Animations
{
public class VoiceTagDef : Def
{
public float probability = 1;
}
}