using System;
using System.Collections.Generic;
using System.Diagnostics;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 BasketballSureShot
{
internal static class BallFactory
{
internal static GameObject SpawnClientOwned(Character thrower, string prefabName, BasketballHoop hoop, Vector3 spawnPos, Quaternion rotation)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)thrower == (Object)null || (Object)(object)hoop == (Object)null)
{
return null;
}
Vector3 val = ((Component)hoop).transform.position + Vector3.up * Plugin.EntryHeightOffset.Value;
float num = Mathf.Abs(Physics.gravity.y);
if (num < 0.01f)
{
num = 9.81f;
}
Vector3 val2 = ComputeLaunch(spawnPos, val, num);
GameObject val3;
try
{
val3 = PhotonNetwork.Instantiate("0_Items/" + prefabName, spawnPos, rotation, (byte)0, (object[])null);
}
catch (Exception ex)
{
if (Plugin.Log != null)
{
Plugin.Log.LogWarning((object)("生成篮球失败:" + ex.Message));
}
return null;
}
if ((Object)(object)val3 == (Object)null)
{
return null;
}
try
{
PhotonView component = val3.GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null && !component.IsMine && PhotonNetwork.LocalPlayer != null)
{
component.TransferOwnership(PhotonNetwork.LocalPlayer);
}
CollisionHelper.IgnoreWithCharacter(val3, thrower);
Item val4 = (((Object)(object)thrower.data != (Object)null) ? thrower.data.currentItem : null);
if ((Object)(object)val4 != (Object)null)
{
CollisionHelper.IgnoreWithObject(val3, ((Component)val4).gameObject);
}
Rigidbody component2 = val3.GetComponent<Rigidbody>();
if ((Object)(object)component2 != (Object)null)
{
component2.isKinematic = false;
component2.linearVelocity = val2;
component2.angularVelocity = Vector3.zero;
}
val3.AddComponent<BallHomer>().Init(spawnPos, val, val2, num, Plugin.CorrectionGain.Value, Plugin.MaxFlightSeconds.Value);
if ((Object)(object)component != (Object)null && (Object)(object)((MonoBehaviourPun)thrower).photonView != (Object)null)
{
component.RPC("RPC_SetThrownData", (RpcTarget)0, new object[2]
{
((MonoBehaviourPun)thrower).photonView.ViewID,
1f
});
}
if (Plugin.LogSpawn.Value && Plugin.Log != null)
{
ManualLogSource log = Plugin.Log;
string[] obj = new string[6] { "自瞄投掷:篮筐=", null, null, null, null, null };
Vector3 position = ((Component)hoop).transform.position;
obj[1] = ((Vector3)(ref position)).ToString("F2");
obj[2] = " 生成=";
obj[3] = ((Vector3)(ref spawnPos)).ToString("F2");
obj[4] = " 初速=";
obj[5] = ((Vector3)(ref val2)).ToString("F2");
log.LogInfo((object)string.Concat(obj));
}
}
catch (Exception ex2)
{
if (Plugin.Log != null)
{
Plugin.Log.LogWarning((object)("初始化篮球失败:" + ex2.Message));
}
}
return val3;
}
internal static Vector3 ComputeLaunch(Vector3 from, Vector3 to, float gravity)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = to - from;
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(val.x, 0f, val.z);
float magnitude = ((Vector3)(ref val2)).magnitude;
float num = Mathf.Max(from.y, to.y) + Plugin.ArcHeight.Value;
float num2 = num - from.y;
float num3 = num - to.y;
if (num2 <= 0.01f || num3 <= 0.01f)
{
if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f))
{
return Vector3.up * 12f;
}
return ((Vector3)(ref val)).normalized * 12f;
}
float num4 = Mathf.Sqrt(2f * gravity * num2);
float num5 = Mathf.Sqrt(2f * num2 / gravity);
float num6 = Mathf.Sqrt(2f * num3 / gravity);
float num7 = num5 + num6;
float num8 = magnitude / num7;
Vector3 val3 = ((magnitude > 0.0001f) ? (val2 / magnitude) : Vector3.zero);
return new Vector3(val3.x * num8, num4, val3.z * num8);
}
}
public class BallHomer : MonoBehaviour
{
private Rigidbody _rb;
private PhotonView _view;
private Vector3 _start;
private Vector3 _entry;
private Vector3 _v0;
private float _gravity;
private float _duration;
private float _startTime;
private float _deadline;
private float _gain;
internal void Init(Vector3 start, Vector3 entry, Vector3 v0, float gravity, float gain, float maxSeconds)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
_start = start;
_entry = entry;
_v0 = v0;
_gravity = ((gravity > 0.01f) ? gravity : 9.81f);
_gain = gain;
_rb = ((Component)this).GetComponent<Rigidbody>();
_view = ((Component)this).GetComponent<PhotonView>();
_startTime = Time.time;
float num = entry.y - start.y;
float num2 = v0.y * v0.y - 2f * _gravity * num;
float num3 = 1.2f;
if (num2 > 0f)
{
float num4 = Mathf.Sqrt(num2);
float num5 = (v0.y + num4) / _gravity;
float num6 = (v0.y - num4) / _gravity;
num3 = Mathf.Max(num5, num6);
if (num3 <= 0.05f)
{
num3 = 1.2f;
}
}
_duration = Mathf.Clamp(num3, 0.2f, maxSeconds);
_deadline = _startTime + _duration + 2f;
}
private void FixedUpdate()
{
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_rb == (Object)null || ((Object)(object)_view != (Object)null && !_view.IsMine))
{
return;
}
float time = Time.time;
if (time > _deadline)
{
Object.Destroy((Object)(object)this);
return;
}
float num = time - _startTime;
if (num >= _duration)
{
float num2 = Mathf.Min(_v0.y - _gravity * _duration, -4f);
_rb.linearVelocity = new Vector3(_v0.x * 0.25f, num2, _v0.z * 0.25f);
if (num > _duration + 0.3f)
{
Object.Destroy((Object)(object)this);
}
}
else
{
Vector3 val = _start + new Vector3(_v0.x * num, _v0.y * num - 0.5f * _gravity * num * num, _v0.z * num);
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(_v0.x, _v0.y - _gravity * num, _v0.z);
_rb.linearVelocity = val2 + (val - _rb.position) * _gain;
_rb.angularVelocity = Vector3.zero;
}
}
}
internal class BallPredictor : MonoBehaviour
{
private const float MinCharge = 0.05f;
private const float RefreshInterval = 0.04f;
private const float ChargeEpsilon = 0.02f;
private const float AimEpsilon = 0.999f;
private const float MoveEpsilonSqr = 0.0025f;
private static BallPredictor _instance;
private static readonly List<Vector3> _points = new List<Vector3>(200);
private LineRenderer _line;
private GameObject _marker;
private Transform _markerT;
private bool _visible;
private bool _hasCache;
private bool _cacheGuided;
private Vector3 _cachePos;
private Vector3 _cacheAim;
private float _cacheCharge;
private float _nextRefresh;
private Item _cachedItem;
private bool _cachedItemIsBall;
internal static void Create()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_instance != (Object)null))
{
GameObject val = new GameObject("[BasketballSureShot]Predictor");
Object.DontDestroyOnLoad((Object)val);
((Object)val).hideFlags = (HideFlags)61;
_instance = val.AddComponent<BallPredictor>();
}
}
internal static void Destroy()
{
if (!((Object)(object)_instance == (Object)null))
{
Object.DestroyImmediate((Object)(object)((Component)_instance).gameObject);
_instance = null;
}
}
private void Update()
{
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!Plugin.Enabled.Value || Plugin.ShowPrediction == null || !Plugin.ShowPrediction.Value)
{
Hide();
return;
}
Player localPlayer = Player.localPlayer;
Character val = (((Object)(object)localPlayer != (Object)null) ? localPlayer.character : null);
if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null || val.refs == null || (Object)(object)val.refs.items == (Object)null)
{
Hide();
return;
}
Item currentItem = val.data.currentItem;
if ((Object)(object)currentItem != (Object)(object)_cachedItem)
{
_cachedItem = currentItem;
_cachedItemIsBall = (Object)(object)currentItem != (Object)null && (Object)(object)((Component)currentItem).GetComponent<Basketball>() != (Object)null;
}
if (!_cachedItemIsBall)
{
Hide();
return;
}
CharacterItems items = val.refs.items;
float charge = ThrowPatch.GetCharge(items);
if (charge < 0.05f)
{
Hide();
return;
}
Vector3 position = currentItem.transform.position;
Vector3 aimDir = ThrowPatch.GetAimDir(val);
BasketballHoop val2 = HoopLocator.FindBest(val.Center, aimDir, Plugin.PreferAimDirection.Value);
bool flag = (Object)(object)val2 != (Object)null && (!Plugin.RequireAimKey.Value || ThrowPatch.AimKeyHeld());
if (_hasCache && flag == _cacheGuided && Time.unscaledTime < _nextRefresh && Mathf.Abs(charge - _cacheCharge) < 0.02f && Vector3.Dot(aimDir, _cacheAim) > 0.999f)
{
Vector3 val3 = position - _cachePos;
if (((Vector3)(ref val3)).sqrMagnitude < 0.0025f)
{
return;
}
}
Vector3 landing = position;
bool landingValid = false;
if (flag)
{
Vector3 val4 = ((Component)val2).transform.position + Vector3.up * Plugin.EntryHeightOffset.Value;
BallTrajectory.BuildGuided(_points, position, val4);
landing = val4;
landingValid = true;
}
else
{
Vector3 velocity = BallTrajectory.ThrowVelocity(items, currentItem, aimDir, charge);
BallTrajectory.BuildThrown(_points, position, velocity, BallTrajectory.EstimateRadius(currentItem), out landing, out landingValid);
}
_hasCache = true;
_cacheGuided = flag;
_cachePos = position;
_cacheAim = aimDir;
_cacheCharge = charge;
_nextRefresh = Time.unscaledTime + 0.04f;
Draw(landing, landingValid, flag);
}
catch
{
Hide();
}
}
private void Draw(Vector3 landing, bool landingValid, bool guided)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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)
EnsureVisuals();
((Renderer)_line).enabled = true;
_line.positionCount = _points.Count;
for (int i = 0; i < _points.Count; i++)
{
_line.SetPosition(i, _points[i]);
}
Color val = (guided ? new Color(0.3f, 0.9f, 0.4f, 0.7f) : new Color(1f, 0.6f, 0.15f, 0.7f));
_line.startColor = val;
_line.endColor = val;
if (landingValid && (Object)(object)_marker != (Object)null)
{
_marker.SetActive(true);
_markerT.position = landing;
}
else if ((Object)(object)_marker != (Object)null)
{
_marker.SetActive(false);
}
_visible = true;
}
private void Hide()
{
if (!_visible)
{
_hasCache = false;
return;
}
if ((Object)(object)_line != (Object)null)
{
((Renderer)_line).enabled = false;
}
if ((Object)(object)_marker != (Object)null)
{
_marker.SetActive(false);
}
_visible = false;
_hasCache = false;
}
private void EnsureVisuals()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Expected O, but got Unknown
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Expected O, but got Unknown
if ((Object)(object)_line == (Object)null)
{
GameObject val = new GameObject("[BasketballSureShot]Line");
val.transform.SetParent(((Component)this).transform, false);
_line = val.AddComponent<LineRenderer>();
_line.startWidth = 0.05f;
_line.endWidth = 0.05f;
_line.useWorldSpace = true;
((Renderer)_line).material = new Material(Shader.Find("Sprites/Default"));
_line.positionCount = 0;
}
if ((Object)(object)_marker == (Object)null)
{
_marker = GameObject.CreatePrimitive((PrimitiveType)0);
_marker.transform.SetParent(((Component)this).transform, false);
_marker.transform.localScale = Vector3.one * 0.18f;
Collider component = _marker.GetComponent<Collider>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
Renderer component2 = _marker.GetComponent<Renderer>();
if ((Object)(object)component2 != (Object)null)
{
component2.material = new Material(Shader.Find("Sprites/Default"));
}
_markerT = _marker.transform;
}
}
private void OnDestroy()
{
_instance = null;
}
}
internal static class BallTrajectory
{
internal const float Step = 0.025f;
internal const int MaxSteps = 150;
internal const int PostBounceSteps = 40;
private const float BounceHorizonalLoss = 0.5f;
private const float BounceVerticalFall = 5f;
private const float WallNormalLimit = 0.2f;
private static LayerMask _mask = LayerMask.op_Implicit(-1);
private static bool _maskReady;
internal static LayerMask TerrainMask
{
get
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//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)
if (!_maskReady)
{
_mask = LayerMask.op_Implicit(LayerMask.GetMask(new string[2] { "Terrain", "Map" }));
_maskReady = true;
}
return _mask;
}
}
internal static float Gravity()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Abs(Physics.gravity.y);
if (!(num < 0.01f))
{
return num;
}
return 9.81f;
}
internal static Vector3 ThrowVelocity(CharacterItems items, Item item, Vector3 aim, float charge)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_0060: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)items == (Object)null || (Object)(object)item == (Object)null)
{
return Vector3.zero;
}
float num = items.minThrowForce + (items.maxThrowForce - items.minThrowForce) * charge;
Vector3 val = ((((Vector3)(ref aim)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref aim)).normalized : item.transform.forward);
return (((Object)(object)item.rig != (Object)null) ? item.rig.linearVelocity : Vector3.zero) + val * num * 0.5f * item.throwForceMultiplier;
}
internal static float EstimateRadius(Item item)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
float num = 0.1f;
if ((Object)(object)item == (Object)null)
{
return num;
}
Collider[] componentsInChildren = ((Component)item).GetComponentsInChildren<Collider>();
foreach (Collider val in componentsInChildren)
{
if (!((Object)(object)val == (Object)null))
{
Bounds bounds = val.bounds;
Vector3 extents = ((Bounds)(ref bounds)).extents;
num = Mathf.Max(num, Mathf.Max(extents.x, Mathf.Max(extents.y, extents.z)));
}
}
return num;
}
internal static bool BuildThrown(List<Vector3> points, Vector3 start, Vector3 velocity, float radius, out Vector3 landing, out bool landingValid)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: 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_0075: 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_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: 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)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
points.Clear();
points.Add(start);
Vector3 val = start;
Vector3 val2 = velocity;
float num = Gravity();
landing = start;
landingValid = false;
for (int i = 0; i < 150; i++)
{
Vector3 val3 = val;
val2.y -= num * 0.025f;
val += val2 * 0.025f;
points.Add(val);
if (!SphereHit(val3, val, radius, out var hit))
{
continue;
}
val = ((RaycastHit)(ref hit)).point;
points.Add(val);
if (Mathf.Abs(Vector3.Dot(((RaycastHit)(ref hit)).normal, Vector3.up)) < 0.2f)
{
((Vector3)(ref val2))..ctor(val2.x * 0.5f, val2.y - 5f, val2.z * 0.5f);
for (int j = 0; j < 40; j++)
{
Vector3 val4 = val;
val2.y -= num * 0.025f;
val += val2 * 0.025f;
points.Add(val);
if (SphereHit(val4, val, radius, out var hit2))
{
val = ((RaycastHit)(ref hit2)).point;
points.Add(val);
if (Mathf.Abs(Vector3.Dot(((RaycastHit)(ref hit2)).normal, Vector3.up)) >= 0.2f)
{
landing = ((RaycastHit)(ref hit2)).point;
landingValid = true;
break;
}
((Vector3)(ref val2))..ctor(val2.x * 0.5f, val2.y - 5f, val2.z * 0.5f);
}
if (val.y < start.y - 40f)
{
break;
}
}
}
else
{
landing = ((RaycastHit)(ref hit)).point;
landingValid = true;
}
if (!landingValid)
{
landing = val;
landingValid = true;
}
return true;
}
landing = val;
landingValid = true;
return false;
}
internal static void BuildGuided(List<Vector3> points, Vector3 start, Vector3 entry)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: 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_0088: Unknown result type (might be due to invalid IL or missing references)
points.Clear();
points.Add(start);
float num = Gravity();
Vector3 val = BallFactory.ComputeLaunch(start, entry, num);
Vector3 val2 = start;
for (int i = 0; i < 150; i++)
{
val.y -= num * 0.025f;
val2 += val * 0.025f;
points.Add(val2);
Vector3 val3 = val2 - entry;
if (((Vector3)(ref val3)).sqrMagnitude < 0.09f)
{
points.Add(entry);
break;
}
if (val.y < 0f && val2.y < entry.y)
{
points.Add(entry);
break;
}
}
}
private static bool SphereHit(Vector3 from, Vector3 to, float radius, out RaycastHit hit)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
hit = default(RaycastHit);
Vector3 val = to - from;
float magnitude = ((Vector3)(ref val)).magnitude;
if (magnitude < 1E-05f)
{
return false;
}
return Physics.SphereCast(from, radius, val / magnitude, ref hit, magnitude, LayerMask.op_Implicit(TerrainMask), (QueryTriggerInteraction)1);
}
}
internal static class CollisionHelper
{
internal static void IgnoreWithCharacter(GameObject go, Character c)
{
if ((Object)(object)go == (Object)null || (Object)(object)c == (Object)null)
{
return;
}
try
{
Collider[] componentsInChildren = go.GetComponentsInChildren<Collider>(true);
Collider[] componentsInChildren2 = ((Component)c).GetComponentsInChildren<Collider>(true);
foreach (Collider val in componentsInChildren)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
foreach (Collider val2 in componentsInChildren2)
{
if ((Object)(object)val2 != (Object)null)
{
Physics.IgnoreCollision(val, val2, true);
}
}
}
}
catch
{
}
}
internal static void IgnoreWithObject(GameObject a, GameObject b)
{
if ((Object)(object)a == (Object)null || (Object)(object)b == (Object)null)
{
return;
}
try
{
Collider[] componentsInChildren = a.GetComponentsInChildren<Collider>(true);
Collider[] componentsInChildren2 = b.GetComponentsInChildren<Collider>(true);
foreach (Collider val in componentsInChildren)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
foreach (Collider val2 in componentsInChildren2)
{
if ((Object)(object)val2 != (Object)null)
{
Physics.IgnoreCollision(val, val2, true);
}
}
}
}
catch
{
}
}
}
internal class HeldBallHider : MonoBehaviour
{
private const float MinCharge = 0.05f;
private static HeldBallHider _instance;
private Item _hiddenItem;
private readonly List<Renderer> _hidden = new List<Renderer>(4);
internal static void Create()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_instance != (Object)null))
{
GameObject val = new GameObject("[BasketballSureShot]HeldHider");
Object.DontDestroyOnLoad((Object)val);
((Object)val).hideFlags = (HideFlags)61;
_instance = val.AddComponent<HeldBallHider>();
}
}
internal static void Destroy()
{
if (!((Object)(object)_instance == (Object)null))
{
Object.DestroyImmediate((Object)(object)((Component)_instance).gameObject);
_instance = null;
}
}
private void LateUpdate()
{
try
{
if (!Plugin.Enabled.Value || Plugin.HideWhileCharging == null || !Plugin.HideWhileCharging.Value)
{
Restore();
return;
}
Player localPlayer = Player.localPlayer;
Character val = (((Object)(object)localPlayer != (Object)null) ? localPlayer.character : null);
if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null || val.refs == null || (Object)(object)val.refs.items == (Object)null)
{
Restore();
return;
}
Item currentItem = val.data.currentItem;
if ((Object)(object)currentItem == (Object)null || (Object)(object)((Component)currentItem).GetComponent<Basketball>() == (Object)null)
{
Restore();
}
else if (ThrowPatch.GetCharge(val.refs.items) < 0.05f)
{
Restore();
}
else
{
Hide(currentItem);
}
}
catch
{
Restore();
}
}
private void Hide(Item item)
{
if ((Object)(object)_hiddenItem == (Object)(object)item)
{
return;
}
Restore();
_hiddenItem = item;
Renderer[] componentsInChildren = ((Component)item).GetComponentsInChildren<Renderer>();
foreach (Renderer val in componentsInChildren)
{
if ((Object)(object)val != (Object)null && val.enabled)
{
val.enabled = false;
_hidden.Add(val);
}
}
}
private void Restore()
{
for (int i = 0; i < _hidden.Count; i++)
{
Renderer val = _hidden[i];
if ((Object)(object)val != (Object)null)
{
val.enabled = true;
}
}
_hidden.Clear();
_hiddenItem = null;
}
private void OnDestroy()
{
Restore();
_instance = null;
}
}
internal static class HoopLocator
{
private const float CacheSeconds = 1f;
private static BasketballHoop[] _cachedHoops;
private static float _cacheTime = -999f;
internal static BasketballHoop FindBest(Vector3 from, Vector3 aimDir, bool preferAim)
{
//IL_005b: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
if (_cachedHoops == null || Time.unscaledTime - _cacheTime > 1f)
{
_cachedHoops = CollectHoops();
_cacheTime = Time.unscaledTime;
}
BasketballHoop[] cachedHoops = _cachedHoops;
if (cachedHoops == null || cachedHoops.Length == 0)
{
return null;
}
BasketballHoop result = null;
float num = float.MaxValue;
Vector3 val = ((((Vector3)(ref aimDir)).sqrMagnitude > 0.001f) ? ((Vector3)(ref aimDir)).normalized : Vector3.zero);
foreach (BasketballHoop val2 in cachedHoops)
{
if (!((Object)(object)val2 == (Object)null))
{
Vector3 val3 = ((Component)val2).transform.position - from;
float num2 = ((Vector3)(ref val3)).magnitude;
if (preferAim && val != Vector3.zero && ((Vector3)(ref val3)).sqrMagnitude > 0.01f)
{
float num3 = Vector3.Dot(((Vector3)(ref val3)).normalized, val);
num2 = ((!(num3 < 0.25f)) ? (num2 - num3 * 8f) : (num2 + 60f));
}
if (num2 < num)
{
num = num2;
result = val2;
}
}
}
return result;
}
private static BasketballHoop[] CollectHoops()
{
try
{
return Object.FindObjectsByType<BasketballHoop>((FindObjectsSortMode)0);
}
catch
{
try
{
return Object.FindObjectsOfType<BasketballHoop>();
}
catch
{
return null;
}
}
}
}
internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "BasketballSureShot";
public const string PLUGIN_NAME = "篮球必进";
public const string PLUGIN_VERSION = "0.5.1";
}
[BepInPlugin("BasketballSureShot", "篮球必进", "0.5.1")]
public class Plugin : BaseUnityPlugin
{
public static ConfigEntry<bool> Enabled;
public static ConfigEntry<bool> RequireAimKey;
public static ConfigEntry<KeyCode> AimKey;
public static ConfigEntry<bool> KeepBasketball;
public static ConfigEntry<bool> ShowPrediction;
public static ConfigEntry<bool> HideWhileCharging;
public static ConfigEntry<float> ArcHeight;
public static ConfigEntry<float> EntryHeightOffset;
public static ConfigEntry<float> CorrectionGain;
public static ConfigEntry<float> MaxFlightSeconds;
public static ConfigEntry<bool> PreferAimDirection;
public static ConfigEntry<bool> LogSpawn;
internal static ManualLogSource Log;
private Harmony _harmony;
public static Plugin Instance { get; private set; }
private void Awake()
{
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Expected O, but got Unknown
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "总开关。关闭后不拦截投掷,行为与原版一致。");
RequireAimKey = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RequireAimKey", true, "开启后必须按住自瞄键投掷才触发必进;关闭后只要投掷篮球就必进。");
AimKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "AimKey", (KeyCode)323, "自瞄键,按住它投掷才会自动瞄准;可改为任意鼠标键或键盘键。");
KeepBasketball = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "KeepBasketball", false, "关闭时投掷会像原版一样消耗手中的篮球;开启后投掷不消耗,可无限投。");
ShowPrediction = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowPrediction", true, "手持篮球蓄力时显示预测轨迹与落点:按住自瞄键时显示入筐弧线,其余情况显示普通投掷轨迹。");
HideWhileCharging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HideWhileCharging", true, "手持篮球蓄力时隐藏手中篮球的显示,避免球体挡住视线;松手立即恢复。仅影响你自己的画面。");
ArcHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Aim", "ArcHeight", 1.5f, "弧线最高点高于篮筐的高度(米),越大弧线越高。");
EntryHeightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Aim", "EntryHeightOffset", 0.5f, "入筐目标点相对篮筐中心的高度抬高量(米)。");
CorrectionGain = ((BaseUnityPlugin)this).Config.Bind<float>("Aim", "CorrectionGain", 6f, "飞行途中纠偏强度,越大越贴轨迹但可能抖动,建议 3~10。");
MaxFlightSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Aim", "MaxFlightSeconds", 6f, "制导最长飞行时间(秒),超时放弃控制。");
PreferAimDirection = ((BaseUnityPlugin)this).Config.Bind<bool>("Aim", "PreferAimDirection", true, "开启后优先选择准星朝向的篮筐,关闭后只选最近的篮筐。");
LogSpawn = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LogSpawn", false, "开启后在日志中输出每次自瞄投掷的生成信息。");
_harmony = new Harmony("BasketballSureShot");
_harmony.PatchAll(typeof(Plugin).Assembly);
BallPredictor.Create();
HeldBallHider.Create();
Log.LogInfo((object)"篮球必进 v0.5.1 已加载。");
}
private void OnDestroy()
{
BallPredictor.Destroy();
HeldBallHider.Destroy();
if (_harmony != null)
{
_harmony.UnpatchSelf();
_harmony = null;
}
}
}
[HarmonyPatch(typeof(CharacterItems), "DoDropping")]
internal static class ThrowPatch
{
private static readonly FieldRef<CharacterItems, bool> PressedDropRef = AccessTools.FieldRefAccess<CharacterItems, bool>("pressedDrop");
private static readonly FieldRef<CharacterItems, float> ThrowChargeRef = AccessTools.FieldRefAccess<CharacterItems, float>("throwChargeLevel");
internal static float GetCharge(CharacterItems items)
{
try
{
return ThrowChargeRef.Invoke(items);
}
catch
{
return 0f;
}
}
private static bool Prefix(CharacterItems __instance, Character ___character)
{
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!Plugin.Enabled.Value)
{
return true;
}
if ((Object)(object)___character == (Object)null || !___character.IsLocal)
{
return true;
}
if ((Object)(object)___character.data == (Object)null || ___character.refs == null || (Object)(object)___character.refs.items == (Object)null)
{
return true;
}
CharacterInput input = ___character.input;
if ((Object)(object)input == (Object)null || !input.dropWasReleased)
{
return true;
}
if (!PressedDropRef.Invoke(__instance))
{
return true;
}
Item currentItem = ___character.data.currentItem;
if ((Object)(object)currentItem == (Object)null || (Object)(object)((Component)currentItem).GetComponent<Basketball>() == (Object)null)
{
return true;
}
if (Plugin.RequireAimKey.Value && !AimKeyHeld())
{
return true;
}
Optionable<byte> currentSelectedSlot = ___character.refs.items.currentSelectedSlot;
if (!currentSelectedSlot.IsSome)
{
return true;
}
Vector3 aimDir = GetAimDir(___character);
BasketballHoop val = HoopLocator.FindBest(___character.Center, aimDir, Plugin.PreferAimDirection.Value);
if ((Object)(object)val == (Object)null)
{
return true;
}
string text = null;
try
{
ItemSlot itemSlot = ___character.player.GetItemSlot(currentSelectedSlot.Value);
if (itemSlot != null)
{
text = itemSlot.GetPrefabName();
}
}
catch
{
}
if (string.IsNullOrEmpty(text))
{
text = "Basketball";
}
if ((Object)(object)BallFactory.SpawnClientOwned(___character, text, val, currentItem.transform.position, currentItem.transform.rotation) == (Object)null)
{
return true;
}
PressedDropRef.Invoke(__instance) = false;
ThrowChargeRef.Invoke(__instance) = 0f;
if (!Plugin.KeepBasketball.Value)
{
ConsumeHeld(__instance, ___character, currentSelectedSlot);
}
return false;
}
catch (Exception ex)
{
if (Plugin.Log != null)
{
Plugin.Log.LogError((object)("篮球必进投掷拦截异常:" + ex));
}
return true;
}
}
internal static bool AimKeyHeld()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: 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)
KeyCode value = Plugin.AimKey.Value;
if ((int)value == 0)
{
return true;
}
try
{
return Input.GetKey(value);
}
catch
{
return false;
}
}
private static void ConsumeHeld(CharacterItems items, Character c, Optionable<byte> slot)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
try
{
((MonoBehaviourPun)items).photonView.RPC("DestroyHeldItemRpc", (RpcTarget)0, Array.Empty<object>());
c.player.EmptySlot(slot, true);
items.EquipSlot(Optionable<byte>.None);
}
catch (Exception ex)
{
if (Plugin.Log != null)
{
Plugin.Log.LogWarning((object)("消耗手中篮球失败:" + ex.Message));
}
}
}
internal static Vector3 GetAimDir(Character c)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)MainCamera.instance != (Object)null)
{
return ((Component)MainCamera.instance).transform.forward;
}
}
catch
{
}
return ((Component)c).transform.forward;
}
}
}