mirror of
				https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
				synced 2024-08-15 00:43:45 +00:00 
			
		
		
		
	added probability to voicetagdefs, to make voice clips play at random intervals
This commit is contained in:
		
							parent
							
								
									c24416e043
								
							
						
					
					
						commit
						964a861d30
					
				
					 3 changed files with 14 additions and 1 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -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;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,5 +9,8 @@ namespace Rimworld_Animations
 | 
			
		|||
{
 | 
			
		||||
    public class VoiceTagDef : Def
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public float probability = 1;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue