Ejemplo n.º 1
0
 private void HandleShapeAndSound(SoundService soundService, ShapeAndSoundTuple shapeAndSound, SoundAction soundAction, LongSoundOwner longSoundOwner)
 {
     if (shapeAndSound != null)
     {
         if (shapeAndSound.Shape != null && !this._BabyShapes.Components.Contains(shapeAndSound.Shape))
         {
             this._BabyShapes.Components.Add(shapeAndSound.Shape);
         }
         if (shapeAndSound.Sound != null)
         {
             if (soundAction == SoundAction.Button)
             {
                 soundService.TryPlaySoundButton(shapeAndSound.Sound);
             }
             else if (soundAction == SoundAction.Analogue)
             {
                 soundService.TryPlaySoundLong(shapeAndSound.Sound, longSoundOwner);
             }
             else if (soundAction == SoundAction.ForceButton)
             {
                 soundService.ForcePlaySoundButton(shapeAndSound.Sound);
             }
             else if (soundAction == SoundAction.ForceAnalogue)
             {
                 soundService.TryPlaySoundLong(shapeAndSound.Sound, longSoundOwner);
             }
             else
             {
                 throw new ApplicationException("Forgot a soundType.");
             }
         }
     }
 }