コード例 #1
0
ファイル: WeaponAlt.cs プロジェクト: BenjaBobs/Hubris
 public virtual void Invoke(Camera pCam, LayerMask mask, WeaponBase weapon, LiveEntity owner)
 {
     switch (_type)
     {
     case WeaponAltType.CREATE_SOUND:
         if (Physics.Raycast(pCam.transform.position, pCam.transform.forward, out RaycastHit hit, weapon.Range, mask))
         {
             owner.EmitSoundEvent(new SoundEvent(null, hit.point, weapon.Range, SoundIntensity.NOTEWORTHY));
         }
         break;
     }
 }
コード例 #2
0
        /// <summary>
        /// Creates a sound event and calls EmitSoundEvent on the specified ISoundEmitter; applies SND_DIST_MOD to the AudioSource.maxDistance
        /// </summary>
        public void CreateSoundEvent(LiveEntity ent, AudioSource src, SoundIntensity type = SoundIntensity.NORMAL)
        {
            if (ent == null)
            {
                return;
            }

            if (src == null)
            {
                return;
            }

            ent.EmitSoundEvent(new SoundEvent(ent, src.transform.position, src.maxDistance * SND_DIST_MOD, type));
        }