@@ -5,34 +5,63 @@ namespace EddiSpeechService
55 public class EddiSpeech
66 {
77 public string message { get ; private set ; }
8- public Ship ship { get ; private set ; }
98 public int priority { get ; private set ; }
109 public string voice { get ; private set ; }
1110 public bool radio { get ; private set ; }
1211 public string eventType { get ; private set ; }
1312
1413 // Calculated SpeechFX data
15- public int echoDelay { get ; set ; }
16- public int chorusLevel { get ; set ; }
17- public int reverbLevel { get ; set ; }
18- public int distortionLevel { get ; set ; }
19- public int compressionLevel { get ; set ; }
14+ public int echoDelay { get ; }
15+ public int distortionLevel { get ; }
2016
21- public EddiSpeech ( string message , Ship ship = null , int priority = 3 , string voice = null , bool radio = false , string eventType = null )
17+ public EddiSpeech ( string message , string voice = null , int priority = 3 ,
18+ string eventType = null , LandingPadSize shipSize = null ,
19+ decimal ? shipHealth = 100M , bool radio = false , bool distortOnDamage = false )
2220 {
2321 this . message = message ;
24- this . ship = ship ;
2522 this . priority = priority ;
2623 this . voice = voice ;
2724 this . radio = radio ;
2825 this . eventType = eventType ;
2926
30- EddiSpeech speech = SpeechService . Instance . GetSpeechFX ( this ) ;
31- this . echoDelay = speech . echoDelay ;
32- this . chorusLevel = speech . chorusLevel ;
33- this . reverbLevel = speech . reverbLevel ;
34- this . distortionLevel = speech . distortionLevel ;
35- this . compressionLevel = speech . compressionLevel ;
27+ // Resolve the SpeechFX settings
28+ echoDelay = GetEchoDelay ( shipSize ) ;
29+ distortionLevel = GetDistortionLevel ( distortOnDamage , shipHealth ) ;
30+ }
31+
32+ private static int GetDistortionLevel ( bool distortOnDamage , decimal ? shipHealth )
33+ {
34+ // This is affected by ship health
35+ var distortionLevel = 0 ;
36+ if ( shipHealth != null && distortOnDamage )
37+ {
38+ distortionLevel = ( 100 - ( int ) shipHealth ) ;
39+ }
40+
41+ return distortionLevel ;
42+ }
43+
44+ private static int GetEchoDelay ( LandingPadSize size )
45+ {
46+ // this is affected by ship size
47+ var echoDelayMs = 0 ; // Default
48+ if ( size != null )
49+ {
50+ if ( size == LandingPadSize . Small )
51+ {
52+ echoDelayMs = 100 ;
53+ }
54+ else if ( size == LandingPadSize . Medium )
55+ {
56+ echoDelayMs = 200 ;
57+ }
58+ else if ( size == LandingPadSize . Large )
59+ {
60+ echoDelayMs = 300 ;
61+ }
62+ }
63+
64+ return echoDelayMs ;
3665 }
3766 }
3867}
0 commit comments