using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.Events;
using com.github.zehsteam.LethalCompanyValuables.Objects;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Zehs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2025 Zehs")]
[assembly: AssemblyDescription("Adds 30 scrap items from Lethal Company as valuables. Some valuables have special interactions.")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+3f70713530c4162f9dc63d86a6e11e973504f9d6")]
[assembly: AssemblyProduct("LethalCompanyValuables")]
[assembly: AssemblyTitle("com.github.zehsteam.LethalCompanyValuables")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace com.github.zehsteam.LethalCompanyValuables
{
internal static class ConfigManager
{
public static ConfigFile ConfigFile { get; private set; }
public static ConfigEntry<bool> ExtendedLogging { get; private set; }
public static void Initialize(ConfigFile configFile)
{
ConfigFile = configFile;
BindConfigs();
}
private static void BindConfigs()
{
ExtendedLogging = ConfigFile.Bind<bool>("General", "ExtendedLogging", false, "Enable extended logging.");
}
}
internal static class Logger
{
public static ManualLogSource ManualLogSource { get; private set; }
public static void Initialize(ManualLogSource manualLogSource)
{
ManualLogSource = manualLogSource;
}
public static void LogDebug(object data, bool extended = true)
{
Log((LogLevel)32, data, extended);
}
public static void LogInfo(object data, bool extended = false)
{
Log((LogLevel)16, data, extended);
}
public static void LogWarning(object data, bool extended = false)
{
Log((LogLevel)4, data, extended);
}
public static void LogError(object data, bool extended = false)
{
Log((LogLevel)2, data, extended);
}
public static void LogFatal(object data, bool extended = false)
{
Log((LogLevel)1, data, extended);
}
public static void Log(LogLevel logLevel, object data, bool extended = false)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
if (!extended || IsExtendedLoggingEnabled())
{
ManualLogSource manualLogSource = ManualLogSource;
if (manualLogSource != null)
{
manualLogSource.Log(logLevel, data);
}
}
}
public static bool IsExtendedLoggingEnabled()
{
if (ConfigManager.ExtendedLogging == null)
{
return false;
}
return ConfigManager.ExtendedLogging.Value;
}
}
[BepInPlugin("com.github.zehsteam.LethalCompanyValuables", "LethalCompanyValuables", "1.3.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class Plugin : BaseUnityPlugin
{
internal static Plugin Instance { get; private set; }
private void Awake()
{
Instance = this;
Logger.Initialize(Logger.CreateLogSource("com.github.zehsteam.LethalCompanyValuables"));
Logger.LogInfo("LethalCompanyValuables has awoken!");
ConfigManager.Initialize(((BaseUnityPlugin)this).Config);
string text = Path.Combine(Utils.GetPluginDirectory(), "lethalcompanyvaluables_assets");
BundleLoader.LoadBundle(text, (Action<AssetBundle>)delegate(AssetBundle assetBundle)
{
ValuableList valuableList = LoadAsset<ValuableList>("ValuableList", assetBundle);
GameObject[] valuables = valuableList.Valuables;
foreach (GameObject val in valuables)
{
Valuables.RegisterValuable(val, new List<string>(1) { "Valuables - Generic" });
}
}, false);
}
private T LoadAsset<T>(string name, AssetBundle assetBundle) where T : Object
{
if ((Object)(object)assetBundle == (Object)null)
{
return default(T);
}
return assetBundle.LoadAsset<T>(name);
}
private bool TryLoadAsset<T>(string name, AssetBundle assetBundle, out T asset) where T : Object
{
asset = LoadAsset<T>(name, assetBundle);
return (Object)(object)asset != (Object)null;
}
}
internal static class Utils
{
public static string GetPluginDirectory()
{
return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.github.zehsteam.LethalCompanyValuables";
public const string PLUGIN_NAME = "LethalCompanyValuables";
public const string PLUGIN_VERSION = "1.3.0";
}
}
namespace com.github.zehsteam.LethalCompanyValuables.Objects
{
[CreateAssetMenu(fileName = "ValuableList", menuName = "LethalCompanyValuables/ValuableList")]
public class ValuableList : ScriptableObject
{
public GameObject[] Valuables = Array.Empty<GameObject>();
}
}
namespace com.github.zehsteam.LethalCompanyValuables.MonoBehaviours
{
public class Apparatus : MonoBehaviour
{
[SerializeField]
private ParticleSystem _sparks;
public void PlaySparks()
{
_sparks.Play();
}
}
[RequireComponent(typeof(ValuableSoundPlayer))]
public class BrassBell : MonoBehaviour
{
private ValuableSoundPlayer _valuableSoundPlayer;
private Random _random;
private void Start()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
_valuableSoundPlayer = ((Component)this).GetComponent<ValuableSoundPlayer>();
_random = new Random((int)(((Component)this).transform.position.x + ((Component)this).transform.position.z));
}
public void RingBellHostOnly()
{
if (SemiFunc.IsMasterClientOrSingleplayer())
{
RingBell();
}
}
public void RingBell()
{
float num = 1f;
switch (_random.Next(0, 7))
{
case 1:
num *= Mathf.Pow(1.05946f, 3f);
break;
case 2:
num *= Mathf.Pow(1.05946f, 5f);
break;
case 3:
num /= Mathf.Pow(1.05946f, 3f);
break;
case 4:
num /= Mathf.Pow(1.05946f, 5f);
break;
case 5:
num /= Mathf.Pow(1.05946f, 7f);
break;
case 6:
num /= Mathf.Pow(1.05946f, 10f);
break;
}
_valuableSoundPlayer.PlaySound(num);
}
}
[RequireComponent(typeof(ValuableSoundPlayer))]
public class CashRegister : MonoBehaviour
{
[SerializeField]
private Animator _animator;
private ValuableSoundPlayer _valuableSoundPlayer;
private PhotonView _photonView;
private void Start()
{
_valuableSoundPlayer = ((Component)this).GetComponent<ValuableSoundPlayer>();
_photonView = ((Component)this).GetComponent<PhotonView>();
}
public void PullLever()
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("PullLeverRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
PullLeverLocal();
}
_valuableSoundPlayer.PlaySound();
}
[PunRPC]
private void PullLeverRPC()
{
PullLeverLocal();
}
private void PullLeverLocal()
{
_animator.SetTrigger("playAnim");
}
}
public class GiftBox : MonoBehaviour
{
[SerializeField]
private Transform _spawnTransform;
[SerializeField]
private GameObject _poofEffectPrefab;
public void OpenGiftBox()
{
SpawnPoofEffect();
SpawnRandomValuable();
}
private void SpawnRandomValuable()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer())
{
Logger.LogInfo("GiftBox: Spawning random valuable.");
if ((Object)(object)_spawnTransform == (Object)null)
{
Logger.LogError("GiftBox: Failed to spawn random valuable. Spawn transform is null.");
return;
}
List<PrefabRef> valuables = GetValuables();
int index = Random.Range(0, valuables.Count);
PrefabRef val = valuables[index];
NetworkPrefabs.SpawnNetworkPrefab(val, _spawnTransform.position, Quaternion.identity, (byte)0, (object[])null);
}
}
private List<PrefabRef> GetValuables()
{
List<LevelValuables> valuablePresets = RunManager.instance.levelCurrent.ValuablePresets;
List<PrefabRef> list = new List<PrefabRef>();
list.AddRange(valuablePresets.SelectMany((LevelValuables x) => x.small));
list.AddRange(valuablePresets.SelectMany((LevelValuables x) => x.medium));
list.AddRange(valuablePresets.SelectMany((LevelValuables x) => x.big));
return list;
}
private void SpawnPoofEffect()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
Object.Instantiate<GameObject>(_poofEffectPrefab, ((Component)this).transform.position, Quaternion.identity);
}
}
[RequireComponent(typeof(ValuableSoundPlayer))]
public class Hairdryer : MonoBehaviour
{
[CompilerGenerated]
private sealed class <PlayWindParticlesCoroutine>d__19 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Hairdryer <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PlayWindParticlesCoroutine>d__19(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
int num = <>1__state;
Hairdryer hairdryer = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
hairdryer._active = true;
hairdryer._windParticles.Play();
hairdryer._windSmallParticles.Play();
<>2__current = (object)new WaitForSeconds(1.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
hairdryer._windParticles.Stop();
hairdryer._windSmallParticles.Stop();
hairdryer._active = false;
hairdryer._playWindParticlesCoroutine = null;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[SerializeField]
private HurtCollider _hurtCollider;
[SerializeField]
private ParticleSystem _windParticles;
[SerializeField]
private ParticleSystem _windSmallParticles;
[SerializeField]
private AnimationCurve fanBladeSpeedCurve;
private ValuableSoundPlayer _valuableSoundPlayer;
private PhotonView _photonView;
private bool _active;
private float _secondsToStart = 0.15f;
private float _secondsToStop = 0.5f;
private float _fanBladeLerp;
private float _initialPlayerHitForce;
private float _initialPhysHitForce;
private float _initialEnemyHitForce;
private Coroutine _playWindParticlesCoroutine;
private void Start()
{
_valuableSoundPlayer = ((Component)this).GetComponent<ValuableSoundPlayer>();
_photonView = ((Component)this).GetComponent<PhotonView>();
_initialPlayerHitForce = _hurtCollider.playerHitForce;
_initialPhysHitForce = _hurtCollider.physHitForce;
_initialEnemyHitForce = _hurtCollider.enemyHitForce;
((Component)_hurtCollider).gameObject.SetActive(false);
}
private void Update()
{
if (_active)
{
if (_fanBladeLerp < 1f)
{
_fanBladeLerp += Time.deltaTime / _secondsToStart;
}
}
else if (_fanBladeLerp > 0f)
{
_fanBladeLerp -= Time.deltaTime / _secondsToStop;
}
((Component)_hurtCollider).gameObject.SetActive(_active);
_hurtCollider.playerHitForce = Mathf.Lerp(0f, _initialPlayerHitForce, fanBladeSpeedCurve.Evaluate(_fanBladeLerp));
_hurtCollider.physHitForce = Mathf.Lerp(0f, _initialPhysHitForce, fanBladeSpeedCurve.Evaluate(_fanBladeLerp));
_hurtCollider.enemyHitForce = Mathf.Lerp(0f, _initialEnemyHitForce, fanBladeSpeedCurve.Evaluate(_fanBladeLerp));
}
public void StartHairdryer()
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("StartHairdryerRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
StartHairdryerLocal();
}
_valuableSoundPlayer.PlaySound();
}
[PunRPC]
private void StartHairdryerRPC()
{
StartHairdryerLocal();
}
private void StartHairdryerLocal()
{
if (_playWindParticlesCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(_playWindParticlesCoroutine);
}
_playWindParticlesCoroutine = ((MonoBehaviour)this).StartCoroutine(PlayWindParticlesCoroutine());
}
[IteratorStateMachine(typeof(<PlayWindParticlesCoroutine>d__19))]
private IEnumerator PlayWindParticlesCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PlayWindParticlesCoroutine>d__19(0)
{
<>4__this = this
};
}
}
public class TeethTrap : Trap
{
[SerializeField]
private AudioSource _chatterAudio;
[SerializeField]
private int _movementAmount = 25;
[SerializeField]
private float _movementCooldown = 0.37f;
[SerializeField]
private float _movementForce = 2f;
private Animator _animator;
private Rigidbody _rigidbody;
private Transform _targetTransform;
private Vector3 _playerDirection;
private int _movementCount;
private Quaternion _lookRotation;
private float _movementTimer;
private bool _trapStopped;
public override void Start()
{
((Trap)this).Start();
_animator = ((Component)this).GetComponent<Animator>();
_rigidbody = ((Component)this).GetComponent<Rigidbody>();
}
public override void Update()
{
((Trap)this).Update();
if (base.trapStart)
{
TrapActivate();
}
if (base.trapActive)
{
base.physGrabObject.OverrideIndestructible(0.1f);
base.enemyInvestigate = true;
}
}
private void FixedUpdate()
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
if (!SemiFunc.IsMasterClientOrSingleplayer() || !base.trapActive)
{
return;
}
if (_movementTimer <= 0f)
{
Move();
}
else
{
_movementTimer -= Time.fixedDeltaTime;
}
base.physGrabObject.OverrideZeroGravity(0.1f);
if (!((Object)(object)_targetTransform == (Object)null))
{
Quaternion val = Quaternion.LookRotation(_targetTransform.position - base.physGrabObject.midPoint);
_lookRotation = Quaternion.Slerp(_lookRotation, val, Time.deltaTime * 5f);
Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)this).transform, _lookRotation, _rigidbody, 0.3f);
if (base.physGrabObject.playerGrabbing.Count > 0)
{
val2 *= 0.25f;
}
_rigidbody.AddTorque(val2, (ForceMode)1);
}
}
private void Move()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
if (base.isLocal)
{
_targetTransform = SemiFunc.PlayerGetNearestTransformWithinRange(10f, base.physGrabObject.centerPoint, true, LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Default" })));
Vector3 val;
if ((Object)(object)_targetTransform != (Object)null)
{
val = _targetTransform.position - base.physGrabObject.midPoint;
_playerDirection = ((Vector3)(ref val)).normalized;
_rigidbody.velocity = Vector3.zero;
_rigidbody.AddForce(_playerDirection * _movementForce, (ForceMode)1);
}
else
{
val = Random.insideUnitSphere;
Vector3 normalized = ((Vector3)(ref val)).normalized;
_rigidbody.AddForce(normalized * _movementForce, (ForceMode)1);
_rigidbody.AddTorque(normalized, (ForceMode)1);
}
_movementTimer = _movementCooldown;
_movementCount++;
if (_movementCount >= _movementAmount)
{
TrapStop();
}
}
}
public void StartAnimation()
{
_animator.SetBool("active", true);
}
public void StopAnimation()
{
_animator.SetBool("active", false);
}
public void TrapActivate()
{
if (!base.trapTriggered)
{
GrabRelease();
base.trapActive = true;
base.trapTriggered = true;
StartAnimation();
_chatterAudio.Play();
}
}
public void TrapStop()
{
if (GameManager.Multiplayer())
{
base.photonView.RPC("TrapStopRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
TrapStopLocal();
}
}
[PunRPC]
private void TrapStopRPC()
{
TrapStopLocal();
}
private void TrapStopLocal()
{
base.trapActive = false;
_trapStopped = true;
StopAnimation();
_chatterAudio.Stop();
}
public void GrabRelease()
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
foreach (PhysGrabber item in base.physGrabObject.playerGrabbing.ToList())
{
if (!SemiFunc.IsMultiplayer())
{
item.photonView.RPC("ReleaseObjectRPC", (RpcTarget)0, new object[3]
{
false,
0.1f,
base.photonView.ViewID
});
}
else
{
item.ReleaseObject(base.photonView.ViewID, 0.1f);
}
flag = true;
}
if (flag)
{
if (SemiFunc.IsMultiplayer())
{
base.photonView.RPC("GrabReleaseRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
GrabReleaseRPC();
}
}
}
[PunRPC]
private void GrabReleaseRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterOnlyRPC(_info))
{
GameDirector.instance.CameraShake.ShakeDistance(5f, 3f, 8f, ((Component)this).transform.position, 0.5f);
GameDirector.instance.CameraImpact.ShakeDistance(5f, 3f, 8f, ((Component)this).transform.position, 0.1f);
base.physGrabObject.grabDisableTimer = 1f;
}
}
}
public class ValuableInteract : MonoBehaviour
{
[SerializeField]
private float _interactCooldown = 0.3f;
[SerializeField]
private UnityEvent _onInteractEvent = new UnityEvent();
private PhysGrabObject _physGrabObject;
private float _timeSinceInteraction = float.NegativeInfinity;
public event Action OnInteract;
private void Start()
{
_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
}
private void Update()
{
if (_physGrabObject.heldByLocalPlayer && SemiFunc.InputDown((InputKey)2) && !IsCooldownActive())
{
InvokeOnInteract();
}
}
private bool IsCooldownActive()
{
return Time.realtimeSinceStartup - _timeSinceInteraction <= _interactCooldown;
}
private void InvokeOnInteract()
{
this.OnInteract?.Invoke();
UnityEvent onInteractEvent = _onInteractEvent;
if (onInteractEvent != null)
{
onInteractEvent.Invoke();
}
_timeSinceInteraction = Time.realtimeSinceStartup;
}
}
public class ValuableSoundPlayer : MonoBehaviour
{
[SerializeField]
private Sound _sound;
[Space(20f)]
[Header("Sound Properties")]
[Space(5f)]
[SerializeField]
private Transform _positionTransform;
[SerializeField]
private float _minPitch = 0.95f;
[SerializeField]
private float _maxPitch = 1f;
[SerializeField]
private bool _alertEnemies = true;
[SerializeField]
private float _alertEnemiesRadius = 1f;
private PhysGrabObject _physGrabObject;
private PhotonView _photonView;
private void Start()
{
_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
_photonView = ((Component)this).GetComponent<PhotonView>();
}
public void PlaySoundHostOnly()
{
if (SemiFunc.IsMasterClientOrSingleplayer())
{
PlaySound();
}
}
public void PlaySoundHostOnly(float pitch)
{
if (SemiFunc.IsMasterClientOrSingleplayer())
{
PlaySound(pitch);
}
}
public void PlaySound()
{
float pitch = Random.Range(_minPitch, _maxPitch);
PlaySound(pitch);
}
public void PlaySound(float pitch)
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("PlaySoundRPC", (RpcTarget)0, new object[1] { pitch });
}
else
{
PlaySoundLocal(pitch);
}
}
[PunRPC]
private void PlaySoundRPC(float pitch)
{
PlaySoundLocal(pitch);
}
public void PlaySoundLocal(float pitch)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((!((Object)(object)_positionTransform != (Object)null)) ? _physGrabObject.centerPoint : _positionTransform.position);
_sound.Pitch = pitch;
_sound.Play(val, 1f, 1f, 1f, 1f);
if (_alertEnemies && SemiFunc.IsMasterClientOrSingleplayer())
{
EnemyInvestigate(_alertEnemiesRadius);
}
}
private void EnemyInvestigate(float radius)
{
if (!((Object)(object)_physGrabObject == (Object)null) && !((Object)(object)_physGrabObject.impactDetector == (Object)null))
{
_physGrabObject.impactDetector.EnemyInvestigate(radius);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}