Esempio n. 1
0
 public void DoCall()
 {
     if (pawn.Spawned)
     {
         if (PawnAggressive)
         {
             LifeStageUtility.PlayNearestLifestageSound(pawn, (LifeStageAge ls) => ls.soundAngry);
         }
         else
         {
             LifeStageUtility.PlayNearestLifestageSound(pawn, (LifeStageAge ls) => ls.soundCall, IdleCallVolumeFactor);
         }
     }
 }
 public void DoCall()
 {
     if (!this.pawn.Spawned)
     {
         return;
     }
     if (this.PawnAggressive)
     {
         LifeStageUtility.PlayNearestLifestageSound(this.pawn, (LifeStageAge ls) => ls.soundAngry, 1f);
     }
     else
     {
         LifeStageUtility.PlayNearestLifestageSound(this.pawn, (LifeStageAge ls) => ls.soundCall, this.IdleCallVolumeFactor);
     }
 }
        public static void PlayNearestLifestageSound(Pawn pawn, Func <LifeStageAge, SoundDef> getter, float volumeFactor = 1f)
        {
            SoundDef soundDef    = default(SoundDef);
            float    pitchFactor = default(float);
            float    num         = default(float);

            LifeStageUtility.GetNearestLifestageSound(pawn, getter, out soundDef, out pitchFactor, out num);
            if (soundDef != null && pawn.SpawnedOrAnyParentSpawned)
            {
                SoundInfo info = SoundInfo.InMap(new TargetInfo(pawn.PositionHeld, pawn.MapHeld, false), MaintenanceType.None);
                info.pitchFactor  = pitchFactor;
                info.volumeFactor = num * volumeFactor;
                soundDef.PlayOneShot(info);
            }
        }
Esempio n. 4
0
 private static void PlayWoundedVoiceSound(DamageInfo dinfo, Pawn pawn)
 {
     if (!pawn.Dead)
     {
         if (!dinfo.InstantPermanentInjury)
         {
             if (pawn.SpawnedOrAnyParentSpawned)
             {
                 if (dinfo.Def.externalViolence)
                 {
                     LifeStageUtility.PlayNearestLifestageSound(pawn, (LifeStageAge ls) => ls.soundWounded, 1f);
                 }
             }
         }
     }
 }