using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Microsoft.CodeAnalysis; using UnityEngine; [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("HowToFish.ItemSDK.Contracts")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Shared AssetBundle contracts for HTFItemSDK and HTF MoreItemAPI")] [assembly: AssemblyFileVersion("0.1.3.0")] [assembly: AssemblyInformationalVersion("0.1.3+4cf7ec4204765620bc4bfcfabac8a7b944cfe3f3")] [assembly: AssemblyProduct("HowToFish.ItemSDK.Contracts")] [assembly: AssemblyTitle("HowToFish.ItemSDK.Contracts")] [assembly: AssemblyVersion("0.1.3.0")] [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 HowToFish.ItemSDK { [Serializable] public sealed class HTFHandPoseData { public const int FingerJointCount = 15; [SerializeField] [InspectorName("Enable This Hand")] private bool _enabled; [SerializeField] [InspectorName("Hand Position (Item Space)")] private Vector3 _handPosition; [SerializeField] [InspectorName("Hand Rotation (Item Space)")] private Quaternion _handRotation = Quaternion.identity; [SerializeField] [InspectorName("15 Finger Joint Local Rotations")] private Quaternion[] _fingerLocalRotations = CreateIdentityFingerPose(); public bool Enabled { get { return _enabled; } set { _enabled = value; } } public Vector3 HandPosition { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _handPosition; } set { //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) _handPosition = value; } } public Quaternion HandRotation { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _handRotation; } set { //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) _handRotation = value; } } public Quaternion[] FingerLocalRotations => _fingerLocalRotations; public void SetFingerLocalRotations(Quaternion[] rotations) { //IL_0021: 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_002a: Unknown result type (might be due to invalid IL or missing references) _fingerLocalRotations = (Quaternion[])(object)new Quaternion[15]; for (int i = 0; i < 15; i++) { _fingerLocalRotations[i] = ((rotations != null && i < rotations.Length) ? rotations[i] : Quaternion.identity); } } public void EnsureValid() { if (_fingerLocalRotations == null || _fingerLocalRotations.Length != 15) { SetFingerLocalRotations(_fingerLocalRotations); } } private static Quaternion[] CreateIdentityFingerPose() { //IL_000e: 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) Quaternion[] array = (Quaternion[])(object)new Quaternion[15]; for (int i = 0; i < array.Length; i++) { array[i] = Quaternion.identity; } return array; } } [CreateAssetMenu(fileName = "NewItemHoldPose", menuName = "How to Fish Item SDK/Hold Pose")] public sealed class HTFItemHoldPoseAsset : ScriptableObject { public const int CurrentSchemaVersion = 1; [SerializeField] [HideInInspector] private int _schemaVersion = 1; [Header("Item Target Relative to the Player Hold Target")] [SerializeField] [InspectorName("Held Position")] private Vector3 _heldPosition = new Vector3(0.42f, -0.33f, -0.76f); [SerializeField] [InspectorName("Held Rotation")] private Vector3 _heldRotation = new Vector3(0f, 63f, 0f); [Header("Inventory Draw Start")] [SerializeField] [InspectorName("Draw Start Position")] private Vector3 _drawStartPosition = new Vector3(0.3f, -1f, 0.5f); [SerializeField] [InspectorName("Draw Start Rotation")] private Vector3 _drawStartRotation = new Vector3(0f, 90f, 0f); [Header("Hands")] [SerializeField] [InspectorName("Right Hand Pose")] private HTFHandPoseData _rightHand = HTFOriginalPosePresets.CreateRadioRightHand(); [SerializeField] [InspectorName("Left Hand Pose")] private HTFHandPoseData _leftHand = new HTFHandPoseData(); [Header("Motion")] [SerializeField] [Min(0f)] [InspectorName("Hold Bob Multiplier")] private float _holdBobMultiplier = 1f; [SerializeField] [InspectorName("Override Player Velocity Amount")] private bool _overridePlayerVelocityAmount; [SerializeField] [Range(0f, 1f)] [InspectorName("Player Velocity Amount")] private float _playerVelocityAmount; public int SchemaVersion => _schemaVersion; public Vector3 HeldPosition { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _heldPosition; } set { //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) _heldPosition = value; } } public Vector3 HeldRotation { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _heldRotation; } set { //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) _heldRotation = value; } } public Vector3 DrawStartPosition { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _drawStartPosition; } set { //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) _drawStartPosition = value; } } public Vector3 DrawStartRotation { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _drawStartRotation; } set { //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) _drawStartRotation = value; } } public HTFHandPoseData RightHand => _rightHand; public HTFHandPoseData LeftHand => _leftHand; public float HoldBobMultiplier { get { return _holdBobMultiplier; } set { _holdBobMultiplier = Mathf.Max(0f, value); } } public bool OverridePlayerVelocityAmount { get { return _overridePlayerVelocityAmount; } set { _overridePlayerVelocityAmount = value; } } public float PlayerVelocityAmount { get { return _playerVelocityAmount; } set { _playerVelocityAmount = Mathf.Clamp01(value); } } public bool Validate(out string error) { //IL_0058: 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_0072: 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) if (_schemaVersion != 1) { error = $"Unsupported hold-pose schema {_schemaVersion}; expected {1}."; return false; } if (_rightHand == null || _leftHand == null) { error = "Both hand pose records must exist."; return false; } _rightHand.EnsureValid(); _leftHand.EnsureValid(); if (!IsFinite(_heldPosition) || !IsFinite(_heldRotation) || !IsFinite(_drawStartPosition) || !IsFinite(_drawStartRotation) || float.IsNaN(_holdBobMultiplier) || float.IsInfinity(_holdBobMultiplier)) { error = "The pose contains a NaN or infinite value."; return false; } error = null; return true; } private void OnValidate() { _schemaVersion = 1; if (_rightHand == null) { _rightHand = new HTFHandPoseData(); } if (_leftHand == null) { _leftHand = new HTFHandPoseData(); } _rightHand.EnsureValid(); _leftHand.EnsureValid(); _holdBobMultiplier = Mathf.Max(0f, _holdBobMultiplier); _playerVelocityAmount = Mathf.Clamp01(_playerVelocityAmount); } private static bool IsFinite(Vector3 value) { //IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references) if (IsFinite(value.x) && IsFinite(value.y)) { return IsFinite(value.z); } return false; } private static bool IsFinite(float value) { if (!float.IsNaN(value)) { return !float.IsInfinity(value); } return false; } } public static class HTFOriginalPosePresets { public static void ApplyRadioSingleHand(HTFItemHoldPoseAsset pose) { //IL_0016: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) RequirePose(pose); pose.HeldPosition = new Vector3(0.42f, -0.33f, -0.76f); pose.HeldRotation = new Vector3(0f, 63f, 0f); pose.DrawStartPosition = new Vector3(0.3f, -1f, 0.5f); pose.DrawStartRotation = new Vector3(0f, 90f, 0f); pose.HoldBobMultiplier = 1f; pose.OverridePlayerVelocityAmount = false; pose.PlayerVelocityAmount = 0f; CopyHand(CreateDisabledHand(), pose.LeftHand); CopyHand(CreateRadioRightHand(), pose.RightHand); } public static void ApplyMapTwoHandsOnly(HTFItemHoldPoseAsset pose) { RequirePose(pose); CopyHand(CreateMapLeftHand(), pose.LeftHand); CopyHand(CreateMapRightHand(), pose.RightHand); } public static void ApplyMapTwoHandFullPose(HTFItemHoldPoseAsset pose) { //IL_0016: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) RequirePose(pose); pose.HeldPosition = new Vector3(0f, -0.05f, -1.2f); pose.HeldRotation = new Vector3(-80f, 0f, 0f); pose.DrawStartPosition = new Vector3(0f, -1f, 0.5f); pose.DrawStartRotation = new Vector3(90f, 0f, 0f); pose.HoldBobMultiplier = 0.6f; pose.OverridePlayerVelocityAmount = true; pose.PlayerVelocityAmount = 1f; ApplyMapTwoHandsOnly(pose); } public static HTFHandPoseData CreateRadioRightHand() { //IL_000f: 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_004a: 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_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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_0215: Unknown result type (might be due to invalid IL or missing references) return CreateHand(new Vector3(0.09920406f, 0.27439833f, -0.06556702f), new Quaternion(-0.20334123f, 0.6784968f, 0.67723864f, 0.19910352f), (Quaternion[])(object)new Quaternion[15] { new Quaternion(-0.17645995f, 0.0836007f, -0.02524008f, 0.9804263f), new Quaternion(-0.796266f, -0.01515778f, 0.014898457f, 0.6045732f), new Quaternion(-0.5076878f, 0.003543657f, 0.007965563f, 0.86149704f), new Quaternion(-0.34734228f, 0.006803209f, -0.033399336f, 0.93711877f), new Quaternion(-0.8034126f, -0.000761092f, 0.052317597f, 0.59311914f), new Quaternion(-0.5316856f, 0.005730562f, 0.0019349393f, 0.84692025f), new Quaternion(-0.84903914f, -0.06389f, -0.045607448f, 0.522466f), new Quaternion(-0.011965696f, 0.9728566f, -0.22956258f, -0.026608892f), new Quaternion(0.024349783f, 0.9218279f, 0.38478187f, 0.039791096f), new Quaternion(-0.81334496f, -0.029981144f, -0.05262217f, 0.57862085f), new Quaternion(-0.58162737f, -0.002805759f, 0.030088276f, 0.81289387f), new Quaternion(-0.114157796f, 0.004546409f, 0.037410397f, 0.9927476f), new Quaternion(-0.25394344f, 0.17243882f, -0.31861526f, 0.89680654f), new Quaternion(0.30824605f, -0.0608297f, 0.24755368f, 0.9165158f), new Quaternion(-0.0007670824f, 0.011516825f, 0.07372607f, 0.99721175f) }); } public static HTFHandPoseData CreateMapLeftHand() { //IL_000f: 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_004a: 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_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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_0215: Unknown result type (might be due to invalid IL or missing references) return CreateHand(new Vector3(-0.18405652f, 0.033113956f, -0.18624163f), new Quaternion(0.5098463f, 0.4488421f, 0.73206466f, -0.051757783f), (Quaternion[])(object)new Quaternion[15] { new Quaternion(0.28719264f, 0.06597653f, -0.050667886f, 0.9542538f), new Quaternion(0.15671512f, 0.022660088f, 0.07683137f, 0.9843901f), new Quaternion(0.015327393f, 0.014648255f, 0.01166631f, 0.9997072f), new Quaternion(0.2472412f, -0.015532613f, -0.03278998f, 0.9682745f), new Quaternion(0.37844452f, 0.07190943f, 0.029446967f, 0.9223566f), new Quaternion(0.08648097f, 0.014685285f, 0.016577924f, 0.9960073f), new Quaternion(0.4295139f, -0.06893119f, 0.023413636f, 0.9001213f), new Quaternion(0.014603084f, 0.97065073f, 0.23872685f, -0.025167499f), new Quaternion(-0.009083921f, 0.9846149f, -0.17359486f, 0.017772298f), new Quaternion(0.32728767f, -0.06640267f, -0.00745768f, 0.9425592f), new Quaternion(0.3990275f, 0.017894266f, -0.009065839f, 0.91671956f), new Quaternion(0.11809985f, 0.04579304f, 0.021999639f, 0.9917013f), new Quaternion(0.28361353f, -0.1173431f, -0.11725441f, 0.94448155f), new Quaternion(-0.1318681f, 0.118932575f, 0.24238203f, 0.9537908f), new Quaternion(-0.025611738f, 0.05958537f, 0.008527417f, 0.9978582f) }); } public static HTFHandPoseData CreateMapRightHand() { //IL_000f: 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_004a: 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_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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_0215: Unknown result type (might be due to invalid IL or missing references) return CreateHand(new Vector3(0.19659996f, 0.036249995f, -0.17779994f), new Quaternion(0.6745851f, -0.06982532f, 0.57147884f, 0.4620296f), (Quaternion[])(object)new Quaternion[15] { new Quaternion(-0.02976632f, 0.078957684f, -0.037307203f, 0.9957349f), new Quaternion(-0.5323071f, -0.008939026f, 0.019282252f, 0.84628457f), new Quaternion(-0.018548558f, 0.007002061f, 0.0051943185f, 0.99978995f), new Quaternion(-0.29350412f, 0.004893422f, -0.033732146f, 0.95535f), new Quaternion(-0.21119776f, 0.033995472f, 0.039774686f, 0.9760419f), new Quaternion(-0.08805111f, 0.005983259f, -0.00088462787f, 0.9960976f), new Quaternion(-0.36304793f, -0.078470595f, 0.0020768049f, 0.92845803f), new Quaternion(-0.011840507f, 0.9739258f, -0.224983f, -0.026664995f), new Quaternion(0.032568395f, 0.9842087f, 0.1707542f, 0.03339985f), new Quaternion(-0.32743385f, -0.054931186f, -0.025505273f, 0.9429312f), new Quaternion(-0.24056424f, 0.008496598f, 0.028999517f, 0.97016275f), new Quaternion(-0.114157796f, 0.004546409f, 0.037410397f, 0.9927476f), new Quaternion(-0.3283949f, 0.33083424f, -0.068605155f, 0.88204247f), new Quaternion(0.23251432f, -0.0760676f, 0.22051305f, 0.944206f), new Quaternion(-0.0020824517f, 0.011352842f, -0.041103695f, 0.9990883f) }); } private static HTFHandPoseData CreateDisabledHand() { //IL_000d: 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) return new HTFHandPoseData { Enabled = false, HandPosition = Vector3.zero, HandRotation = Quaternion.identity }; } private static HTFHandPoseData CreateHand(Vector3 position, Quaternion rotation, Quaternion[] fingerRotations) { //IL_000d: 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) HTFHandPoseData hTFHandPoseData = new HTFHandPoseData(); hTFHandPoseData.Enabled = true; hTFHandPoseData.HandPosition = position; hTFHandPoseData.HandRotation = rotation; hTFHandPoseData.SetFingerLocalRotations(fingerRotations); return hTFHandPoseData; } private static void CopyHand(HTFHandPoseData source, HTFHandPoseData destination) { //IL_000e: 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) destination.Enabled = source.Enabled; destination.HandPosition = source.HandPosition; destination.HandRotation = source.HandRotation; destination.SetFingerLocalRotations(source.FingerLocalRotations); } private static void RequirePose(HTFItemHoldPoseAsset pose) { if (!Object.op_Implicit((Object)(object)pose)) { throw new ArgumentNullException("pose"); } } } [CreateAssetMenu(fileName = "NewItemDefinition", menuName = "How to Fish Item SDK/Item Definition")] public sealed class HTFItemDefinitionAsset : ScriptableObject { public const int CurrentSchemaVersion = 1; [SerializeField] [HideInInspector] private int _schemaVersion = 1; [SerializeField] [InspectorName("Internal Unique Name")] private string _internalName = "custom_item"; [SerializeField] [InspectorName("In-Game Display Name")] private string _displayName = "Custom Item"; [Header("AssetBundle Content")] [SerializeField] [InspectorName("Content Prefab")] private GameObject _contentPrefab; [SerializeField] [InspectorName("Inventory Icon")] private Texture2D _inventoryIcon; [SerializeField] [InspectorName("Hold Pose")] private HTFItemHoldPoseAsset _holdPose; [Header("Suggested Registration Settings")] [SerializeField] [Min(0.01f)] [InspectorName("Pickup Radius")] private float _pickupRadius = 0.6f; [SerializeField] [InspectorName("Buoyancy")] private float _buoyancy; public int SchemaVersion => _schemaVersion; public string InternalName => _internalName; public string DisplayName => _displayName; public GameObject ContentPrefab => _contentPrefab; public Texture2D InventoryIcon => _inventoryIcon; public HTFItemHoldPoseAsset HoldPose => _holdPose; public float PickupRadius => _pickupRadius; public float Buoyancy => _buoyancy; public bool Validate(out string error) { if (_schemaVersion != 1) { error = $"Unsupported item-definition schema {_schemaVersion}; expected {1}."; return false; } if (string.IsNullOrWhiteSpace(_internalName)) { error = "Internal name is required."; return false; } if (!Object.op_Implicit((Object)(object)_contentPrefab)) { error = "Content prefab is required."; return false; } if (!Object.op_Implicit((Object)(object)_inventoryIcon)) { error = "Inventory icon is required."; return false; } if (!Object.op_Implicit((Object)(object)_holdPose)) { error = "Hold pose is required."; return false; } if (!_holdPose.Validate(out error)) { return false; } if (_pickupRadius <= 0f || float.IsNaN(_pickupRadius) || float.IsInfinity(_pickupRadius)) { error = "Pickup radius must be a positive finite value."; return false; } error = null; return true; } private void OnValidate() { _schemaVersion = 1; _pickupRadius = Mathf.Max(0.01f, _pickupRadius); } } }