Voice.cs 831 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. namespace COM3D2.MultipleMaids.Util
  3. {
  4. internal interface IVoice
  5. {
  6. int PickRandomVoice();
  7. }
  8. internal struct SingleVoice : IVoice
  9. {
  10. private readonly int VoiceID;
  11. public SingleVoice(int voice)
  12. {
  13. VoiceID = voice;
  14. }
  15. public int PickRandomVoice()
  16. {
  17. return VoiceID;
  18. }
  19. }
  20. internal struct VoiceRange : IVoice
  21. {
  22. private static readonly Random rand = new Random();
  23. private readonly int VoiceStart;
  24. private readonly int VoiceEnd;
  25. public VoiceRange(int start, int end)
  26. {
  27. VoiceStart = start;
  28. VoiceEnd = end;
  29. }
  30. public int PickRandomVoice()
  31. {
  32. return rand.Next(VoiceStart, VoiceEnd + 1);
  33. }
  34. }
  35. }