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.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using DM; using EzECS.Barriers; using HarmonyLib; using HeMoDingDingMod.ECS; using HeMoDingDingMod.unity脚本; using HeMoDingDingMod.unity脚本.检测相关类.基类; using HeMoDingDingMod.unity脚本.蠕虫类; using HeMoDingDingMod.unity脚本.补丁空间; using HeMoDingDingMod.unity脚本.补丁空间.补丁添加进; using HeMoDingDingMod.unity脚本.补丁空间.锁定胜利判断单例; using HeMoDingDingMod.我的反射; using HeMoDingDingMod.角色类.初王; using HeMoDingDingMod.角色类.幸运方块j; using HeMoDingDingMod.角色类.武装直升机; using Landfall.TABC; using Landfall.TABS; using Landfall.TABS.AI.Components; using Landfall.TABS.AI.Components.Modifiers; using Landfall.TABS.AI.Components.Tags; using Landfall.TABS.AI.Systems; using Landfall.TABS.GameMode; using Landfall.TABS.GameState; using Landfall.TABS.UnitEditor; using TFBGames; using Unity.Collections; using Unity.Entities; using Unity.Jobs; using Unity.Mathematics; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using ZhaoHuanshi.召唤类; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Mod name")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("made in SFT by FhpSlime")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3a45c3cf-230c-4310-952f-0887d4266a22")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ZhaoHuanshi.召唤类 { public enum SimulatedButtonType { Normal, Confirm, Cooldown } public class SimulatedButtonConfig { public string Key { get; set; } public string DisplayName { get; set; } public SimulatedButtonType Type { get; set; } = SimulatedButtonType.Normal; public Action OnClick { get; set; } public float CooldownSeconds { get; set; } = 1f; public string ConfirmMessage { get; set; } = "确认执行?"; } public static class 模拟按钮管理器 { private class ButtonState { public bool IsOnCooldown = false; public bool IsWaitingConfirm = false; public float LastClickTime = 0f; public SettingsInstance SettingsInstance; public SimulatedButtonConfig Config; } [CompilerGenerated] private sealed class d__16 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ButtonState state; private float 5__1; private float 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0f; 5__2 = state.Config.CooldownSeconds; UpdateButtonOptions(state, new string[2] { "冷却中...", "冷却中..." }, 0); break; case 1: <>1__state = -1; break; } if (5__1 < 5__2) { 5__1 += Time.deltaTime; if (5__1 < 5__2) { 5__3 = Mathf.CeilToInt(5__2 - 5__1); UpdateButtonOptions(state, new string[2] { $"冷却中 {5__3}s", $"冷却中 {5__3}s" }, 0); } <>2__current = null; <>1__state = 1; return true; } state.IsOnCooldown = false; UpdateButtonOptions(state, new string[2] { "点击执行", "已点击" }, 0); Debug.Log((object)("[模拟按钮管理器] 按钮 " + state.Config.Key + " 冷却结束")); 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(); } } [CompilerGenerated] private sealed class d__19 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ButtonState state; public float delay; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSecondsRealtime(delay); <>1__state = 1; return true; case 1: <>1__state = -1; ResetButtonValue(state); 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(); } } private static GlobalSettingsHandler _settingsHandler; private static Dictionary _buttonStates = new Dictionary(); private static MonoBehaviour _coroutineRunner; private static bool _isInitialized = false; public static void Initialize(MonoBehaviour coroutineRunner) { if (!_isInitialized) { _coroutineRunner = coroutineRunner; _settingsHandler = ServiceLocator.GetService(); if ((Object)(object)_settingsHandler == (Object)null) { Debug.LogError((object)"[模拟按钮管理器] 无法获取 GlobalSettingsHandler"); return; } _isInitialized = true; Debug.Log((object)"[模拟按钮管理器] 初始化成功"); } } public static void AddNormalButton(string key, string displayName, Action onClick) { SimulatedButtonConfig config = new SimulatedButtonConfig { Key = key, DisplayName = displayName, Type = SimulatedButtonType.Normal, OnClick = onClick }; AddButton(config); } public static void AddCooldownButton(string key, string displayName, Action onClick, float cooldownSeconds = 1f) { SimulatedButtonConfig config = new SimulatedButtonConfig { Key = key, DisplayName = displayName, Type = SimulatedButtonType.Cooldown, OnClick = onClick, CooldownSeconds = cooldownSeconds }; AddButton(config); } public static void AddConfirmButton(string key, string displayName, Action onClick, string confirmMessage = "确认执行?") { SimulatedButtonConfig config = new SimulatedButtonConfig { Key = key, DisplayName = displayName, Type = SimulatedButtonType.Confirm, OnClick = onClick, ConfirmMessage = confirmMessage }; AddButton(config); } public static void AddButton(SimulatedButtonConfig config) { if (!_isInitialized) { Debug.LogError((object)"[模拟按钮管理器] 未初始化,请先调用 Initialize()"); return; } try { if (_buttonStates.ContainsKey(config.Key)) { Debug.LogWarning((object)("[模拟按钮管理器] 按钮已存在: " + config.Key)); return; } ButtonState buttonState = new ButtonState { Config = config, IsOnCooldown = false, IsWaitingConfirm = false, LastClickTime = 0f }; SettingsInstance val = (buttonState.SettingsInstance = CreateButtonSettingsInstance(config)); AddToGameplaySettings(val); val.OnValueChanged += delegate(int value) { OnButtonValueChanged(config.Key, value > 0); }; _buttonStates[config.Key] = buttonState; Debug.Log((object)("[模拟按钮管理器] 成功添加按钮: " + config.DisplayName + " (" + config.Key + ")")); } catch (Exception ex) { Debug.LogError((object)("[模拟按钮管理器] 添加按钮失败: " + ex.Message)); } } private static SettingsInstance CreateButtonSettingsInstance(SimulatedButtonConfig config) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) SettingsInstance val = new SettingsInstance(); val.localizeOptions = false; val.settingsType = (SettingsType)0; val.m_settingsKey = config.Key; val.settingName = config.DisplayName; val.toolTip = GetTooltipByType(config); val.options = new string[2] { "点击执行", "已点击" }; val.defaultValue = 0; val.currentValue = 0; val.defaultSliderValue = 0f; val.currentSliderValue = 0f; val.min = 0f; val.max = 1f; return val; } private static string GetTooltipByType(SimulatedButtonConfig config) { return config.Type switch { SimulatedButtonType.Normal => "点击执行:" + config.DisplayName, SimulatedButtonType.Confirm => "点击后需要再次确认:" + config.DisplayName, SimulatedButtonType.Cooldown => $"点击执行(冷却 {config.CooldownSeconds} 秒):{config.DisplayName}", _ => "点击执行:" + config.DisplayName, }; } private static void OnButtonValueChanged(string key, bool isClicked) { if (!_buttonStates.TryGetValue(key, out var value) || !isClicked) { return; } if (value.IsOnCooldown) { Debug.Log((object)("[模拟按钮管理器] 按钮 " + key + " 正在冷却中")); ResetButtonValue(value); return; } switch (value.Config.Type) { case SimulatedButtonType.Normal: ExecuteButtonClick(value); break; case SimulatedButtonType.Confirm: HandleConfirmButton(value); break; case SimulatedButtonType.Cooldown: HandleCooldownButton(value); break; } } private static void ExecuteButtonClick(ButtonState state) { try { Debug.Log((object)("[模拟按钮管理器] 按钮被点击: " + state.Config.DisplayName)); state.Config.OnClick?.Invoke(); } catch (Exception ex) { Debug.LogError((object)("[模拟按钮管理器] 按钮执行失败: " + ex.Message)); } finally { _coroutineRunner.StartCoroutine(ResetButtonValueDelayed(state, 0.1f)); } } private static void HandleConfirmButton(ButtonState state) { if (!state.IsWaitingConfirm) { state.IsWaitingConfirm = true; UpdateButtonOptions(state, new string[2] { "确认执行?", "取消" }, 0); Debug.Log((object)("[模拟按钮管理器] 请再次点击确认: " + state.Config.DisplayName)); } else { state.IsWaitingConfirm = false; ExecuteButtonClick(state); UpdateButtonOptions(state, new string[2] { "点击执行", "已点击" }, 0); } } private static void HandleCooldownButton(ButtonState state) { state.IsOnCooldown = true; state.LastClickTime = Time.time; ExecuteButtonClick(state); _coroutineRunner.StartCoroutine(CooldownCoroutine(state)); } [IteratorStateMachine(typeof(d__16))] private static IEnumerator CooldownCoroutine(ButtonState state) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { state = state }; } private static void UpdateButtonOptions(ButtonState state, string[] options, int currentValue) { if (state.SettingsInstance != null) { state.SettingsInstance.options = options; state.SettingsInstance.currentValue = currentValue; FieldInfo field = typeof(SettingsInstance).GetField("OnValueChanged", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } } private static void ResetButtonValue(ButtonState state) { if (state.SettingsInstance != null) { typeof(SettingsInstance).GetField("currentValue", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(state.SettingsInstance, 0); } } [IteratorStateMachine(typeof(d__19))] private static IEnumerator ResetButtonValueDelayed(ButtonState state, float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__19(0) { state = state, delay = delay }; } private static void AddToGameplaySettings(SettingsInstance instance) { FieldInfo field = typeof(GlobalSettingsHandler).GetField("m_gameplaySettings", BindingFlags.Instance | BindingFlags.NonPublic); List list = ((SettingsInstance[])field.GetValue(_settingsHandler))?.ToList() ?? new List(); if (list.Any((SettingsInstance s) => s.m_settingsKey == instance.m_settingsKey)) { Debug.LogWarning((object)("[模拟按钮管理器] 设置项已存在: " + instance.m_settingsKey)); return; } list.Add(instance); field.SetValue(_settingsHandler, list.ToArray()); } public static void RemoveButton(string key) { if (_buttonStates.ContainsKey(key)) { FieldInfo field = typeof(GlobalSettingsHandler).GetField("m_gameplaySettings", BindingFlags.Instance | BindingFlags.NonPublic); List list = ((SettingsInstance[])field.GetValue(_settingsHandler))?.ToList() ?? new List(); SettingsInstance val = ((IEnumerable)list).FirstOrDefault((Func)((SettingsInstance s) => s.m_settingsKey == key)); if (val != null) { list.Remove(val); field.SetValue(_settingsHandler, list.ToArray()); } _buttonStates.Remove(key); Debug.Log((object)("[模拟按钮管理器] 已移除按钮: " + key)); } } public static void ClearAllButtons() { foreach (string item in _buttonStates.Keys.ToList()) { RemoveButton(item); } } } } namespace HeMoDingDingMod { [BepInPlugin("HeMoDingDingMod", "HeMoDingDingMod", "1.0.0")] internal class Loader : BaseUnityPlugin { [CompilerGenerated] private sealed class d__1 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Loader <>4__this; private GameObject 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; UManager.Init(); 5__1 = new GameObject("HeMoDingdingDanli"); Object.DontDestroyOnLoad((Object)(object)5__1); 5__1.AddComponent<添加自定义内容>(); Debug.Log((object)"黑莫丁丁mod已加载完毕"); <>2__current = (object)new WaitUntil((Func)(() => (Object)(object)Object.FindObjectOfType() != (Object)null)); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitUntil((Func)(() => ServiceLocator.GetService() != null)); <>1__state = 2; return true; case 2: <>1__state = -1; UManager.音库合并方法(); 多国语言部分333.添加语言(); 幸运方块加载类.更新列表(); 幸运方块加载类.更新爆炸对象列表(); 幸运方块加载类.更新效果对象列表(); 添加设置按钮.Initialize(); 模拟按钮管理器.Initialize((MonoBehaviour)(object)<>4__this); 模拟按钮管理器.AddNormalButton("幸运方块刷新所有单位列表", "[幸运方块] 刷新所有单位列表", delegate { Debug.Log((object)"刷新列表!!"); 幸运方块加载类.更新列表(); }); 模拟按钮管理器.AddNormalButton("幸运方块刷新爆炸物列表和效果列表", "[幸运方块] ", delegate { Debug.Log((object)"刷新列表!!"); 幸运方块加载类.更新爆炸对象列表(); 幸运方块加载类.更新效果对象列表(); }); 添加设置按钮.AddToggle("单位测试模式", "[黑莫丁丁] 特色功能", HeMoDingDing游戏模式单例.Instance.IsLocked, delegate(bool isEnabled) { if (isEnabled) { HeMoDingDing游戏模式单例.Instance.Lock(); } else { HeMoDingDing游戏模式单例.Instance.Unlock(); } Debug.Log((object)("沉浸式模式" + (isEnabled ? "启用" : "禁用"))); }); 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(); } } private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"黑莫丁丁补丁注入中..."); Harmony val = new Harmony("HeMoDingDingMod"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"黑莫丁丁补丁注入完成!"); ((MonoBehaviour)this).StartCoroutine(call()); } [IteratorStateMachine(typeof(d__1))] private IEnumerator call() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0) { <>4__this = this }; } } public static class UManager { public enum 对象类 { 单位模型, 武器, 技能, 服饰, 抛射物 } public static string modname = "HeMoDingDingMod"; public static AssetBundle ab包; public static List 编辑器单位基础 = new List(); public static int MYmodid = 228472303; public static int MYmodunitid = 62847203; public static void 音库合并方法() { SoundPlayer service = ServiceLocator.GetService(); if ((Object)(object)service == (Object)null) { Debug.LogError((object)"无法获取SoundPlayer服务"); ab包.Unload(false); return; } SoundBank soundBank = service.soundBank; if ((Object)(object)soundBank == (Object)null) { Debug.LogError((object)"SoundPlayer中的soundBank为空"); ab包.Unload(false); return; } SoundBank[] array = ab包.LoadAllAssets(); if (array != null && array.Length != 0) { List list = soundBank.Categories?.ToList() ?? new List(); SoundBank[] array2 = array; foreach (SoundBank val in array2) { if ((Object)(object)val != (Object)null && val.Categories != null) { list.AddRange(val.Categories); Debug.Log((object)$"已合并SoundBank: {((Object)val).name}, 类别数: {val.Categories.Length}"); } else if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"遇到空的SoundBank引用,已跳过"); } else { Debug.LogWarning((object)("SoundBank " + ((Object)val).name + " 的Categories为空")); } } soundBank.Categories = list.ToArray(); Debug.Log((object)$"SoundBank合并完成,总类别数: {list.Count}"); } else { Debug.LogWarning((object)"主AssetBundle中没有找到任何SoundBank"); } } public static void Init() { //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_07bf: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_080d: Unknown result type (might be due to invalid IL or missing references) //IL_08c6: Unknown result type (might be due to invalid IL or missing references) //IL_090c: Unknown result type (might be due to invalid IL or missing references) //IL_0a3a: Unknown result type (might be due to invalid IL or missing references) //IL_0b0a: Unknown result type (might be due to invalid IL or missing references) //IL_0b89: Unknown result type (might be due to invalid IL or missing references) //IL_0d95: Unknown result type (might be due to invalid IL or missing references) //IL_0df4: Unknown result type (might be due to invalid IL or missing references) //IL_0e07: Unknown result type (might be due to invalid IL or missing references) //IL_0e1a: Unknown result type (might be due to invalid IL or missing references) //IL_0e2d: Unknown result type (might be due to invalid IL or missing references) //IL_0e99: Unknown result type (might be due to invalid IL or missing references) //IL_0eca: Unknown result type (might be due to invalid IL or missing references) //IL_114a: Unknown result type (might be due to invalid IL or missing references) //IL_1150: Unknown result type (might be due to invalid IL or missing references) //IL_1187: Unknown result type (might be due to invalid IL or missing references) //IL_1291: Unknown result type (might be due to invalid IL or missing references) //IL_12cd: Unknown result type (might be due to invalid IL or missing references) //IL_12d3: Unknown result type (might be due to invalid IL or missing references) //IL_1306: Unknown result type (might be due to invalid IL or missing references) //IL_131e: Unknown result type (might be due to invalid IL or missing references) //IL_1336: Unknown result type (might be due to invalid IL or missing references) //IL_134e: Unknown result type (might be due to invalid IL or missing references) //IL_1381: Unknown result type (might be due to invalid IL or missing references) //IL_1393: Unknown result type (might be due to invalid IL or missing references) //IL_13d0: Unknown result type (might be due to invalid IL or missing references) //IL_1453: Unknown result type (might be due to invalid IL or missing references) //IL_1598: Unknown result type (might be due to invalid IL or missing references) //IL_159e: Unknown result type (might be due to invalid IL or missing references) //IL_1632: Unknown result type (might be due to invalid IL or missing references) Assembly executingAssembly = Assembly.GetExecutingAssembly(); Stream manifestResourceStream = executingAssembly.GetManifestResourceStream("HeMoDingDingMod.hemodingdongsass"); AssetBundle val = (ab包 = AssetBundle.LoadFromStream(manifestResourceStream)); Material[] array = val.LoadAllAssets(); if (array == null || array.Length == 0) { Debug.LogWarning((object)"主AssetBundle中没有找到任何材质"); } else { Material[] array2 = array; foreach (Material val2 in array2) { if ((Object)(object)val2 == (Object)null) { Debug.LogWarning((object)"遇到空的材质引用,已跳过"); continue; } if ((Object)(object)val2.shader == (Object)null) { Debug.LogWarning((object)("材质 " + ((Object)val2).name + " 的Shader为空,无法修复")); continue; } Shader val3 = Shader.Find(((Object)val2.shader).name); if ((Object)(object)val3 != (Object)null) { val2.shader = val3; Debug.Log((object)("修复材质: " + ((Object)val2).name + ", Shader: " + ((Object)val3).name)); } else { Debug.LogWarning((object)("找不到Shader: " + ((Object)val2.shader).name + ", 材质: " + ((Object)val2).name)); } } } Faction val4 = 游戏内容工具.创建派系("UNIT_KONGBUSHENGWU", null, val.LoadAsset("恐怖生物派系dsadsicon"), -4, 49582393); GameObject val5 = 游戏内容工具.注册单位Base(val.LoadAsset("世界吞噬者模型")); val5.GetComponentInChildren<平滑蠕虫跟随>().节间距 = 2f; val5.GetComponentInChildren<平滑蠕虫跟随>().最大允许距离倍数 = 0.9f; val5.GetComponentInChildren<吞噬者移动类>().巡游时间 = 7f; val5.GetComponentInChildren<吞噬者移动类>().转向速度 = 80f; UnitBlueprint val6 = 游戏内容工具.复制单位("UNIT_SHIJIETUNSHIZHE", 游戏内容工具.获取原版单位蓝图(new DatabaseID(-1, 1166250463)), val4, val.LoadAsset("世界吞噬者dsfk"), (DatabaseID?)new DatabaseID(-3, 350452348)); val6.UnitBase = val5; val6.sizeMultiplier = 0.8f; val6.health = 599f; val6.forceCost = 4800u; val6.SetUnitSounds("Secret Attack Vocals/Raptor", "Secret Death Vocals/Raptor", 0.6f); UnitBlueprint val7 = 游戏内容工具.复制单位("世界吞噬者基础蓝图", 游戏内容工具.获取原版单位蓝图(new DatabaseID(-1, 1166250463)), (Faction)null, val.LoadAsset("世界吞噬者dsfk"), (DatabaseID?)new DatabaseID(-3, 345363465)); val7.UnitBase = val5; 编辑器单位基础.Add(val7); 游戏内容工具.注册道具(游戏物品加入.Instance.创建物品("调整身体体节连接", val.LoadAsset("空服饰3453"), new DatabaseID(-3, 176742343))).AddComponent<蠕虫服饰调整>(); 游戏内容工具.注册道具(游戏物品加入.Instance.创建物品("调整蠕虫移动属性", val.LoadAsset("空服饰3453"), new DatabaseID(-3, 176742344))).AddComponent<蠕虫服饰调整2>(); 游戏内容工具.注册道具(游戏物品加入.Instance.创建物品("调整蠕虫移动属性2", val.LoadAsset("空服饰3453"), new DatabaseID(-3, 176742345))).AddComponent<蠕虫服饰调整3>(); UnitBlueprint val8 = 游戏内容工具.复制单位("UNIT_HEIJIABUBUSIZHAN", (UnitBlueprint)null, val4, val.LoadAsset("玛丽卡死icon"), (DatabaseID?)new DatabaseID(-3, 312534211)); val8.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[0]; val8.health = 9000f; val8.massMultiplier = 20f; GameObject rightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("黑剑23243"), 对象类.武器); val8.RightWeapon = rightWeapon; val8.m_props = (GameObject[])(object)new GameObject[11] { 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯后披风"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯大腿护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯大臂护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯头盔"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯小腿护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯小臂护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯护膝"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯肩膀护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯胸甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯腰部护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("玛利喀斯鞋子"), 对象类.服饰) }; GameObject val9 = 游戏内容工具.注册单位Base(游戏物品加入.Instance.创建物品("灰色人物模型", 获取工具.获取原版内容游戏物品("m_unitBases", new DatabaseID(-1, 1760500345)), new DatabaseID(-3, 13972330))); TeamColor[] componentsInChildren = val9.GetComponentsInChildren(); for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].blueMaterial = val.LoadAsset("低反射灰色12"); componentsInChildren[j].redMaterial = val.LoadAsset("低反射灰色12"); } val8.UnitBase = val9; val8.forceCost = 10000u; val8.SetUnitSounds("Reinassance Attack Vocals/Jouster", "Reinassance Attack Vocals/Jouster", 0.4f); UnitBlueprint val10 = 游戏内容工具.复制单位("UNIT_YILIUTI", (UnitBlueprint)null, val4, val.LoadAsset("遗留着uu"), (DatabaseID?)new DatabaseID(-3, 312534212)); val10.forceCost = 120u; val10.m_props = (GameObject[])(object)new GameObject[7] { 注册创建游戏对象自动id分配(val.LoadAsset("死亡剑士上衣"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("死亡剑士大臂套"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("死亡剑士头部插件"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("死亡剑士小臂刺"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("死亡剑士躯干装饰剑"), 对象类.服饰), 获取工具.获取原版内容游戏物品("m_characterProps", new DatabaseID(-1, 1944888562)), 获取工具.获取原版内容游戏物品("m_characterProps", new DatabaseID(-1, 273394296)) }; val10.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("死亡剑士刀剑"), 对象类.武器); val10.health = 20f; val10.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { 注册创建游戏对象自动id分配(val.LoadAsset("cd瞬移技能")) }; val10.UnitBase = 获取工具.获取原版内容游戏物品("m_unitBases", new DatabaseID(-1, 1288909650)); val10.SetUnitSounds("Reinassance Attack Vocals/Halberd", "Reinassance Death Vocals/Halberd", 0.5f); UnitBlueprint val11 = 游戏内容工具.复制单位("UNIT_KUANGBAOZHADANREN", (UnitBlueprint)null, val4, val.LoadAsset("精神病人32213"), (DatabaseID?)new DatabaseID(-3, 312534213)); val11.sizeMultiplier = 1f; val11.health = 70f; val11.forceCost = 350u; val11.m_props = (GameObject[])(object)new GameObject[6] { 注册创建游戏对象自动id分配(val.LoadAsset("爆破鬼才左腿装饰"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("爆破鬼才的夹克"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("爆破鬼才的脑袋"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("爆破鬼才的连体服饰"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("爆破鬼才背包342"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("爆破鬼才的轮子腰带"), 对象类.服饰) }; val11.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("扔炸弹34"), 对象类.武器); val11.LeftWeapon = val11.RightWeapon; 注册创建游戏对象自动id分配(val.LoadAsset("大小炸弹34"), 对象类.抛射物); val11.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { 注册创建游戏对象自动id分配(val.LoadAsset("桶装爆破进243")) }; val11.MovementComponents = new List { (IMovementComponent)(object)default(NeverStopRunning) }; val11.SetUnitSounds("Western Attack Vocals/Quickdraw", "Western Death Vocals/Quickdraw", 1.5f); UnitBlueprint val12 = 游戏内容工具.复制单位("UNIT_JUEXINGSHUBING", (UnitBlueprint)null, val4, val.LoadAsset("觉醒骷髅兵3we"), (DatabaseID?)new DatabaseID(-3, 312534214)); val12.sizeMultiplier = 0.7f; val12.health = 200f; val12.forceCost = 500u; val12.m_props = (GameObject[])(object)new GameObject[4] { 注册创建游戏对象自动id分配(val.LoadAsset("觉醒骷髅大褂"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("觉醒骷髅帽子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("觉醒骷髅裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("觉醒骷髅鞋子"), 对象类.服饰) }; val12.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("觉醒骷髅复制剑"), 对象类.武器); val12.UnitBase = 获取工具.获取原版内容游戏物品("m_unitBases", new DatabaseID(-1, 1288909650)); val12.SetUnitSounds("Halloween Attack Vocals/SkeletonWarrior", "Halloween Death Vocals/SkeletonWarrior", 0.95f); UnitBlueprint val13 = 游戏内容工具.复制单位("UNIT_YONGYEQIANXINGZHE", (UnitBlueprint)null, val4, val.LoadAsset("幻影刺客sdkfhj"), (DatabaseID?)new DatabaseID(-3, 332534267)); val13.health = 900f; val13.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[2] { 注册创建游戏对象自动id分配(val.LoadAsset("体积雾技能")), 注册创建游戏对象自动id分配(val.LoadAsset("暗影刺客瞬移技能")) }; val13.m_props = (GameObject[])(object)new GameObject[5] { 注册创建游戏对象自动id分配(val.LoadAsset("暗影刺客上衣"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("暗影刺客头发"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("暗影刺客意义不明的手臂套子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("暗影刺客裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("暗影刺客鞋子"), 对象类.服饰) }; val13.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("暗影刺客武器"), 对象类.武器); val13.LeftWeapon = val13.RightWeapon; val13.forceCost = 1500u; val13.SetUnitSounds("Fantasy Dark Attack Vocals/FantasyAssassin", "Fantasy Dark Death Vocals/FantasyAssassin", 0.95f); UnitBlueprint val14 = 游戏内容工具.复制单位("UNIT_SHIluoTANXIANJIA", (UnitBlueprint)null, val4, val.LoadAsset("失落冒险家43rdsf"), (DatabaseID?)new DatabaseID(-3, 332534268)); val14.sizeMultiplier = 1.5f; val14.health = 1400f; val14.massMultiplier = 20f; val14.m_props = (GameObject[])(object)new GameObject[6] { 注册创建游戏对象自动id分配(val.LoadAsset("迷雾行者上衣"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("迷雾行者外套"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("迷雾行者头盔和头发"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("迷雾行者披风"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("迷雾行者裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("迷雾行者鞋子"), 对象类.服饰) }; val14.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { 获取工具.获取原版内容游戏物品("m_combatMoves", new DatabaseID(-1, 920020464)) }; val14.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("十字巨剑3434"), 对象类.武器); val14.holdinigWithTwoHands = true; val14.movementSpeedMuiltiplier = 1.8f; val14.forceCost = 3700u; val14.SetUnitSounds("Fantasy Dark Attack Vocals/StormPriest", "Fantasy Dark Death Vocals/StormPriest", 0.85f); UnitBlueprint val15 = 游戏内容工具.复制单位("UNIT_ZHONGXINGJUNCHUANQIANGQBING", (UnitBlueprint)null, val4, val.LoadAsset("重装步兵daskfn"), (DatabaseID?)new DatabaseID(-3, 332534269)); val15.health = 3000f; val15.sizeMultiplier = 1.7f; val15.massMultiplier = 30f; val15.m_props = (GameObject[])(object)new GameObject[12] { 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵上板甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵下体板甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵前挡"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵大腿护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵大臂护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵头盔"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵护手"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵护膝刺甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵护颈"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵板甲裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵羊角护臂"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("重装亡灵鞋子"), 对象类.服饰) }; GameObject val16 = 注册创建游戏对象自动id分配(val.LoadAsset("空技能3434")); val16.AddComponent<重装亡灵抛射物免疫添加工具>(); val15.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { val16 }; val15.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("戳矛23"), 对象类.武器); val15.LeftWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("石头盾牌345"), 对象类.武器); val15.MovementComponents = new List { (IMovementComponent)(object)default(重装亡灵后撤步) }; val15.forceCost = 8000u; val15.SetUnitSounds("Pirate Attack Vocals/Cannon", "Pirate Attack Vocals/Cannon", 0.85f); GameObject unitBase = 注册创建游戏对象自动id分配(val.LoadAsset("单位模型直升机23"), 对象类.单位模型); UnitBlueprint val17 = 游戏内容工具.复制单位("UNIT_WUZHUANGZHISHENGJI", (UnitBlueprint)null, (Faction)null, val.LoadAsset("生成武装直升机图标"), (DatabaseID?)new DatabaseID(-3, 332534270)); val17.UnitBase = unitBase; val17.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("直升机机炮sad"), 对象类.武器); val17.LeftWeapon = val17.RightWeapon; val17.massMultiplier = 100f; val17.SetRiders((UnitBlueprint[])(object)new UnitBlueprint[4] { 游戏内容工具.获取原版单位蓝图(new DatabaseID(-1, 1885243923)), 游戏内容工具.获取原版单位蓝图(new DatabaseID(-1, 1885243923)), 游戏内容工具.获取原版单位蓝图(new DatabaseID(-1, 1885243923)), 游戏内容工具.获取原版单位蓝图(new DatabaseID(-1, 1885243923)) }); val17.forceCost = 6000u; GameObject val18 = 注册创建游戏对象自动id分配(val.LoadAsset("空技能3434")); val18.AddComponent<直升机抗性添加工具>(); val17.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { val18 }; val17.SetUnitSounds("Legacy Attack Vocals/Tank", "Legacy Attack Vocals/Tank"); Faction 指定派系 = 游戏内容工具.获取原版派系(new DatabaseID(-1, 673578412)); 添加单位到指定派系(val17, 指定派系, 自动排序: true, 去重: true); UnitBlueprint val19 = 游戏内容工具.复制单位("UNIT_AERDENGZHINAGEFULEI", (UnitBlueprint)null, (Faction)null, val.LoadAsset("葛孚雷图标32"), (DatabaseID?)new DatabaseID(-3, 332534271)); val19.health = 1500f; val19.massMultiplier = 12f; val19.movementSpeedMuiltiplier = 1.8f; GameObject[] first = (GameObject[])(object)new GameObject[6] { 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—上衣"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—护肘"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—肩甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—躯干护甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—披风"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—狮子宰相"), 对象类.服饰) }; GameObject[] array3 = (GameObject[])(object)new GameObject[12] { 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—下把胡子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—前摆"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—右摆"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—后摆"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—头发"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—左摆"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—无骨骼胡子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—毛发挂件"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—皇冠"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—腰部系绳"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("初王服饰—鞋子"), 对象类.服饰) }; val19.m_props = first.Concat(array3).ToArray(); val19.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("初王武器dsfj"), 对象类.武器); val19.holdinigWithTwoHands = true; GameObject unitBase2 = (val19.UnitBase = 注册创建游戏对象自动id分配(val.LoadAsset("强壮的人形单位"), 对象类.单位模型)); val19.sizeMultiplier = 1.8f; GameObject val21 = 注册创建游戏对象自动id分配(val.LoadAsset("半血升级技能")); GameObject val22 = 注册创建游戏对象自动id分配(val.LoadAsset("葛孚雷死亡二阶段")); val19.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[4] { 注册创建游戏对象自动id分配(val.LoadAsset("初王冲刺践踏")), 注册创建游戏对象自动id分配(val.LoadAsset("向下砸斧子asd")), val21, val22 }; val19.MovementComponents = new List { (IMovementComponent)(object)default(KeepRangedDistance) }; val19.forceCost = 6000u; UnitBlueprint val23 = 游戏内容工具.复制单位("战士何来露", (UnitBlueprint)null, (Faction)null, val.LoadAsset("葛孚雷图标32"), (DatabaseID?)new DatabaseID(-3, 332534272)); val23.UnitBase = unitBase2; val23.health = 1000f; val23.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[3] { 注册创建游戏对象自动id分配(val.LoadAsset("何来露投技")), 注册创建游戏对象自动id分配(val.LoadAsset("何来露掀地板23")), val21 }; val23.m_props = array3; val23.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("何来露拳头245"), 对象类.武器); val23.LeftWeapon = val23.RightWeapon; val23.sizeMultiplier = 1.8f; val23.movementSpeedMuiltiplier = 3f; val22.GetComponent<死亡后进入2阶段>().二阶段单位蓝图 = val23; val19.SetUnitSounds("Viking Attack Vocals/Jarl", "Viking Attack Vocals/Jarl", 0.7f); val23.SetUnitSounds("Viking Attack Vocals/Jarl", "Viking Attack Vocals/Jarl", 0.7f); UnitBlueprint val24 = 游戏内容工具.复制单位("UNIT_SHUXUELAOSHI", (UnitBlueprint)null, (Faction)null, val.LoadAsset("数学老师图标32"), (DatabaseID?)new DatabaseID(-3, 332534273)); val24.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("数学家之力sdakfh"), 对象类.武器); val24.holdinigWithTwoHands = true; val24.MovementComponents = new List { (IMovementComponent)(object)default(KeepRangedDistance) }; val24.forceCost = 600u; val24.m_props = (GameObject[])(object)new GameObject[4] { 获取工具.获取原版内容游戏物品("m_characterProps", new DatabaseID(-1, 789074667)), 获取工具.获取原版内容游戏物品("m_characterProps", new DatabaseID(-1, 1515039722)), 获取工具.获取原版内容游戏物品("m_characterProps", new DatabaseID(-1, 1263832372)), 获取工具.获取原版内容游戏物品("m_characterProps", new DatabaseID(-1, 1012097602)) }; val24.SetUnitSounds("Misc Attack Vocals/Crow", "Misc Attack Vocals/Crow"); Faction 指定派系2 = 游戏内容工具.获取原版派系(new DatabaseID(-1, 442148333)); Faction 指定派系3 = 游戏内容工具.获取原版派系(new DatabaseID(-1, 1701001489)); 添加单位到指定派系(val19, 指定派系2, 自动排序: true, 去重: true); 添加单位到指定派系(val24, 指定派系3, 自动排序: true, 去重: true); UnitBlueprint val25 = 游戏内容工具.复制单位("UNIT_XINGYUNFANGKUAI", (UnitBlueprint)null, (Faction)null, val.LoadAsset("幸运方块图标123"), (DatabaseID?)new DatabaseID(-3, 332534274)); val25.UnitBase = 注册创建游戏对象自动id分配(val.LoadAsset("幸运方块模型"), 对象类.单位模型); val25.forceCost = 650u; val25.health = 100f; val25.SetUnitSounds("Misc Attack Vocals/Crow", "Misc Attack Vocals/Crow"); 添加单位到指定派系(val25, 指定派系, 自动排序: true, 去重: true); UnitBlueprint val26 = 游戏内容工具.复制单位("UNIT_XINGUIREN", (UnitBlueprint)null, (Faction)null, val.LoadAsset("基兰图标asl1"), (DatabaseID?)new DatabaseID(-3, 332534275)); val26.m_props = (GameObject[])(object)new GameObject[12] { 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--上衣"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--前挡"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--头发"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--肩甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--胡子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--胸甲"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--腰部后披风"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--腰部系绳"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--面具"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--鞋子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("基兰服饰--魔法圆盘"), 对象类.服饰) }; val26.RightWeapon = 注册创建游戏对象自动id分配(val.LoadAsset("时间老头武器23"), 对象类.武器); val26.LeftWeapon = val26.RightWeapon; val26.MovementComponents = new List { (IMovementComponent)(object)default(KeepRangedDistance) }; val26.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[2] { 注册创建游戏对象自动id分配(val.LoadAsset("在目标出召唤时钟")), 注册创建游戏对象自动id分配(val.LoadAsset("给予高价值单位复活效果")) }; val26.forceCost = 3000u; val26.SetUnitSounds("Misc Attack Vocals/Crow", "Misc Attack Vocals/Crow"); 添加单位到指定派系(val26, 指定派系, 自动排序: true, 去重: true); UnitBlueprint val27 = 游戏内容工具.复制单位("UNIT_SHETI", (UnitBlueprint)null, (Faction)null, val.LoadAsset("瑟提图标asdas"), (DatabaseID?)new DatabaseID(-3, 332534276)); val27.UnitBase = 注册创建游戏对象自动id分配(val.LoadAsset("强壮人形单位带肌肉版本"), 对象类.单位模型); val27.m_props = (GameObject[])(object)new GameObject[9] { 注册创建游戏对象自动id分配(val.LoadAsset("瑟提服饰_上衣"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("瑟提服饰_发型"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("瑟提服饰_手套"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("瑟提服饰_腰带"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("瑟提服饰_裤子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("瑟提服饰_鞋子"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("瑟提服饰_龙头装饰"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("瑟提服饰_肩部皮毛"), 对象类.服饰), 注册创建游戏对象自动id分配(val.LoadAsset("瑟提服饰_豪意值附体"), 对象类.服饰) }; val27.health = 3000f; val27.massMultiplier = 20f; val27.forceCost = 7000u; val27.movementSpeedMuiltiplier = 1.8f; val27.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[4] { 注册创建游戏对象自动id分配(val.LoadAsset("腕豪技能_强手裂颅")), 注册创建游戏对象自动id分配(val.LoadAsset("腕豪技能_叹为观止")), 注册创建游戏对象自动id分配(val.LoadAsset("腕豪技能_豪意值系统")), 注册创建游戏对象自动id分配(val.LoadAsset("腕豪技能_蓄意轰拳")) }; GameObject val28 = 注册创建游戏对象自动id分配(val.LoadAsset("瑟提拳头与中"), 对象类.武器); val28.GetComponent().curveForce = 150000f; val27.RightWeapon = val28; val27.LeftWeapon = val27.RightWeapon; val27.SetUnitSounds("Misc Attack Vocals/Crow", "Misc Attack Vocals/Crow"); 添加单位到指定派系(val27, 指定派系, 自动排序: true, 去重: true); List list = new List(); UnitBlueprint[] units = val4.Units; foreach (UnitBlueprint item in units) { list.Add(item); } list.Sort((UnitBlueprint unit1, UnitBlueprint unit2) => unit1.GetUnitCost(true).CompareTo(unit2.GetUnitCost(true))); val4.Units = list.ToArray(); } public static GameObject 注册创建游戏对象自动id分配(GameObject 对象, 对象类 类型 = 对象类.技能) { //IL_001d: 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_00a1: 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_0126: Unknown result type (might be due to invalid IL or missing references) switch (类型) { case 对象类.技能: { GameObject result5 = 游戏内容工具.注册能力(游戏物品加入.Instance.创建物品(((Object)对象).name, 对象, new DatabaseID(-3, MYmodid))); MYmodid++; return result5; } case 对象类.服饰: { GameObject result4 = 游戏内容工具.注册道具(游戏物品加入.Instance.创建物品(((Object)对象).name, 对象, new DatabaseID(-3, MYmodid))); MYmodid++; return result4; } case 对象类.抛射物: { GameObject result3 = 游戏内容工具.注册投射物(游戏物品加入.Instance.创建物品(((Object)对象).name, 对象, new DatabaseID(-3, MYmodid))); MYmodid++; return result3; } case 对象类.单位模型: { GameObject result2 = 游戏内容工具.注册单位Base(游戏物品加入.Instance.创建物品(((Object)对象).name, 对象, new DatabaseID(-3, MYmodid))); MYmodid++; return result2; } case 对象类.武器: { GameObject result = 游戏内容工具.注册武器(游戏物品加入.Instance.创建物品(((Object)对象).name, 对象, new DatabaseID(-3, MYmodid))); MYmodid++; return result; } default: return null; } } public static void 添加单位到指定派系(UnitBlueprint[] 指定的所有单位, Faction 指定派系, bool 自动排序 = false, bool 去重 = false) { if (指定的所有单位 == null || 指定的所有单位.Length == 0) { return; } List list = new List(); if (指定派系.Units != null) { list.AddRange(指定派系.Units); } list.AddRange(指定的所有单位); if (去重) { list = (from unit in list where ((unit != null) ? unit.Entity : null) != null group unit by unit.Entity.GUID into @group select @group.First()).ToList(); } if (自动排序) { list.Sort((UnitBlueprint unit1, UnitBlueprint unit2) => unit1.GetUnitCost(true).CompareTo(unit2.GetUnitCost(true))); } 指定派系.Units = list.ToArray(); } public static void 添加单位到指定派系(UnitBlueprint 指定单位, Faction 指定派系, bool 自动排序 = false, bool 去重 = false) { if (!((Object)(object)指定单位 == (Object)null)) { 添加单位到指定派系((UnitBlueprint[])(object)new UnitBlueprint[1] { 指定单位 }, 指定派系, 自动排序, 去重); } } } public class 游戏物品加入 { private GameObject 物品对象池; private static 游戏物品加入 _instance; public static 游戏物品加入 Instance { get { if (_instance == null) { _instance = new 游戏物品加入(); } return _instance; } } private 游戏物品加入() { //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_0027: Expected O, but got Unknown Debug.Log((object)"开始创建对象池"); 物品对象池 = new GameObject { hideFlags = (HideFlags)61 }; ((Object)物品对象池).name = "HeMoDingDingObject"; 物品对象池.SetActive(false); Debug.Log((object)"对象池创建完毕"); } public GameObject 创建物品(string 名字, GameObject 要复制的物体, DatabaseID 物体标识, Sprite icon = null) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"开始创建物品"); GameObject val = Object.Instantiate(要复制的物体, 物品对象池.transform); ((Object)val).hideFlags = (HideFlags)52; SetHideFlagsRecursive(val, (HideFlags)52); ((Object)val).name = 名字 + Assembly.GetCallingAssembly().GetName().Name; IDatabaseEntity componentInChildren = val.GetComponentInChildren(); if (componentInChildren != null) { CharacterItem val2 = (CharacterItem)(object)((componentInChildren is CharacterItem) ? componentInChildren : null); componentInChildren.Entity.GUID = 物体标识; componentInChildren.Entity.Name = 名字; if ((Object)(object)icon != (Object)null) { componentInChildren.Entity.SpriteIcon = icon; } } Debug.Log((object)("物品创建完毕" + ((Object)val).name)); return val; } private void SetHideFlagsRecursive(GameObject obj, HideFlags flags) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)obj == (Object)null) { return; } ((Object)obj).hideFlags = flags; foreach (Transform item in obj.transform) { Transform val = item; if ((Object)(object)val != (Object)null) { SetHideFlagsRecursive(((Component)val).gameObject, flags); } } } } public static class 游戏内容工具 { private static LandfallContentDatabase 内容数据库 => ContentDatabase.Instance().LandfallContentDatabase; private static AssetLoader 资源加载器 => ContentDatabase.Instance().AssetLoader; private static Dictionary 非流式资源字典 => (Dictionary)(typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(资源加载器)); public static GameObject 注册单位Base(GameObject 单位基础) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return 注册游戏对象到数据库(单位基础, 单位基础.GetComponent().Entity.GUID, "m_unitBases", (GameObject db) => db.GetComponent().Entity.GUID); } public static GameObject 注册武器(GameObject 武器对象) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return 注册游戏对象到数据库(武器对象, ((CharacterItem)武器对象.GetComponent()).Entity.GUID, "m_weapons", (GameObject obj) => ((CharacterItem)obj.GetComponent()).Entity.GUID); } public static GameObject 注册能力(GameObject 能力对象) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return 注册游戏对象到数据库(能力对象, ((CharacterItem)能力对象.GetComponent()).Entity.GUID, "m_combatMoves", (GameObject obj) => ((CharacterItem)obj.GetComponent()).Entity.GUID); } public static GameObject 注册投射物(GameObject 投射物对象) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return 注册游戏对象到数据库(投射物对象, 投射物对象.GetComponent().Entity.GUID, "m_projectiles", (GameObject obj) => obj.GetComponent().Entity.GUID); } public static GameObject 注册道具(GameObject 道具对象) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return 注册游戏对象到数据库(道具对象, ((CharacterItem)道具对象.GetComponent()).Entity.GUID, "m_characterProps", (GameObject obj) => ((CharacterItem)obj.GetComponent()).Entity.GUID); } private static GameObject 注册游戏对象到数据库(GameObject 游戏对象, DatabaseID 对象ID, string 数据库字段名, Func 获取ID函数) { //IL_0009: 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_0025: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = 获取字典(数据库字段名); if (!dictionary.ContainsKey(对象ID)) { dictionary.Add(对象ID, 游戏对象); 非流式资源字典.Add(对象ID, (Object)(object)游戏对象); 设置字典值(数据库字段名, dictionary); } return 游戏对象; } public static UnitBlueprint 获取原版单位蓝图(DatabaseID id) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = 获取字典("m_unitBlueprints"); UnitBlueprint value; return dictionary.TryGetValue(id, out value) ? value : null; } public static Faction 获取原版派系(DatabaseID id) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = 获取字典("m_factions"); Faction value; return dictionary.TryGetValue(id, out value) ? value : null; } public static UnitBlueprint 复制单位(string 名称, UnitBlueprint 源单位蓝图 = null, Faction 所属派系 = null, Sprite 图标 = null, DatabaseID? 自定义ID = null) { //IL_0013: 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_0064: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)源单位蓝图 == (Object)null) { 源单位蓝图 = 获取原版单位蓝图(new DatabaseID(-1, 1166250463)); } if ((Object)(object)源单位蓝图 == (Object)null) { Debug.LogError((object)"无法获取源单位蓝图"); return null; } Debug.LogWarning((object)"开始创建蓝图"); UnitBlueprint val = Object.Instantiate(源单位蓝图); val.Entity.GUID = (DatabaseID)(((??)自定义ID) ?? DatabaseID.NewID()); val.Entity.Name = 名称; ((Object)val).name = 名称; if ((Object)(object)图标 != (Object)null) { val.Entity.SpriteIcon = 图标; } Debug.LogWarning((object)"完成蓝图创建并指定ID"); Dictionary dictionary = 获取字典("m_unitBlueprints"); if (!dictionary.ContainsKey(val.Entity.GUID)) { 非流式资源字典.Add(val.Entity.GUID, (Object)(object)val); dictionary.Add(val.Entity.GUID, val); 设置字典值("m_unitBlueprints", dictionary); Debug.LogWarning((object)"成功添加到数据库"); } if ((Object)(object)所属派系 != (Object)null && (Object)(object)val != (Object)null) { List list = 所属派系.Units?.ToList() ?? new List(); if (!list.Contains(val)) { list.Add(val); 所属派系.Units = list.ToArray(); } } return val; } public static Faction 创建派系(string 名称, UnitBlueprint[] 单位列表 = null, Sprite 图标 = null, int 模组ID = 0, int 派系ID = 0) { //IL_001b: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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) Faction val = ScriptableObject.CreateInstance(); val.Init(); val.Entity.GUID = (DatabaseID)((模组ID != 0 && 派系ID != 0) ? new DatabaseID(模组ID, 派系ID) : DatabaseID.NewID()); val.Entity.Name = 名称; ((Object)val).name = 名称; val.Units = (UnitBlueprint[])(((object)单位列表) ?? ((object)new UnitBlueprint[0])); if ((Object)(object)图标 != (Object)null) { val.Entity.SpriteIcon = 图标; } Dictionary dictionary = 获取字典("m_factions"); if (!dictionary.ContainsKey(val.Entity.GUID)) { 非流式资源字典.Add(val.Entity.GUID, (Object)(object)val); dictionary.Add(val.Entity.GUID, val); List list = 获取默认快捷栏派系ID列表(); if (!list.Contains(val.Entity.GUID)) { list.Add(val.Entity.GUID); 排序并设置默认快捷栏列表(list, dictionary); } 设置字典值("m_factions", dictionary); } return val; } private static Dictionary 获取字典(string 字段名) where T : Object { return (Dictionary)(typeof(LandfallContentDatabase).GetField(字段名, BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(内容数据库)); } private static void 设置字典值(string 字段名, Dictionary 字典) where T : Object { typeof(LandfallContentDatabase).GetField(字段名, BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(内容数据库, 字典); } private static List 获取默认快捷栏派系ID列表() { return (List)(typeof(LandfallContentDatabase).GetField("m_defaultHotbarFactionIds", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(内容数据库)); } private static void 排序并设置默认快捷栏列表(List 列表, Dictionary 派系字典) { Faction value2; List value = 列表.OrderBy((DatabaseID id) => 派系字典.TryGetValue(id, out value2) ? value2.index : int.MaxValue).ToList(); typeof(LandfallContentDatabase).GetField("m_defaultHotbarFactionIds", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(内容数据库, value); } } public static class 获取工具 { private static LandfallContentDatabase 内容数据库 => ContentDatabase.Instance().LandfallContentDatabase; private static AssetLoader 资源加载器 => ContentDatabase.Instance().AssetLoader; private static Dictionary 非流式资源字典 => (Dictionary)(typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(资源加载器)); private static Dictionary 获取字典(string 字段名) where T : Object { return (Dictionary)(typeof(LandfallContentDatabase).GetField(字段名, BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(内容数据库)); } public static GameObject 获取原版内容游戏物品(string 字典名, DatabaseID id) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return 获取字典(字典名)[id]; } } } namespace HeMoDingDingMod.角色类.瑟提 { public class 向下射线检测并识别替换材质 : MonoBehaviour { [Header("射线检测设置")] public LayerMask 地面层级 = LayerMask.op_Implicit(512); public float 射线长度 = 10f; public bool 显示调试射线 = true; [Header("粒子系统设置")] public ParticleSystem 目标粒子发射器; public bool 包含子级粒子系统 = false; private void Start() { 执行射线检测并替换材质(); } [ContextMenu("手动执行射线检测")] private void 执行射线检测并替换材质() { //IL_003d: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)目标粒子发射器 == (Object)null) { Debug.LogError((object)("[射线检测] " + ((Object)((Component)this).gameObject).name + " - 未指定目标粒子发射器!")); return; } Vector3 val = ((Component)this).transform.position + new Vector3(0f, 10f, 0f); Vector3 down = Vector3.down; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, down, ref val2, 射线长度 * 2f, LayerMask.op_Implicit(地面层级))) { GameObject gameObject = ((Component)((RaycastHit)(ref val2)).collider).gameObject; Debug.Log((object)$"[射线检测] {((Object)((Component)this).gameObject).name} 检测到物体: {((Object)gameObject).name},距离: {((RaycastHit)(ref val2)).distance:F2}"); Renderer val3 = 获取父级网格渲染器(gameObject); if ((Object)(object)val3 != (Object)null) { Material material = val3.material; Debug.Log((object)("[材质替换] 成功获取材质: " + ((Object)material).name + ",来源: " + ((Object)((Component)val3).gameObject).name)); 替换粒子材质(material); } else { Debug.LogWarning((object)("[射线检测] " + ((Object)gameObject).name + " 及其父级都没有找到网格渲染器组件!")); } } else { Debug.LogWarning((object)$"[射线检测] {((Object)((Component)this).gameObject).name} 未检测到任何碰撞体(射线长度: {射线长度})"); } } private Renderer 获取父级网格渲染器(GameObject 目标物体) { Renderer componentInParent = 目标物体.GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { return componentInParent; } return null; } private void 替换粒子材质(Material 新材质) { ParticleSystemRenderer component = ((Component)目标粒子发射器).GetComponent(); if ((Object)(object)component != (Object)null) { 材质替换记录(component, 新材质); } else { Debug.LogError((object)("[材质替换] 目标物体 " + ((Object)目标粒子发射器).name + " 没有找到 ParticleSystemRenderer 组件!")); } if (!包含子级粒子系统) { return; } ParticleSystemRenderer[] componentsInChildren = ((Component)目标粒子发射器).GetComponentsInChildren(); ParticleSystemRenderer[] array = componentsInChildren; foreach (ParticleSystemRenderer val in array) { if ((Object)(object)val != (Object)(object)component) { 材质替换记录(val, 新材质); } } } private void 材质替换记录(ParticleSystemRenderer 粒子渲染器, Material 新材质) { string text = (((Object)(object)((Renderer)粒子渲染器).material != (Object)null) ? ((Object)((Renderer)粒子渲染器).material).name : "无材质"); ((Renderer)粒子渲染器).material = 新材质; Debug.Log((object)("[材质替换] 已替换 " + ((Object)((Component)粒子渲染器).gameObject).name + " 的材质: " + text + " -> " + ((Object)新材质).name)); } } public class 技能类_强手裂颅 : 碰撞检测获取单位基类定制版本 { public Transform 指定中心点; public float 伤害 = 100f; public float 力度大小 = 500f; protected override void Start() { base.Start(); if ((Object)(object)指定中心点 == (Object)null) { 指定中心点 = ((Component)this).transform; } } public override void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { //IL_002e: 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_003e: 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_0046: 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_0074: Unknown result type (might be due to invalid IL or missing references) base.完成单次检测(效果实例, 召唤者, 受影响者, 召唤物体); if (Object.op_Implicit((Object)(object)受影响者)) { Rigidbody mainRig = 受影响者.data.mainRig; Vector3 val = 受影响者.data.mainRig.position - 指定中心点.position; mainRig.AddForce(((Vector3)(ref val)).normalized * 力度大小, (ForceMode)5); ((Damagable)受影响者.data.healthHandler).TakeDamage(伤害, ((Component)this).transform.position, 召唤者, (DamageType)0); } } } public class 朝向目标实例化物体 : MonoBehaviour { public bool 检测地面 = false; private Unit 此单位; private void Start() { 此单位 = ((Component)((Component)this).transform.root).GetComponent(); } public void 实例化生成(GameObject 实例化物体) { //IL_0053: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)实例化物体 == (Object)null) && Object.op_Implicit((Object)(object)此单位) && Object.op_Implicit((Object)(object)此单位.data.targetData)) { Vector3 val = 此单位.data.targetData.mainRig.position - 此单位.data.mainRig.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(normalized.x, 0f, normalized.z); Vector3 val3 = ((Component)this).transform.position; if (检测地面) { val3 = 获取地面位置(((Component)this).transform.position); } GameObject val4 = Object.Instantiate(实例化物体, val3, Quaternion.LookRotation(val2)); TeamHolder.AddTeamHolder(val4, ((Component)this).gameObject); } } public Vector3 获取地面位置(Vector3 测试位置, float 检测高度 = 10f, int 地面层级 = 512) { //IL_0003: 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_0011: 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) //IL_0025: 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_0049: 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_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(测试位置.x, 测试位置.y + 检测高度, 测试位置.z); float num = 检测高度 * 3f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, 地面层级)) { return ((RaycastHit)(ref val2)).point; } return new Vector3(测试位置.x, 测试位置.y - 检测高度 * 0.5f, 测试位置.z); } } public class 技能类_叹为观止 : MonoBehaviour { private enum 大招状态 { 空闲, 第一阶段_冲刺抓取, 第二阶段_升空, 第三阶段_砸地向密集区, 完成 } [CompilerGenerated] private sealed class <豪意值初始化>d__43 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 技能类_叹为观止 <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <豪意值初始化>d__43(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.查找豪意值系统 = ((Component)((Component)<>4__this).transform.root).GetComponent<豪意值系统>(); 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(); } } [Header("第一阶段:冲刺抓取")] public float 冲刺力度; public AnimationCurve 冲刺力度曲线; [Tooltip("触发抓取的距离阈值")] public float 抓取距离阈值 = 2f; [Tooltip("抓取超时时间")] public float 抓取超时时间 = 2f; public LayerMask 射线检测层 = LayerMask.op_Implicit(16384); [Header("第二阶段:升空")] public float 升空力度; public AnimationCurve 升空力度曲线; [Tooltip("最大升空高度")] public float 最大升空高度 = 15f; [Header("第三阶段:砸地向密集区")] public float 下落力度; public AnimationCurve 下落力度曲线; [Tooltip("砸地冲击波预制体")] public GameObject 砸地冲击波预制体; [Tooltip("砸地伤害倍率(基于目标最大生命值)")] public float 砸地伤害倍率 = 0.4f; [Tooltip("砸地范围")] public float 砸地范围 = 8f; [Header("冲刺特效")] public GameObject 冲刺特效预制体; [Tooltip("升空特效")] public GameObject 升空特效预制体; [Header("单位获取工具")] public 最近单位获取工具类32 单位获取工具; public UnityEvent 到达抓取事件; public UnityEvent 到达砸地事件; [Header("调试")] private bool 启用异常日志 = true; public bool 强制抓取 = true; public float 强制抓取时间参数 = 2f; private 大招状态 当前状态 = 大招状态.空闲; private Unit 此单位; private DataHandler 单位数据; private Rigidbody 单位主刚体; private DataHandler 目标数据; private Rigidbody 目标主刚体; private Rigidbody[] 目标全部刚体数组; private Vector3 密集区域位置; private Vector3 抓取偏移位置; private Vector3 升空起始位置; private Vector3 记录朝向方向; private float 状态计时器 = 0f; private float 曲线总时间_冲刺 = 0f; private float 曲线总时间_升空 = 0f; private float 曲线总时间_下落 = 0f; private bool 已抓取成功 = false; private bool 有密集区域 = false; private Coroutine 当前击飞协程 = null; public bool 启用 = true; private 豪意值系统 查找豪意值系统; private void Start() { try { 此单位 = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)此单位 == (Object)null) { 记录异常("Start: 未找到Unit组件"); return; } 单位数据 = 此单位.data; if ((Object)(object)单位数据 == (Object)null) { 记录异常("Start: 单位数据为空"); return; } 单位主刚体 = 单位数据.mainRig; if ((Object)(object)单位主刚体 == (Object)null) { 记录异常("Start: 单位主刚体为空"); } 曲线总时间_冲刺 = 获取曲线总时间(冲刺力度曲线); 曲线总时间_升空 = 获取曲线总时间(升空力度曲线); 曲线总时间_下落 = 获取曲线总时间(下落力度曲线); } catch (Exception ex) { 记录异常("Start发生异常: " + ex.Message + "\n" + ex.StackTrace); } ((MonoBehaviour)this).StartCoroutine(豪意值初始化()); } [IteratorStateMachine(typeof(<豪意值初始化>d__43))] private IEnumerator 豪意值初始化() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <豪意值初始化>d__43(0) { <>4__this = this }; } private void Update() { if (!启用) { return; } try { switch (当前状态) { case 大招状态.第一阶段_冲刺抓取: 更新冲刺抓取阶段(); break; case 大招状态.第二阶段_升空: 更新升空阶段(); break; case 大招状态.第三阶段_砸地向密集区: 更新砸地阶段(); break; } } catch (Exception ex) { 记录异常("Update异常: " + ex.Message + "\n" + ex.StackTrace); } } private void 记录异常(string 消息) { if (启用异常日志) { Debug.LogError((object)("[叹为观止] " + 消息)); } } private void 更新冲刺抓取阶段() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_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) //IL_0095: 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_00a2: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) try { if (冲刺力度曲线 == null) { 记录异常("更新冲刺抓取阶段: 冲刺力度曲线为空"); return; } 状态计时器 += Time.deltaTime; float num = 冲刺力度曲线.Evaluate(状态计时器); if ((Object)(object)目标主刚体 != (Object)null && (Object)(object)单位主刚体 != (Object)null) { Vector3 val = 目标主刚体.position - 单位主刚体.position; Vector3 normalized = ((Vector3)(ref val)).normalized; 单位主刚体.AddForce(normalized * 冲刺力度 * num * Time.deltaTime * 220f, (ForceMode)5); if (!已抓取成功) { if (强制抓取 && 状态计时器 >= 强制抓取时间参数) { 抓取成功(); } else { RaycastHit[] array = Physics.RaycastAll(单位主刚体.position, normalized, 抓取距离阈值, LayerMask.op_Implicit(射线检测层)); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if ((Object)(object)((Component)((RaycastHit)(ref val2)).collider).transform.root == (Object)(object)((Component)目标主刚体).transform.root) { 抓取成功(); break; } } } } } if ((状态计时器 >= 曲线总时间_冲刺 || 状态计时器 >= 抓取超时时间) && !已抓取成功) { 记录异常("更新冲刺抓取阶段: 抓取超时,重置大招"); 重置大招(); } } catch (Exception ex) { 记录异常("更新冲刺抓取阶段异常: " + ex.Message); } } private void 抓取成功() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) try { 已抓取成功 = true; UnityEvent obj = 到达抓取事件; if (obj != null) { obj.Invoke(); } 清除刚体动能(单位主刚体); 清除刚体动能(目标主刚体); if ((Object)(object)单位主刚体 != (Object)null && (Object)(object)目标主刚体 != (Object)null) { 抓取偏移位置 = ((Component)单位主刚体).transform.InverseTransformPoint(目标主刚体.position); 升空起始位置 = 单位主刚体.position; } if ((Object)(object)升空特效预制体 != (Object)null && (Object)(object)单位主刚体 != (Object)null) { GameObject val = Object.Instantiate(升空特效预制体, 单位主刚体.position, Quaternion.identity); TeamHolder.AddTeamHolder(val, ((Component)this).gameObject); } 当前状态 = 大招状态.第二阶段_升空; 状态计时器 = 0f; 计算密集区域(); } catch (Exception ex) { 记录异常("抓取成功异常: " + ex.Message); } } private void 更新升空阶段() { //IL_0065: 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_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_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_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) //IL_00d4: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_00fb: 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_010f: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) try { if (升空力度曲线 == null) { 记录异常("更新升空阶段: 升空力度曲线为空"); return; } 状态计时器 += Time.deltaTime; float num = 升空力度曲线.Evaluate(状态计时器); float num2 = Time.deltaTime * 220f; if ((Object)(object)单位主刚体 != (Object)null) { Vector3 val = Vector3.up; Vector3 val3; if (有密集区域 && 密集区域位置 != Vector3.zero) { Vector3 val2 = 密集区域位置 - 单位主刚体.position; val2.y = 0f; ((Vector3)(ref val2)).Normalize(); val3 = Vector3.up + val2 * 0.5f; val = ((Vector3)(ref val3)).normalized; } else if (记录朝向方向 != Vector3.zero) { val3 = Vector3.up + 记录朝向方向 * 0.3f; val = ((Vector3)(ref val3)).normalized; } 单位主刚体.AddForce(val * 升空力度 * num * num2, (ForceMode)5); if (单位主刚体.position.y - 升空起始位置.y >= 最大升空高度) { 单位主刚体.velocity = Vector3.zero; 切换到砸地阶段(); } } if ((Object)(object)目标主刚体 != (Object)null && (Object)(object)单位主刚体 != (Object)null) { Vector3 val4 = ((Component)单位主刚体).transform.TransformPoint(抓取偏移位置); Vector3 val5 = val4 - 目标主刚体.position; if (目标全部刚体数组 != null && 目标全部刚体数组.Length != 0) { Rigidbody[] array = 目标全部刚体数组; foreach (Rigidbody val6 in array) { if ((Object)(object)val6 != (Object)null) { val6.MovePosition(val6.position + val5); } } } } if (状态计时器 >= 曲线总时间_升空) { 切换到砸地阶段(); } } catch (Exception ex) { 记录异常("更新升空阶段异常: " + ex.Message); } } private void 切换到砸地阶段() { 当前状态 = 大招状态.第三阶段_砸地向密集区; 状态计时器 = 0f; } private void 更新砸地阶段() { //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_0095: 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_009f: 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_00c6: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) try { if (下落力度曲线 == null) { 记录异常("更新砸地阶段: 下落力度曲线为空"); return; } 状态计时器 += Time.deltaTime; float num = 下落力度曲线.Evaluate(状态计时器); float num2 = Time.deltaTime * 220f; if ((Object)(object)单位主刚体 != (Object)null) { Vector3 val2; if (有密集区域 && 密集区域位置 != Vector3.zero) { Vector3 val = 密集区域位置 - 单位主刚体.position; val2 = ((Vector3)(ref val)).normalized; } else { val2 = Vector3.down; } float num3 = 下落力度 * num; 单位主刚体.AddForce(val2 * num3 * num2, (ForceMode)5); if ((Object)(object)目标主刚体 != (Object)null && (Object)(object)单位主刚体 != (Object)null) { Vector3 val3 = ((Component)单位主刚体).transform.TransformPoint(抓取偏移位置); Vector3 val4 = val3 - 目标主刚体.position; if (目标全部刚体数组 != null && 目标全部刚体数组.Length != 0) { Rigidbody[] array = 目标全部刚体数组; foreach (Rigidbody val5 in array) { if ((Object)(object)val5 != (Object)null) { val5.MovePosition(val5.position + val4); } } } } } RaycastHit val6 = default(RaycastHit); if ((Object)(object)单位主刚体 != (Object)null && Physics.Raycast(单位主刚体.position, Vector3.down, ref val6, 3f, 512)) { 执行砸地(((RaycastHit)(ref val6)).point); 重置大招(); } if (状态计时器 >= 曲线总时间_下落) { 执行砸地(((Object)(object)单位主刚体 != (Object)null) ? 单位主刚体.position : ((Component)this).transform.position); 重置大招(); } } catch (Exception ex) { 记录异常("更新砸地阶段异常: " + ex.Message); } } private void 执行砸地(Vector3 砸地位置) { //IL_002e: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) try { UnityEvent obj = 到达砸地事件; if (obj != null) { obj.Invoke(); } if (!((Object)(object)砸地冲击波预制体 != (Object)null)) { return; } GameObject val = Object.Instantiate(砸地冲击波预制体, 砸地位置, Quaternion.identity); TeamHolder.AddTeamHolder(val, ((Component)this).gameObject); Explosion component = val.GetComponent(); if (!((Object)(object)component != (Object)null) || !((Object)(object)目标数据 != (Object)null)) { return; } if (Object.op_Implicit((Object)(object)查找豪意值系统)) { component.damage += 目标数据.maxHealth * 查找豪意值系统.获取豪意值01; component.radius = 砸地范围; if ((Object)(object)目标数据.healthHandler != (Object)null) { ((Damagable)目标数据.healthHandler).TakeDamage(10f + 目标数据.maxHealth * 查找豪意值系统.获取豪意值01, ((Component)this).transform.position, (Unit)null, (DamageType)0); } } else { component.damage += 目标数据.maxHealth * 砸地伤害倍率; component.radius = 砸地范围; if ((Object)(object)目标数据.healthHandler != (Object)null) { ((Damagable)目标数据.healthHandler).TakeDamage(目标数据.maxHealth * 砸地伤害倍率, ((Component)this).transform.position, (Unit)null, (DamageType)0); } } } catch (Exception ex) { 记录异常("执行砸地异常: " + ex.Message); } } private void 造成范围伤害(Vector3 中心位置) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)单位获取工具 == (Object)null) { return; } List targets = 单位获取工具.GetTargets(砸地范围); if (targets == null) { return; } float num = (((Object)(object)目标数据 != (Object)null) ? (目标数据.maxHealth * 砸地伤害倍率) : 100f); foreach (Unit item in targets) { if ((Object)(object)item != (Object)null && (Object)(object)item != (Object)(object)此单位 && (Object)(object)item.data != (Object)null && (Object)(object)item.data.healthHandler != (Object)null) { ((Damagable)item.data.healthHandler).TakeDamage(num, 中心位置, (Unit)null, (DamageType)0); } } } catch (Exception ex) { 记录异常("造成范围伤害异常: " + ex.Message); } } private void 计算密集区域() { //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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) try { if ((Object)(object)单位获取工具 != (Object)null) { List targets = 单位获取工具.GetTargets(50f); if (targets != null && targets.Count > 0) { if ((Object)(object)目标数据 != (Object)null) { targets.RemoveAll((Unit p) => (Object)(object)p == (Object)(object)目标数据.unit); } if (targets.Count > 0) { List list = new List(); foreach (Unit item in targets) { if ((Object)(object)item != (Object)null && (Object)(object)item.data != (Object)null && (Object)(object)item.data.mainRig != (Object)null) { list.Add(item.data.mainRig.position); } } if (list.Count > 0) { 密集区域位置 = 获取地面位置(寻找最密集位置网格(list.ToArray(), 7f)); 有密集区域 = true; return; } } } } 有密集区域 = false; 密集区域位置 = 获取地面位置(((Component)this).transform.position); } catch (Exception ex) { 记录异常("计算密集区域异常: " + ex.Message); } } private Vector3 寻找最密集位置网格(Vector3[] 位置数组, float 网格大小) { //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_0010: 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_0030: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_006a: 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) //IL_00ac: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) if (位置数组 == null || 位置数组.Length == 0) { return Vector3.zero; } try { Dictionary> dictionary = new Dictionary>(); Vector3Int key = default(Vector3Int); foreach (Vector3 val in 位置数组) { ((Vector3Int)(ref key))..ctor(Mathf.FloorToInt(val.x / 网格大小), Mathf.FloorToInt(val.y / 网格大小), Mathf.FloorToInt(val.z / 网格大小)); if (!dictionary.ContainsKey(key)) { dictionary[key] = new List(); } dictionary[key].Add(val); } Vector3Int val2 = Vector3Int.zero; int num = 0; foreach (KeyValuePair> item in dictionary) { if (item.Value.Count > num) { num = item.Value.Count; val2 = item.Key; } } return new Vector3((float)((Vector3Int)(ref val2)).x * 网格大小 + 网格大小 / 2f, (float)((Vector3Int)(ref val2)).y * 网格大小 + 网格大小 / 2f, (float)((Vector3Int)(ref val2)).z * 网格大小 + 网格大小 / 2f); } catch (Exception ex) { 记录异常("寻找最密集位置网格异常: " + ex.Message); return Vector3.zero; } } private Vector3 获取地面位置(Vector3 测试位置, float 检测高度 = 10f, int 地面层级 = 512) { //IL_0004: 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_0012: 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_0026: 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_006b: 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_0084: 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_0088: Unknown result type (might be due to invalid IL or missing references) try { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(测试位置.x, 测试位置.y + 检测高度, 测试位置.z); float num = 检测高度 * 10f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, 地面层级)) { return ((RaycastHit)(ref val2)).point; } } catch (Exception ex) { 记录异常("获取地面位置异常: " + ex.Message); } return new Vector3(测试位置.x, 测试位置.y - 检测高度 * 0.5f, 测试位置.z); } private void 清除刚体动能(Rigidbody 刚体) { //IL_0011: 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) if ((Object)(object)刚体 == (Object)null) { return; } try { 刚体.velocity = Vector3.zero; 刚体.angularVelocity = Vector3.zero; } catch (Exception ex) { 记录异常("清除刚体动能异常: " + ex.Message); } } private float 获取曲线总时间(AnimationCurve 曲线) { if (曲线 == null || 曲线.length == 0) { return 1f; } try { return ((Keyframe)(ref 曲线.keys[曲线.length - 1])).time; } catch (Exception ex) { 记录异常("获取曲线总时间异常: " + ex.Message); return 1f; } } public void 启动大招() { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_0107: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) try { if (!启用) { 记录异常("启动大招: 技能未启用"); return; } if ((Object)(object)单位数据 == (Object)null) { 记录异常("启动大招: 单位数据为空"); return; } 目标数据 = 单位数据.targetData; if ((Object)(object)目标数据 == (Object)null) { 记录异常("启动大招: 目标数据为空"); return; } 目标主刚体 = 目标数据.mainRig; if ((Object)(object)目标主刚体 == (Object)null) { 记录异常("启动大招: 目标主刚体为空"); return; } 目标全部刚体数组 = 目标数据.allRigs.AllRigs; if ((Object)(object)单位主刚体 != (Object)null && (Object)(object)目标主刚体 != (Object)null) { Vector3 val = 目标主刚体.position - 单位主刚体.position; Vector3 normalized = ((Vector3)(ref val)).normalized; 记录朝向方向 = new Vector3(normalized.x, 0f, normalized.z); } if ((Object)(object)冲刺特效预制体 != (Object)null && (Object)(object)单位主刚体 != (Object)null) { GameObject val2 = Object.Instantiate(冲刺特效预制体, 单位主刚体.position, Quaternion.LookRotation(记录朝向方向)); TeamHolder.AddTeamHolder(val2, ((Component)this).gameObject); } 重置大招(); 当前状态 = 大招状态.第一阶段_冲刺抓取; 状态计时器 = 0f; 已抓取成功 = false; } catch (Exception ex) { 记录异常("启动大招异常: " + ex.Message); } } public void 重置大招() { try { 当前状态 = 大招状态.空闲; 状态计时器 = 0f; 已抓取成功 = false; } catch (Exception ex) { 记录异常("重置大招异常: " + ex.Message); } } public void 设置伤害倍率(float 倍率) { 砸地伤害倍率 = 倍率; } private void OnDestroy() { 重置大招(); } } public class 瑟提技能_蓄意轰拳 : MonoBehaviour { [CompilerGenerated] private sealed class <实例化特效携程>d__12 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GameObject 跟随特效; public 瑟提技能_蓄意轰拳 <>4__this; private float 5__1; private Vector3 <朝向目标>5__2; private Vector3 <水平向量>5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <实例化特效携程>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006b: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00e8: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0f; break; case 1: <>1__state = -1; break; } if ((Object)(object)跟随特效 != (Object)null && <>4__this.特效跟随时间 > 5__1 && Object.op_Implicit((Object)(object)<>4__this.存储单位数据.targetData)) { Vector3 val = <>4__this.存储单位数据.targetData.mainRig.position - <>4__this.存储单位数据.mainRig.position; <朝向目标>5__2 = ((Vector3)(ref val)).normalized; <水平向量>5__3 = new Vector3(<朝向目标>5__2.x, 0f, <朝向目标>5__2.z); 跟随特效.transform.position = <>4__this.获取地面位置(<>4__this.存储位置.position); 跟随特效.transform.rotation = Quaternion.LookRotation(<水平向量>5__3); 5__1 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } <>4__this.特效携程 = 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(); } } [CompilerGenerated] private sealed class <豪意值初始化>d__9 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 瑟提技能_蓄意轰拳 <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <豪意值初始化>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.获取豪意值系统 = ((Component)((Component)<>4__this).transform.root).GetComponent<豪意值系统>(); 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(); } } private Unit 此单位; private 豪意值系统 获取豪意值系统; private Coroutine 特效携程 = null; private Transform 存储位置; private DataHandler 存储单位数据; public float 特效跟随时间 = 2f; public GameObject 普通豪意值特效; public GameObject 满豪意值特效; private void Start() { 此单位 = ((Component)((Component)this).transform.root).GetComponent(); 存储位置 = ((Component)此单位.data.mainRig).transform; 存储单位数据 = 此单位.data; ((MonoBehaviour)this).StartCoroutine(豪意值初始化()); } [IteratorStateMachine(typeof(<豪意值初始化>d__9))] private IEnumerator 豪意值初始化() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <豪意值初始化>d__9(0) { <>4__this = this }; } public void 实例化特效(GameObject obj) { //IL_0052: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)此单位) || !Object.op_Implicit((Object)(object)存储单位数据) || !Object.op_Implicit((Object)(object)存储单位数据.targetData) || 特效携程 != null) { return; } Vector3 val = 存储单位数据.targetData.mainRig.position - 存储单位数据.mainRig.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(normalized.x, 0f, normalized.z); GameObject val3 = Object.Instantiate(obj, 获取地面位置(此单位.data.mainRig.position), Quaternion.LookRotation(val2)); TeamHolder.AddTeamHolder(val3, ((Component)this).gameObject); if (Object.op_Implicit((Object)(object)获取豪意值系统)) { float 获取豪意值 = 获取豪意值系统.获取豪意值01; 技能类_蓄意轰拳爆炸伤害[] componentsInChildren = val3.GetComponentsInChildren<技能类_蓄意轰拳爆炸伤害>(); if (componentsInChildren != null && componentsInChildren.Length != 0) { for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].百分比伤害 = 获取豪意值; componentsInChildren[i].力度大小 *= 1f + 获取豪意值 * 2f; } } } if (特效携程 == null) { 特效携程 = ((MonoBehaviour)this).StartCoroutine(实例化特效携程(val3)); } } public void 实例化特效豪意值关联版本() { //IL_0052: 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_006c: 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_0074: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_01d5: 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) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)此单位) || !Object.op_Implicit((Object)(object)存储单位数据) || !Object.op_Implicit((Object)(object)存储单位数据.targetData) || 特效携程 != null) { return; } Vector3 val = 存储单位数据.targetData.mainRig.position - 存储单位数据.mainRig.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(normalized.x, 0f, normalized.z); if ((Object)(object)获取豪意值系统 != (Object)null) { if (!获取豪意值系统.是否满豪意值) { GameObject val3 = Object.Instantiate(普通豪意值特效, 获取地面位置(此单位.data.mainRig.position), Quaternion.LookRotation(val2)); TeamHolder.AddTeamHolder(val3, ((Component)this).gameObject); if (Object.op_Implicit((Object)(object)获取豪意值系统)) { float 获取豪意值 = 获取豪意值系统.获取豪意值01; 技能类_蓄意轰拳爆炸伤害[] componentsInChildren = val3.GetComponentsInChildren<技能类_蓄意轰拳爆炸伤害>(); if (componentsInChildren != null && componentsInChildren.Length != 0) { for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].百分比伤害 = 获取豪意值; componentsInChildren[i].力度大小 *= 1f + 获取豪意值 * 2f; } } } if (特效携程 == null) { 特效携程 = ((MonoBehaviour)this).StartCoroutine(实例化特效携程(val3)); } } if (!获取豪意值系统.是否满豪意值) { return; } GameObject val4 = Object.Instantiate(满豪意值特效, 获取地面位置(此单位.data.mainRig.position), Quaternion.LookRotation(val2)); TeamHolder.AddTeamHolder(val4, ((Component)this).gameObject); if (Object.op_Implicit((Object)(object)获取豪意值系统)) { float 获取豪意值2 = 获取豪意值系统.获取豪意值01; 技能类_蓄意轰拳爆炸伤害[] componentsInChildren2 = val4.GetComponentsInChildren<技能类_蓄意轰拳爆炸伤害>(); if (componentsInChildren2 != null && componentsInChildren2.Length != 0) { for (int j = 0; j < componentsInChildren2.Length; j++) { componentsInChildren2[j].百分比伤害 = 1f; componentsInChildren2[j].力度大小 *= 4f; } } } if (特效携程 == null) { 特效携程 = ((MonoBehaviour)this).StartCoroutine(实例化特效携程(val4)); } } else { GameObject val5 = Object.Instantiate(普通豪意值特效, 获取地面位置(此单位.data.mainRig.position), Quaternion.LookRotation(val2)); TeamHolder.AddTeamHolder(val5, ((Component)this).gameObject); if (特效携程 == null) { 特效携程 = ((MonoBehaviour)this).StartCoroutine(实例化特效携程(val5)); } } } [IteratorStateMachine(typeof(<实例化特效携程>d__12))] private IEnumerator 实例化特效携程(GameObject 跟随特效) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <实例化特效携程>d__12(0) { <>4__this = this, 跟随特效 = 跟随特效 }; } public Vector3 获取地面位置(Vector3 测试位置, float 检测高度 = 10f, int 地面层级 = 512) { //IL_0003: 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_0011: 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) //IL_0025: 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_0049: 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_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(测试位置.x, 测试位置.y + 检测高度, 测试位置.z); float num = 检测高度 * 3f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, 地面层级)) { return ((RaycastHit)(ref val2)).point; } return new Vector3(测试位置.x, 测试位置.y - 检测高度 * 0.5f, 测试位置.z); } } public class 技能类_蓄意轰拳爆炸伤害 : 碰撞检测获取单位基类定制版本 { public Transform 指定中心点; public float 伤害 = 100f; public float 力度大小 = 500f; [Range(0f, 1f)] public float 百分比伤害 = 0f; protected override void Start() { base.Start(); if ((Object)(object)指定中心点 == (Object)null) { 指定中心点 = ((Component)this).transform; } } public override void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { //IL_002e: 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_003e: 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_0046: 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_0087: Unknown result type (might be due to invalid IL or missing references) base.完成单次检测(效果实例, 召唤者, 受影响者, 召唤物体); if (Object.op_Implicit((Object)(object)受影响者)) { Rigidbody mainRig = 受影响者.data.mainRig; Vector3 val = 受影响者.data.mainRig.position - 指定中心点.position; mainRig.AddForce(((Vector3)(ref val)).normalized * 力度大小, (ForceMode)5); ((Damagable)受影响者.data.healthHandler).TakeDamage(伤害 + 受影响者.data.maxHealth * 百分比伤害, ((Component)this).transform.position, 召唤者, (DamageType)0); } } } public class 豪意值系统ui系统 : 额外ui系统基类 { public Slider 当前ui滑块组件; public 豪意值系统 豪意值系统; private bool 已初始化 = false; public override void 初始化(Unit 外部传入unit组件) { base.初始化(外部传入unit组件); if ((Object)(object)当前ui滑块组件 == (Object)null) { Debug.LogError((object)"没有指定ui!!!"); return; } 豪意值系统 = ((Component)当前unit组件).GetComponent<豪意值系统>(); if ((Object)(object)豪意值系统 == (Object)null) { Debug.LogError((object)"未找到豪意值系统!!!"); } else { 已初始化 = true; } } private void Update() { if (已初始化 && Object.op_Implicit((Object)(object)当前ui滑块组件) && Object.op_Implicit((Object)(object)豪意值系统)) { 当前ui滑块组件.value = 豪意值系统.获取当前豪意值 / 豪意值系统.最大值; } } } public class 豪意值处理蒙皮渲染器 : MonoBehaviour { [CompilerGenerated] private sealed class <豪意值初始化>d__3 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 豪意值处理蒙皮渲染器 <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <豪意值初始化>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.豪意值 = ((Component)((Component)<>4__this).transform.root).GetComponent<豪意值系统>(); if (Object.op_Implicit((Object)(object)<>4__this.豪意值)) { <>4__this.豪意值.满豪意值事件 += <>4__this.开启蒙皮; <>4__this.豪意值.结束满意值事件 += <>4__this.关闭蒙皮; } 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(); } } private 豪意值系统 豪意值; public SkinnedMeshRenderer 蒙皮渲染器; private void Start() { ((MonoBehaviour)this).StartCoroutine(豪意值初始化()); } [IteratorStateMachine(typeof(<豪意值初始化>d__3))] private IEnumerator 豪意值初始化() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <豪意值初始化>d__3(0) { <>4__this = this }; } public void 开启蒙皮() { ((Renderer)蒙皮渲染器).enabled = true; } public void 关闭蒙皮() { ((Renderer)蒙皮渲染器).enabled = false; } private void OnDestroy() { if ((Object)(object)豪意值 != (Object)null) { 豪意值.满豪意值事件 -= 开启蒙皮; 豪意值.结束满意值事件 -= 关闭蒙皮; } } } public class 豪意值系统 : MonoBehaviour { [CompilerGenerated] private sealed class <满豪意值携程>d__22 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 豪意值系统 <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <满豪意值携程>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.是否下降豪意值 = false; <>2__current = (object)new WaitForSeconds(<>4__this.满豪意值持续); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.是否下降豪意值 = true; <>4__this.结束满意值事件?.Invoke(); <>4__this.是否满豪意值 = false; <>4__this.记录携程 = 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(); } } public float 豪意值下降速度 = 1f; public float 最大值 = 20f; public float 满豪意值持续 = 5f; public bool 是否满豪意值 = false; private float 当前豪意值 = 0f; private bool 是否下降豪意值 = true; private Coroutine 记录携程 = null; public float 获取当前豪意值 => 当前豪意值; public float 获取豪意值01 => Mathf.Clamp01(获取当前豪意值 / 最大值); public event Action 满豪意值事件; public event Action 增长意值事件; public event Action 结束满意值事件; private void Update() { if (!(当前豪意值 <= 0f) && 是否下降豪意值) { 当前豪意值 -= Time.deltaTime * 豪意值下降速度; } } public void 增加豪意值(float 增长量) { 当前豪意值 += 增长量; if (获取当前豪意值 >= 最大值) { 当前豪意值 = 最大值; if (记录携程 == null) { 记录携程 = ((MonoBehaviour)this).StartCoroutine(满豪意值携程()); } 是否满豪意值 = true; this.满豪意值事件?.Invoke(); } this.增长意值事件?.Invoke(); } [IteratorStateMachine(typeof(<满豪意值携程>d__22))] private IEnumerator 满豪意值携程() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <满豪意值携程>d__22(0) { <>4__this = this }; } } public class 豪意值系统添加器 : MonoBehaviour { private 豪意值系统 当前豪意值系统; private Unit 这个单位; public float 最大豪意值 = 20f; public float 每次受伤增长豪意值 = 2f; public float 豪意值下降速度 = 1f; public float 满豪意值持续时间 = 5f; public UnityEvent 满豪意值事件; private void Start() { 当前豪意值系统 = ((Component)((Component)this).transform.root).GetComponent<豪意值系统>(); 这个单位 = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)当前豪意值系统 == (Object)null) { 当前豪意值系统 = ((Component)((Component)this).transform.root).gameObject.AddComponent<豪意值系统>(); } 当前豪意值系统.最大值 = 最大豪意值; 当前豪意值系统.满豪意值持续 = 满豪意值持续时间; 当前豪意值系统.豪意值下降速度 = 豪意值下降速度; 当前豪意值系统.满豪意值事件 += 触发事件; if ((Object)(object)这个单位 != (Object)null) { 这个单位.AddWasDamagedAction((Action)OnUnitDamaged); } } public void 触发事件() { UnityEvent obj = 满豪意值事件; if (obj != null) { obj.Invoke(); } } private void OnUnitDamaged(Rigidbody enemyWeapon, Rigidbody enemyTorso) { 增加豪意值(); } public void 增加豪意值() { if ((Object)(object)当前豪意值系统 != (Object)null) { 当前豪意值系统.增加豪意值(每次受伤增长豪意值); } } private void OnDestroy() { if ((Object)(object)当前豪意值系统 != (Object)null) { 当前豪意值系统.满豪意值事件 -= 触发事件; } } } public static class UnitExtensions { private static FieldInfo _unitUIField; static UnitExtensions() { _unitUIField = typeof(Unit).GetField("m_unitUI", BindingFlags.Instance | BindingFlags.NonPublic); if (_unitUIField == null) { Debug.LogError((object)"[UnitExtensions] 无法找到 Unit.m_unitUI 字段!反射初始化失败。"); } } public static TABCUnitUI GetUnitUI(this Unit unit) { if ((Object)(object)unit == (Object)null) { Debug.LogError((object)"[UnitExtensions] GetUnitUI: unit 参数为 null"); return null; } if (_unitUIField == null) { Debug.LogError((object)"[UnitExtensions] GetUnitUI: _unitUIField 未正确初始化,无法获取私有字段"); return null; } try { object? value = _unitUIField.GetValue(unit); TABCUnitUI val = (TABCUnitUI)((value is TABCUnitUI) ? value : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("[UnitExtensions] GetUnitUI: 单位 '" + ((Object)unit).name + "' 的 m_unitUI 字段值为 null (可能UI尚未初始化)")); } return val; } catch (Exception ex) { Debug.LogError((object)("[UnitExtensions] GetUnitUI: 反射获取值时发生异常 - " + ex.Message + "\n" + ex.StackTrace)); return null; } } } public class 额外ui生成器 : MonoBehaviour { [CompilerGenerated] private sealed class d__3 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 额外ui生成器 <>4__this; private TABCUnitUI 5__1; private GameObject <实例化的ui>5__2; private 额外ui系统基类 <查找基类>5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <实例化的ui>5__2 = null; <查找基类>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0158: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = null; <>1__state = 2; return true; case 2: <>1__state = -1; 5__1 = <>4__this.unit.GetUnitUI(); if ((Object)(object)5__1 != (Object)null) { Debug.Log((object)("[额外ui生成器] 成功获取 UnitUI,正在实例化额外UI到: " + ((Object)((Component)5__1).transform).name)); <实例化的ui>5__2 = Object.Instantiate(<>4__this.实例化ui, ((Component)5__1).transform); Debug.Log((object)"[额外ui生成器] 额外UI实例化成功"); <查找基类>5__3 = <实例化的ui>5__2.GetComponent<额外ui系统基类>(); if (Object.op_Implicit((Object)(object)<查找基类>5__3)) { <查找基类>5__3.初始化(<>4__this.unit); } <实例化的ui>5__2 = null; <查找基类>5__3 = null; } else { Debug.LogError((object)("[额外ui生成器] 获取 UnitUI 失败,无法实例化额外UI。单位名称: " + ((Object)<>4__this.unit).name)); Debug.Log((object)$"[额外ui生成器] 调试信息 - 单位: {((Object)<>4__this.unit).name}, 队伍: {<>4__this.unit.Team}, 是否死亡: {<>4__this.unit.dead}"); } 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(); } } private Unit unit; public GameObject 实例化ui; private void Start() { if ((Object)(object)实例化ui == (Object)null) { Debug.LogError((object)"[额外ui生成器] 实例化ui 预制体未在Inspector中赋值!"); return; } if ((Object)(object)((Component)this).transform.root == (Object)null) { Debug.LogError((object)"[额外ui生成器] transform.root 为 null"); return; } unit = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)unit == (Object)null) { Debug.LogError((object)("[额外ui生成器] 在根物体 '" + ((Object)((Component)this).transform.root).name + "' 上找不到 Unit 组件")); } else { ((MonoBehaviour)this).StartCoroutine(InitializeUIDelayed()); } } [IteratorStateMachine(typeof(d__3))] private IEnumerator InitializeUIDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { <>4__this = this }; } private void OnDestroy() { if ((Object)(object)unit != (Object)null) { Debug.Log((object)("[额外ui生成器] 组件销毁,单位: " + ((Object)unit).name)); } } } public class 额外ui系统基类 : MonoBehaviour { protected Unit 当前unit组件; public virtual void 初始化(Unit 外部传入unit组件) { if ((Object)(object)外部传入unit组件 == (Object)null) { Debug.LogError((object)"传入数据为空!!!"); } else { 当前unit组件 = 外部传入unit组件; } } } } namespace HeMoDingDingMod.角色类.武装直升机 { public class ai兵种地面管理 : MonoBehaviour { public 自定义重力 重力组件引用; public DataHandler 单位数据引用; private void Update() { //IL_005c: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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) if ((!((Object)(object)单位数据引用 != (Object)null) || !单位数据引用.Dead) && !((Object)(object)重力组件引用 == (Object)null) && !((Object)(object)单位数据引用 == (Object)null) && 重力组件引用.获取是否接触地面()) { 重力组件引用.获取接触地面位置(); if (true) { DataHandler obj = 单位数据引用; Vector3 val = 重力组件引用.获取接触地面位置(); RaycastHit val2 = 重力组件引用.获取检测信息(); obj.TouchGround(val, ((RaycastHit)(ref val2)).normal, (Rigidbody)null); } } } } public class df旋转动画 : MonoBehaviour { public float 最大转速; public Vector3 旋转轴; public AnimationCurve 转速增长曲线 = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f); public AnimationCurve 转速减少曲线 = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); public float 加速时间 = 1f; public float 减速时间 = 1f; private float 当前时间 = 0f; private bool 是否加速中 = false; private bool 是否减速中 = false; private float 剩余旋转时间 = 0f; public bool 是否旋转中 = false; private void Update() { 执行旋转(); if (!是否减速中 && 是否旋转中 && !是否加速中) { 剩余旋转时间 -= Time.deltaTime; if (剩余旋转时间 <= 0f) { 停止旋转(); } } } private void 执行旋转() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) float num = 计算当前转速(); ((Component)this).transform.Rotate(旋转轴, num * Time.deltaTime, (Space)1); } private float 计算当前转速() { if (是否减速中) { 当前时间 += Time.deltaTime; float num = Mathf.Clamp01(当前时间 / 减速时间); float num2 = 转速减少曲线.Evaluate(num); if (num >= 1f) { 是否减速中 = false; 是否旋转中 = false; return 0f; } return 最大转速 * num2; } if (是否旋转中 && 是否加速中) { 当前时间 += Time.deltaTime; float num3 = Mathf.Clamp01(当前时间 / 加速时间); float num4 = 转速增长曲线.Evaluate(num3); if (num3 >= 1f) { 是否加速中 = false; return 最大转速; } return 最大转速 * num4; } if (是否旋转中 && !是否加速中 && !是否减速中) { return 最大转速; } return 0f; } public void 开始旋转() { if (是否减速中) { 是否减速中 = false; } if (!是否旋转中) { 是否旋转中 = true; 是否加速中 = true; 当前时间 = 0f; } else if (!是否加速中 && 是否减速中) { } } public void 停止旋转() { if (是否旋转中) { 是否减速中 = true; 是否加速中 = false; 当前时间 = 0f; 剩余旋转时间 = 0f; } } public void 旋转一段时间(float 持续时间) { 开始旋转(); if (是否加速中) { 剩余旋转时间 = 持续时间; } else { 剩余旋转时间 = 持续时间; } } } public class 战斗开始时事件asd : MonoBehaviour { private GameStateManager man; private bool 已开始 = false; public UnityEvent 开始战斗事件; private void Start() { man = ServiceLocator.GetService(); if (man == null) { Debug.LogError((object)"GameStateManager not found in ServiceLocator"); } } private void Update() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (!已开始 && (int)man.GameState == 1) { UnityEvent obj = 开始战斗事件; if (obj != null) { obj.Invoke(); } 已开始 = true; ((Behaviour)this).enabled = false; } } } [RequireComponent(typeof(MeshRenderer))] public class 材质渲染贴图新建实例 : MonoBehaviour { [Header("摄像机设置")] public Camera 渲染摄像机; public Camera 观察摄像机; [Header("距离优化")] [Tooltip("完整渲染距离(米)")] public float 完整渲染距离 = 15f; [Tooltip("最大渲染距离(米),超出后完全禁用")] public float 最大渲染距离 = 30f; [Tooltip("基础像素密度(每米像素数)")] public float 基础像素密度 = 128f; [Tooltip("最小像素密度(每米像素数)")] public float 最小像素密度 = 16f; [Header("优化设置")] [Tooltip("检查更新的频率(秒)")] public float 检测频率 = 0.5f; [Tooltip("是否启用动态调整")] public bool 启用优化 = true; [Header("调试")] public bool 显示调试信息 = false; private MeshRenderer 网格渲染器; private RenderTexture 当前渲染贴图; private Material 动态材质; private Vector3 上次缩放; private float 当前像素密度; private bool 当前是否启用 = true; private float 下次检测时间; private Vector3 平面尺寸; private int 当前像素宽度; private int 当前像素高度; private void Start() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //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) 网格渲染器 = ((Component)this).GetComponent(); if ((Object)(object)观察摄像机 == (Object)null) { 观察摄像机 = Camera.main; if ((Object)(object)观察摄像机 == (Object)null) { Debug.LogWarning((object)"未找到主摄像机,将使用场景中第一个激活的摄像机"); 观察摄像机 = Camera.allCameras[0]; } } if ((Object)(object)渲染摄像机 == (Object)null) { Debug.LogError((object)"请指定渲染摄像机!"); ((Behaviour)this).enabled = false; return; } 渲染摄像机.targetDisplay = -1; 动态材质 = new Material(((Renderer)网格渲染器).material); ((Renderer)网格渲染器).material = 动态材质; 上次缩放 = ((Component)this).transform.localScale; 计算平面尺寸(); 下次检测时间 = Time.time; 更新渲染质量(); } private void Update() { //IL_0038: 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_0059: 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) if (启用优化 && Time.time >= 下次检测时间) { 下次检测时间 = Time.time + 检测频率; if (上次缩放 != ((Component)this).transform.localScale) { 上次缩放 = ((Component)this).transform.localScale; 计算平面尺寸(); 重建渲染贴图(); } else { 更新渲染质量(); } } } private void 计算平面尺寸() { //IL_0008: 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) 平面尺寸 = ((Component)this).transform.localScale; } private void 更新渲染质量() { //IL_001c: 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) if ((Object)(object)观察摄像机 == (Object)null) { return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)观察摄像机).transform.position); bool flag = num <= 最大渲染距离; float num2; if (num <= 完整渲染距离) { num2 = 基础像素密度; } else if (num >= 最大渲染距离) { num2 = 0f; } else { float num3 = (num - 完整渲染距离) / (最大渲染距离 - 完整渲染距离); num2 = Mathf.Lerp(基础像素密度, 最小像素密度, num3); } if (!flag || num2 <= 0f) { if (当前是否启用) { 禁用渲染器(); } return; } if (!当前是否启用) { 启用渲染器(); } if (Mathf.Abs(当前像素密度 - num2) > 1f) { 当前像素密度 = num2; 重建渲染贴图(); } } private void 重建渲染贴图() { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)当前渲染贴图 != (Object)null) { 当前渲染贴图.Release(); Object.Destroy((Object)(object)当前渲染贴图); } int num = Mathf.Max(1, Mathf.RoundToInt(平面尺寸.x * 当前像素密度)); int num2 = Mathf.Max(1, Mathf.RoundToInt(平面尺寸.y * 当前像素密度)); num = Mathf.Min(num, 2048); num2 = Mathf.Min(num2, 2048); if (!((Object)(object)当前渲染贴图 != (Object)null) || 当前像素宽度 != num || 当前像素高度 != num2) { 当前像素宽度 = num; 当前像素高度 = num2; 当前渲染贴图 = new RenderTexture(当前像素宽度, 当前像素高度, 24); ((Object)当前渲染贴图).name = ((Object)((Component)this).gameObject).name + "_RenderTexture"; 当前渲染贴图.useMipMap = false; 当前渲染贴图.autoGenerateMips = false; 当前渲染贴图.Create(); 动态材质.mainTexture = (Texture)(object)当前渲染贴图; 渲染摄像机.targetTexture = 当前渲染贴图; if (显示调试信息) { Debug.Log((object)($"[{((Object)((Component)this).gameObject).name}] 重建渲染贴图: {当前像素宽度}x{当前像素高度} " + $"(密度:{当前像素密度:F1}px/m, 距离:{Vector3.Distance(((Component)this).transform.position, ((Component)观察摄像机).transform.position):F1}m)")); } } } private void 启用渲染器() { 当前是否启用 = true; ((Renderer)网格渲染器).enabled = true; ((Behaviour)渲染摄像机).enabled = true; 渲染摄像机.targetDisplay = -1; if (显示调试信息) { Debug.Log((object)("[" + ((Object)((Component)this).gameObject).name + "] 启用渲染器")); } } private void 禁用渲染器() { //IL_0062: 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) 当前是否启用 = false; ((Renderer)网格渲染器).enabled = false; ((Behaviour)渲染摄像机).enabled = false; if ((Object)(object)当前渲染贴图 != (Object)null) { 渲染摄像机.targetTexture = null; } if (显示调试信息) { Debug.Log((object)$"[{((Object)((Component)this).gameObject).name}] 禁用渲染器 (距离:{Vector3.Distance(((Component)this).transform.position, ((Component)观察摄像机).transform.position):F1}m > {最大渲染距离}m)"); } } private void OnDestroy() { if ((Object)(object)当前渲染贴图 != (Object)null) { 当前渲染贴图.Release(); Object.Destroy((Object)(object)当前渲染贴图); } if ((Object)(object)动态材质 != (Object)null) { Object.Destroy((Object)(object)动态材质); } if ((Object)(object)渲染摄像机 != (Object)null && (Object)(object)渲染摄像机.targetTexture == (Object)(object)当前渲染贴图) { 渲染摄像机.targetTexture = null; } } public void 手动设置像素密度(float 密度) { 基础像素密度 = Mathf.Max(1f, 密度); 更新渲染质量(); } public void 手动设置距离阈值(float 完整距离, float 最大距离) { 完整渲染距离 = Mathf.Max(1f, 完整距离); 最大渲染距离 = Mathf.Max(完整距离 + 1f, 最大距离); 更新渲染质量(); } private void OnDrawGizmosSelected() { //IL_0013: 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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)this).enabled) { Gizmos.color = Color.green; Gizmos.DrawWireSphere(((Component)this).transform.position, 完整渲染距离); Gizmos.color = Color.yellow; Gizmos.DrawWireSphere(((Component)this).transform.position, 最大渲染距离); if ((Object)(object)观察摄像机 != (Object)null && Application.isPlaying) { Gizmos.color = Color.red; Gizmos.DrawLine(((Component)this).transform.position, ((Component)观察摄像机).transform.position); } } } } public class 武器面向目标 : MonoBehaviour { private Unit 此单位; private DataHandler 单位数据; public float 限制角度 = 70f; public float 旋转速度 = 90f; private Quaternion 初始局部旋转; private Transform 父物体; private void Start() { //IL_0074: 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) 此单位 = ((Component)((Component)this).transform.root).GetComponent(); if (Object.op_Implicit((Object)(object)此单位)) { 单位数据 = 此单位.data; } 父物体 = ((Component)this).transform.parent; if ((Object)(object)父物体 == (Object)null) { 父物体 = ((Component)this).transform.root; } 初始局部旋转 = ((Component)this).transform.localRotation; } private void Update() { //IL_0052: 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_005f: 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) //IL_0069: 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_0073: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)单位数据 == (Object)null) && !((Object)(object)单位数据.targetData == (Object)null) && !单位数据.Dead) { Vector3 position = 单位数据.targetData.mainRig.position; Vector3 val = position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion val2 = Quaternion.LookRotation(normalized); if (限制角度 > 0f && 限制角度 < 360f) { val2 = 限制旋转角度(val2); } ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val2, Time.deltaTime * 旋转速度); } } private Quaternion 限制旋转角度(Quaternion 目标旋转) { //IL_001c: 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_0026: 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_002c: 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_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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0084: 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_008a: 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)父物体 == (Object)null) { return 目标旋转; } Quaternion val = Quaternion.Inverse(父物体.rotation) * 目标旋转; Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; float num = eulerAngles.y; if (num > 180f) { num -= 360f; } num = Mathf.Clamp(num, 0f - 限制角度, 限制角度); val = Quaternion.Euler(eulerAngles.x, num, eulerAngles.z); return 父物体.rotation * val; } private void OnDrawGizmosSelected() { //IL_0041: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0067: 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_0071: 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_0073: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0101: 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_0109: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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) if (!(限制角度 <= 0f)) { Transform val = ((Component)this).transform.parent; if ((Object)(object)val == (Object)null) { val = ((Component)this).transform.root; } Gizmos.color = Color.yellow; Vector3 position = ((Component)this).transform.position; Vector3 forward = val.forward; Quaternion val2 = Quaternion.AngleAxis(0f - 限制角度, val.up); Vector3 val3 = val2 * forward; Gizmos.DrawRay(position, val3 * 5f); Quaternion val4 = Quaternion.AngleAxis(限制角度, val.up); Vector3 val5 = val4 * forward; Gizmos.DrawRay(position, val5 * 5f); Vector3 val6 = val3; for (int i = 1; i <= 20; i++) { float num = 0f - 限制角度 + 限制角度 * 2f * (float)i / 20f; Quaternion val7 = Quaternion.AngleAxis(num, val.up); Vector3 val8 = val7 * forward; Gizmos.DrawLine(position + val6 * 3f, position + val8 * 3f); val6 = val8; } } } } public class 物理直升机控制 : MonoBehaviour { [Header("组件引用")] public Rigidbody 主刚体; public Transform 螺旋桨施力点; public Transform 尾部螺旋桨施力点; [Header("主旋翼物理参数")] public float 最大主螺旋桨力 = 50f; public float 最大尾部螺旋桨力 = 30f; public float 最大翻滚力矩 = 20f; public float 最大俯仰力矩 = 20f; [Header("推进力参数")] public float 最大前向推力 = 15f; public float 推进力响应速度 = 2f; public float 倾斜推进加成 = 1.5f; [Header("角度限制")] public float 最大翻滚角度 = 30f; public float 最大俯仰角度 = 25f; public float 回正力矩系数 = 2f; public float 角速度阻尼系数 = 0.5f; [Header("当前状态(只读)")] [SerializeField] private float 当前主螺旋桨力 = 0f; [SerializeField] private float 当前尾部螺旋桨力 = 0f; [SerializeField] private float 尾部力系数 = 0f; [SerializeField] private float 当前翻滚系数 = 0f; [SerializeField] private float 当前俯仰系数 = 0f; [SerializeField] private float 当前翻滚角度 = 0f; [SerializeField] private float 当前俯仰角度 = 0f; [SerializeField] private float 当前前向推力 = 0f; [Header("平滑控制")] public float 力变化速度 = 3f; public float 力矩变化速度 = 3f; private float 目标主螺旋桨力; private float 目标尾部螺旋桨力; private float 目标翻滚系数; private float 目标俯仰系数; private float 当前翻滚力矩; private float 当前俯仰力矩; private float 目标前向推力; private void Awake() { if ((Object)(object)主刚体 == (Object)null) { 主刚体 = ((Component)this).GetComponent(); } if ((Object)(object)螺旋桨施力点 == (Object)null) { 螺旋桨施力点 = ((Component)this).transform; } if ((Object)(object)尾部螺旋桨施力点 == (Object)null) { 尾部螺旋桨施力点 = ((Component)this).transform; } } private void Start() { if ((Object)(object)主刚体 != (Object)null) { 主刚体.maxAngularVelocity = 5f; } } private void FixedUpdate() { if (!((Object)(object)主刚体 == (Object)null)) { 计算当前姿态角度(); 平滑更新力(); 平滑更新力矩(); 平滑更新推进力(); 施加主螺旋桨力(); 施加尾部螺旋桨力(); 施加前向推力(); 施加翻滚俯仰控制(); 应用自动回正和角度限制(); } } private void 计算当前姿态角度() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0012: 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_001e: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_004d: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Vector3 up = ((Component)this).transform.up; Vector3 up2 = Vector3.up; Vector3 val = Vector3.ProjectOnPlane(((Component)this).transform.forward, up2); if (((Vector3)(ref val)).magnitude > 0.01f) { 当前俯仰角度 = Vector3.SignedAngle(val, ((Component)this).transform.forward, ((Component)this).transform.right); } Vector3 val2 = Vector3.ProjectOnPlane(((Component)this).transform.right, up2); if (((Vector3)(ref val2)).magnitude > 0.01f) { 当前翻滚角度 = Vector3.SignedAngle(val2, ((Component)this).transform.right, ((Component)this).transform.forward); } } private void 平滑更新力() { 当前主螺旋桨力 = Mathf.Lerp(当前主螺旋桨力, 目标主螺旋桨力, Time.fixedDeltaTime * 力变化速度); 当前尾部螺旋桨力 = Mathf.Lerp(当前尾部螺旋桨力, 目标尾部螺旋桨力, Time.fixedDeltaTime * 力变化速度); } private void 平滑更新推进力() { 当前前向推力 = Mathf.Lerp(当前前向推力, 目标前向推力, Time.fixedDeltaTime * 推进力响应速度); } private void 平滑更新力矩() { float num = 目标翻滚系数 * 最大翻滚力矩; float num2 = 目标俯仰系数 * 最大俯仰力矩; 当前翻滚力矩 = Mathf.Lerp(当前翻滚力矩, num, Time.fixedDeltaTime * 力矩变化速度); 当前俯仰力矩 = Mathf.Lerp(当前俯仰力矩, num2, Time.fixedDeltaTime * 力矩变化速度); 当前翻滚系数 = Mathf.Lerp(当前翻滚系数, 目标翻滚系数, Time.fixedDeltaTime * 力矩变化速度); 当前俯仰系数 = Mathf.Lerp(当前俯仰系数, 目标俯仰系数, Time.fixedDeltaTime * 力矩变化速度); } private void 施加主螺旋桨力() { //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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) if (!((Object)(object)螺旋桨施力点 == (Object)null) && !Mathf.Approximately(当前主螺旋桨力, 0f)) { Vector3 up = 螺旋桨施力点.up; float num = Mathf.Clamp(当前主螺旋桨力, 0f, 最大主螺旋桨力); 主刚体.AddForceAtPosition(up * num, 螺旋桨施力点.position, (ForceMode)5); } } private void 施加尾部螺旋桨力() { //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_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_0065: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)尾部螺旋桨施力点 == (Object)null) && !Mathf.Approximately(当前尾部螺旋桨力, 0f)) { Vector3 val = -尾部螺旋桨施力点.right; float num = Mathf.Clamp(当前尾部螺旋桨力, 0f - 最大尾部螺旋桨力, 最大尾部螺旋桨力); 主刚体.AddForceAtPosition(val * num, 尾部螺旋桨施力点.position, (ForceMode)5); } } private void 施加前向推力() { //IL_0020: 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_009f: 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) if (!Mathf.Approximately(当前前向推力, 0f)) { Vector3 forward = ((Component)this).transform.forward; float num = 1f + Mathf.Abs(当前俯仰角度) / 最大俯仰角度 * 倾斜推进加成; if ((当前俯仰角度 > 0f && 当前前向推力 > 0f) || (当前俯仰角度 < 0f && 当前前向推力 < 0f)) { num *= 1.2f; } float num2 = 当前前向推力 * num; 主刚体.AddForce(forward * num2, (ForceMode)5); } } private void 施加翻滚俯仰控制() { //IL_0059: 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) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(当前翻滚角度) < 最大翻滚角度 || (当前翻滚角度 > 0f && 当前翻滚力矩 < 0f) || (当前翻滚角度 < 0f && 当前翻滚力矩 > 0f)) { 主刚体.AddRelativeTorque(Vector3.forward * 当前翻滚力矩, (ForceMode)5); } if (Mathf.Abs(当前俯仰角度) < 最大俯仰角度 || (当前俯仰角度 > 0f && 当前俯仰力矩 < 0f) || (当前俯仰角度 < 0f && 当前俯仰力矩 > 0f)) { 主刚体.AddRelativeTorque(Vector3.right * 当前俯仰力矩, (ForceMode)5); } } private void 应用自动回正和角度限制() { //IL_0016: 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_0037: 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_0071: 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_008b: 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_00b2: Unknown result type (might be due to invalid IL or missing references) float num = (0f - 当前翻滚角度) * 回正力矩系数; float num2 = (0f - 主刚体.angularVelocity.z) * 角速度阻尼系数; 主刚体.AddRelativeTorque(Vector3.forward * (num + num2), (ForceMode)5); float num3 = (0f - 当前俯仰角度) * 回正力矩系数; float num4 = (0f - 主刚体.angularVelocity.x) * 角速度阻尼系数; 主刚体.AddRelativeTorque(Vector3.right * (num3 + num4), (ForceMode)5); float num5 = (0f - 主刚体.angularVelocity.y) * 角速度阻尼系数 * 0.5f; 主刚体.AddRelativeTorque(Vector3.up * num5, (ForceMode)5); } public void 设置主升力系数(float 系数) { 系数 = Mathf.Clamp01(系数); 目标主螺旋桨力 = 系数 * 最大主螺旋桨力; } public void 设置尾部推力系数(float 系数) { 系数 = Mathf.Clamp(系数, -1f, 1f); 目标尾部螺旋桨力 = 系数 * 最大尾部螺旋桨力; 尾部力系数 = 系数; } public void 设置翻滚系数(float 系数) { 目标翻滚系数 = Mathf.Clamp(系数, -1f, 1f); } public void 设置俯仰系数(float 系数) { 目标俯仰系数 = Mathf.Clamp(系数, -1f, 1f); 目标前向推力 = 系数 * 最大前向推力; } public void 设置前向推力系数(float 系数) { 系数 = Mathf.Clamp(系数, -1f, 1f); 目标前向推力 = 系数 * 最大前向推力; } public void 重置所有力() { 目标主螺旋桨力 = 0f; 目标尾部螺旋桨力 = 0f; 目标翻滚系数 = 0f; 目标俯仰系数 = 0f; 目标前向推力 = 0f; 当前主螺旋桨力 = 0f; 当前尾部螺旋桨力 = 0f; 当前翻滚力矩 = 0f; 当前俯仰力矩 = 0f; 当前翻滚系数 = 0f; 当前俯仰系数 = 0f; 当前前向推力 = 0f; 尾部力系数 = 0f; } public void 紧急停止() { //IL_001f: 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) 重置所有力(); if ((Object)(object)主刚体 != (Object)null) { 主刚体.velocity = Vector3.zero; 主刚体.angularVelocity = Vector3.zero; } } public float 获取当前主升力() { return 当前主螺旋桨力; } public float 获取当前尾部推力() { return 当前尾部螺旋桨力; } public float 获取当前尾部力系数() { return 尾部力系数; } public float 获取主升力系数() { return (最大主螺旋桨力 > 0f) ? (当前主螺旋桨力 / 最大主螺旋桨力) : 0f; } public float 获取当前翻滚系数() { return 当前翻滚系数; } public float 获取当前俯仰系数() { return 当前俯仰系数; } public float 获取当前翻滚角度() { return 当前翻滚角度; } public float 获取当前俯仰角度() { return 当前俯仰角度; } public float 获取当前前向推力() { return 当前前向推力; } public float 获取翻滚角度系数() { return (最大翻滚角度 > 0f) ? Mathf.Clamp(当前翻滚角度 / 最大翻滚角度, -1f, 1f) : 0f; } public float 获取俯仰角度系数() { return (最大俯仰角度 > 0f) ? Mathf.Clamp(当前俯仰角度 / 最大俯仰角度, -1f, 1f) : 0f; } private void OnDrawGizmos() { //IL_0012: 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_0039: 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_004e: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00a2: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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) if ((Object)(object)螺旋桨施力点 != (Object)null) { Gizmos.color = Color.green; Gizmos.DrawWireSphere(螺旋桨施力点.position, 0.2f); Gizmos.DrawRay(螺旋桨施力点.position, 螺旋桨施力点.up * 2f); } if ((Object)(object)尾部螺旋桨施力点 != (Object)null) { Gizmos.color = Color.red; Gizmos.DrawWireSphere(尾部螺旋桨施力点.position, 0.2f); Gizmos.DrawRay(尾部螺旋桨施力点.position, -尾部螺旋桨施力点.right * 2f); } if (Application.isPlaying && !Mathf.Approximately(当前前向推力, 0f)) { Gizmos.color = Color.blue; Gizmos.DrawRay(((Component)this).transform.position, ((Component)this).transform.forward * (当前前向推力 / 最大前向推力) * 3f); } if (Application.isPlaying) { Gizmos.color = Color.yellow; Gizmos.DrawRay(((Component)this).transform.position, ((Component)this).transform.right * 3f); Gizmos.color = Color.cyan; Gizmos.DrawRay(((Component)this).transform.position, ((Component)this).transform.forward * 3f); } } } public class 模拟直升机姿态仪 : MonoBehaviour { [Header("跟随设置")] public Transform 跟随目标; [Header("旋转设置")] public bool 跟随目标旋转 = true; public float 旋转平滑度 = 5f; [Header("姿态仪类型")] public bool 显示俯仰和滚转 = true; public bool 显示偏航 = false; [Header("姿态限制")] public float 最大俯仰角度 = 80f; public float 最大滚转角度 = 180f; private Quaternion 目标旋转; private Vector3 上一帧欧拉角; private void Start() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)跟随目标 == (Object)null) { Debug.LogError((object)"模拟直升机姿态仪:未设置跟随目标!"); return; } 目标旋转 = ((Component)this).transform.rotation; 上一帧欧拉角 = 跟随目标.eulerAngles; } private void Update() { if (!((Object)(object)跟随目标 == (Object)null)) { 更新位置(); if (跟随目标旋转) { 更新旋转(); } } } private void 更新位置() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = 跟随目标.position; } private void 更新旋转() { //IL_003e: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_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_001e: 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) if (显示俯仰和滚转) { if (显示偏航) { 目标旋转 = 跟随目标.rotation; } else { 目标旋转 = 计算姿态仪旋转(); } } else { 目标旋转 = Quaternion.identity; } ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, 目标旋转, 旋转平滑度 * Time.deltaTime); } private Quaternion 计算姿态仪旋转() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_002f: 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_004b: 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_0054: Unknown result type (might be due to invalid IL or missing references) Vector3 eulerAngles = 跟随目标.eulerAngles; float num = 标准化角度(eulerAngles.x); num = Mathf.Clamp(num, 0f - 最大俯仰角度, 最大俯仰角度); float num2 = 标准化角度(eulerAngles.z); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num, 0f, 0f - num2); return Quaternion.Euler(val); } private float 标准化角度(float 角度) { if (角度 > 180f) { return 角度 - 360f; } return 角度; } public void 校准姿态仪() { //IL_0008: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) 上一帧欧拉角 = 跟随目标.eulerAngles; 目标旋转 = ((Component)this).transform.rotation; } public void 设置跟随旋转(bool 是否跟随) { 跟随目标旋转 = 是否跟随; } public void 重置到水平状态() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localRotation = Quaternion.identity; } private void OnDrawGizmos() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0058: 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_006d: 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_0093: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)跟随目标 != (Object)null) { Gizmos.color = Color.yellow; Gizmos.DrawLine(((Component)this).transform.position, 跟随目标.position); Gizmos.color = Color.blue; Gizmos.DrawRay(((Component)this).transform.position, ((Component)this).transform.forward * 2f); Gizmos.color = Color.green; Gizmos.DrawRay(((Component)this).transform.position, ((Component)this).transform.up * 2f); } } } public class 直升机输入控制 : MonoBehaviour { public 物理直升机控制 直升机控制器; public 自定义重力 重力系统; public PossesionCamera 第三人才偏移; [Header("力度设置")] public float 力度增长时间 = 1f; public float 力度下降时间 = 1.5f; public AnimationCurve curve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f); [Header("AD键设置")] public float ad键增长速度 = 2f; public float ad键回归速度 = 2f; private float ad增长 = 0f; [Header("WS键设置")] public float ws键增长速度 = 2f; public float ws键回归速度 = 2f; private float ws增长 = 0f; [Header("QE键设置(偏航)")] public float qe键增长速度 = 2f; public float qe键回归速度 = 2f; private float qe增长 = 0f; [Header("高度限制设置")] public float 目标悬停高度 = 15f; public float 高度限制范围 = 5f; public float 最小升力系数 = 0.3f; public bool 启用高度限制 = true; public bool 启用 = false; public bool 开启ai操控 = true; public bool 总体启动 = true; [Range(0f, 1f)] private float 当前上升力 = 0f; private float 计时器 = 0f; private bool 是否按住 = false; private float 当前高度 = 0f; private float 高度限制系数 = 1f; private float 自动悬停补偿 = 0f; private void Start() { if ((Object)(object)直升机控制器 == (Object)null) { 直升机控制器 = ((Component)this).GetComponent<物理直升机控制>(); } if ((Object)(object)重力系统 == (Object)null) { 重力系统 = ((Component)this).GetComponent<自定义重力>(); } if ((Object)(object)重力系统 == (Object)null) { 重力系统 = Object.FindObjectOfType<自定义重力>(); } } public void 设置启用(bool b = true) { bool flag = 启用; 启用 = b; if (b) { float num = 直升机控制器.获取主升力系数(); float num2 = 直升机控制器.获取当前尾部力系数(); float num3 = 直升机控制器.获取当前翻滚系数(); float num4 = 直升机控制器.获取当前俯仰系数(); 计时器 = 反向计算曲线值(num); ws增长 = num4; ad增长 = 0f - num3; qe增长 = 0f - num2; ws增长 = Mathf.Clamp(ws增长, -1f, 1f); ad增长 = Mathf.Clamp(ad增长, -1f, 1f); qe增长 = Mathf.Clamp(qe增长, -1f, 1f); 计时器 = Mathf.Clamp01(计时器); 是否按住 = false; Debug.Log((object)$"切换到手动操控 - 升力:{num:F2} 计时器:{计时器:F2} 俯仰:{ws增长:F2} 翻滚:{ad增长:F2} 偏航:{qe增长:F2}"); } } private float 反向计算曲线值(float 目标升力系数) { if (目标升力系数 <= 0f) { return 0f; } if (目标升力系数 >= 1f) { return 1f; } float result = 0f; float num = float.MaxValue; for (float num2 = 0f; num2 <= 1f; num2 += 0.01f) { float num3 = curve.Evaluate(num2); float num4 = Mathf.Abs(num3 - 目标升力系数); if (num4 < num) { num = num4; result = num2; } } return result; } public void 设置整体启动启动(bool g = true) { 总体启动 = g; } public void 单位死亡() { 总体启动 = false; 直升机控制器.重置所有力(); } private void Update() { if (总体启动 && 启用) { 手动操控(); } } private void 手动操控() { 更新高度信息(); 空格输入(); ws键输入(); ad键输入(); qe键输入(); 设置鼠标滚轮缩放(); if (启用高度限制 && 是否按住) { 应用高度限制(); } } private void 更新高度信息() { if ((Object)(object)重力系统 != (Object)null) { 当前高度 = 重力系统.获取当前高度(); } } private void 空格输入() { 计算高度限制系数(); if (Input.GetKey((KeyCode)32)) { 是否按住 = true; 自动悬停补偿 = 0f; 计时器 += Time.deltaTime / 力度增长时间; 计时器 = Mathf.Clamp01(计时器); float num = curve.Evaluate(计时器); if (启用高度限制) { num *= 高度限制系数; } 直升机控制器.设置主升力系数(num); } else if (是否按住 || 计时器 > 0f) { 是否按住 = false; 计时器 -= Time.deltaTime / 力度下降时间; 计时器 = Mathf.Clamp01(计时器); float num2 = curve.Evaluate(计时器); if (启用高度限制) { num2 *= 高度限制系数; } 直升机控制器.设置主升力系数(num2); } } private void ws键输入() { float num = 0f; if (Input.GetKey((KeyCode)119)) { num += 1f; } if (Input.GetKey((KeyCode)115)) { num -= 1f; } if (num != 0f) { ws增长 = Mathf.MoveTowards(ws增长, num, ws键增长速度 * Time.deltaTime); } else { ws增长 = Mathf.MoveTowards(ws增长, 0f, ws键回归速度 * Time.deltaTime); } ws增长 = Mathf.Clamp(ws增长, -1f, 1f); 直升机控制器.设置俯仰系数(ws增长); } private void ad键输入() { float num = 0f; if (Input.GetKey((KeyCode)97)) { num += 1f; } if (Input.GetKey((KeyCode)100)) { num -= 1f; } if (num != 0f) { ad增长 = Mathf.MoveTowards(ad增长, num, ad键增长速度 * Time.deltaTime); } else { ad增长 = Mathf.MoveTowards(ad增长, 0f, ad键回归速度 * Time.deltaTime); } ad增长 = Mathf.Clamp(ad增长, -1f, 1f); 直升机控制器.设置翻滚系数(ad增长); } private void qe键输入() { float num = 0f; if (Input.GetKey((KeyCode)113)) { num += 1f; } if (Input.GetKey((KeyCode)101)) { num -= 1f; } if (num != 0f) { qe增长 = Mathf.MoveTowards(qe增长, num, qe键增长速度 * Time.deltaTime); } else { qe增长 = Mathf.MoveTowards(qe增长, 0f, qe键回归速度 * Time.deltaTime); } qe增长 = Mathf.Clamp(qe增长, -1f, 1f); 直升机控制器.设置尾部推力系数(qe增长); } private void 计算高度限制系数() { if ((Object)(object)重力系统 == (Object)null || !启用高度限制) { 高度限制系数 = 1f; } else if (当前高度 > 目标悬停高度) { float num = 当前高度 - 目标悬停高度; if (num < 高度限制范围) { float num2 = num / 高度限制范围; 高度限制系数 = Mathf.Lerp(1f, 最小升力系数, num2); } else { 高度限制系数 = 最小升力系数; } } else { 高度限制系数 = 1f; } } private void 应用高度限制() { if (!是否按住) { float num = 直升机控制器.获取主升力系数(); float 系数 = num * 高度限制系数; if (高度限制系数 < 0.99f) { 直升机控制器.设置主升力系数(系数); } } } public void 设置悬停高度(float 高度) { 目标悬停高度 = Mathf.Max(1f, 高度); } public float 获取当前高度() { return 当前高度; } public float 获取高度限制系数() { return 高度限制系数; } public void 切换高度限制(bool 启用) { 启用高度限制 = 启用; } private void 设置鼠标滚轮缩放() { if (!((Object)(object)第三人才偏移 == (Object)null)) { float axis = Input.GetAxis("Mouse ScrollWheel"); if (axis != 0f) { 第三人才偏移.thirdPersonOffset.z += axis * 2f; } } } } public class 直升机抗性添加工具 : MonoBehaviour { private void Start() { Transform root = ((Component)this).transform.root; 抛射物免疫组件ghao 抛射物免疫组件ghao = ((Component)root).gameObject.AddComponent<抛射物免疫组件ghao>(); 抛射物免疫组件ghao.免疫最低 = true; 抛射物免疫组件ghao.抛射物抗性 = 0f; } } public class 直升机螺旋桨音效控制器 : MonoBehaviour { public AudioSource 音频组件; public 物理直升机控制 直升机组件; [Header("音量设置")] public float 最小音量 = 0.2f; public float 最大音量 = 1f; public AnimationCurve 音量曲线 = AnimationCurve.Linear(0f, 0f, 1f, 1f); [Header("音调设置")] public float 最小音调 = 0.5f; public float 最大音调 = 1.5f; public AnimationCurve 音调曲线 = AnimationCurve.Linear(0f, 0f, 1f, 1f); [Header("平滑过渡")] public float 音量平滑速度 = 5f; public float 音调平滑速度 = 5f; private float 当前目标音量; private float 当前目标音调; private float 当前音量; private float 当前音调; private void Start() { if ((Object)(object)音频组件 == (Object)null) { 音频组件 = ((Component)this).GetComponent(); } if ((Object)(object)音频组件 != (Object)null) { 音频组件.loop = true; 音频组件.playOnAwake = false; if (!音频组件.isPlaying) { 音频组件.Play(); } } 当前音量 = 最小音量; 当前音调 = 最小音调; 当前目标音量 = 最小音量; 当前目标音调 = 最小音调; } private void Update() { if (!((Object)(object)直升机组件 == (Object)null) && !((Object)(object)音频组件 == (Object)null)) { float num = 直升机组件.获取主升力系数(); 当前目标音量 = Mathf.Lerp(最小音量, 最大音量, 音量曲线.Evaluate(num)); 当前目标音调 = Mathf.Lerp(最小音调, 最大音调, 音调曲线.Evaluate(num)); 当前音量 = Mathf.Lerp(当前音量, 当前目标音量, Time.deltaTime * 音量平滑速度); 当前音调 = Mathf.Lerp(当前音调, 当前目标音调, Time.deltaTime * 音调平滑速度); 音频组件.volume = 当前音量; 音频组件.pitch = 当前音调; } } private void OnDisable() { if ((Object)(object)音频组件 != (Object)null && 音频组件.isPlaying) { 音频组件.Stop(); } } } public class 直升机起飞风浪 : MonoBehaviour { public ParticleSystem 风浪粒子效果; public 物理直升机控制 直升机主类; public 自定义重力 地面位置高度获取工具; public float 最大粒子可发射距离 = 5f; public float 粒子完整发射距离 = 1f; private EmissionModule 粒子发射模块; private float 原始粒子发射率; private void Start() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_002f: 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_004c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)风浪粒子效果 != (Object)null) { 粒子发射模块 = 风浪粒子效果.emission; MinMaxCurve rateOverTime = ((EmissionModule)(ref 粒子发射模块)).rateOverTime; 原始粒子发射率 = ((MinMaxCurve)(ref rateOverTime)).constant; rateOverTime = ((EmissionModule)(ref 粒子发射模块)).rateOverTime; Debug.Log((object)("以获取发射率:" + ((MinMaxCurve)(ref rateOverTime)).constant)); } } private void Update() { //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_013e: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)风浪粒子效果 == (Object)null || (Object)(object)直升机主类 == (Object)null || (Object)(object)地面位置高度获取工具 == (Object)null) { return; } if (地面位置高度获取工具.获取是否接触地面()) { float num = 直升机主类.获取主升力系数(); float num2 = 地面位置高度获取工具.获取当前高度(); float num3 = 最大粒子可发射距离 - num2; EmissionModule emission = 风浪粒子效果.emission; if (num3 >= 0f) { float num4; if (num3 >= 粒子完整发射距离) { num4 = 原始粒子发射率 * num; } else { float num5 = Mathf.Clamp01(num3 / 粒子完整发射距离); num4 = 原始粒子发射率 * num5 * num; } ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(num4); MainModule main = 风浪粒子效果.main; ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(Mathf.Lerp(1f, 5f, num)); if (!风浪粒子效果.isPlaying && num4 > 0f) { 风浪粒子效果.Play(); } } else { ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); if (风浪粒子效果.isPlaying) { 风浪粒子效果.Stop(); } } Vector3 position = 地面位置高度获取工具.获取接触地面位置(); ((Component)风浪粒子效果).transform.position = position; } else { EmissionModule emission2 = 风浪粒子效果.emission; ((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(0f); if (风浪粒子效果.isPlaying) { 风浪粒子效果.Stop(); } } } private void OnValidate() { if (粒子完整发射距离 > 最大粒子可发射距离) { 粒子完整发射距离 = 最大粒子可发射距离; } } } public class 直升机自动操控类 : MonoBehaviour { private Transform _目标变换; public Unit 这个单位; public DataHandler 单位数据; [Header("自动操控设置")] public float 巡航高度 = 20f; public float 高度容差 = 2f; public float 攻击距离 = 30f; public float 距离容差 = 5f; public float 可前进高度 = 10f; [Header("操控强度")] public float 俯仰灵敏度 = 1.5f; public float 翻滚灵敏度 = 1.5f; public float 偏航灵敏度 = 1.2f; public float 升力响应速度 = 2f; [Header("姿态限制")] [Range(0f, 45f)] public float 最大俯仰角 = 25f; [Range(0f, 45f)] public float 最大翻滚角 = 20f; private 物理直升机控制 直升机控制器; private 自定义重力 重力系统; private 直升机输入控制 输入控制; private float 当前高度; private float 目标升力系数; private float 目标俯仰系数; private float 目标翻滚系数; private float 目标偏航系数; private Vector3 自身水平位置; private Vector3 目标水平位置; private Vector3 目标方向; private float 水平距离; private float 高度差; private float 上次偏航应用 = 0f; public Transform 目标变换 { get { if ((Object)(object)单位数据?.targetData?.mainRig != (Object)null) { return ((Component)单位数据.targetData.mainRig).transform; } return null; } } private void Start() { 这个单位 = ((Component)((Component)this).transform.root).GetComponent(); 单位数据 = 这个单位.data; 直升机控制器 = ((Component)this).GetComponent<物理直升机控制>(); 重力系统 = ((Component)this).GetComponent<自定义重力>(); 输入控制 = ((Component)this).GetComponent<直升机输入控制>(); if ((Object)(object)重力系统 == (Object)null) { 重力系统 = Object.FindObjectOfType<自定义重力>(); } } private void Update() { if (输入控制.总体启动 && !输入控制.启用 && 输入控制.开启ai操控) { 执行自动操控(); } } private void 执行自动操控() { 更新状态信息(); if ((Object)(object)目标变换 == (Object)null) { 悬停待命(); return; } 计算升力控制(); 判断翻滚偏航控制suo(); 应用控制(); } private void 判断翻滚偏航控制suo() { if (当前高度 > 可前进高度) { 计算偏航控制(); 计算姿态控制(); } } private void 更新状态信息() { //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_005a: 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) //IL_0069: 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_009e: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00ef: 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) if ((Object)(object)重力系统 != (Object)null) { 当前高度 = 重力系统.获取当前高度(); } else { 当前高度 = ((Component)this).transform.position.y; } 自身水平位置 = new Vector3(((Component)this).transform.position.x, 0f, ((Component)this).transform.position.z); if ((Object)(object)目标变换 != (Object)null) { 目标水平位置 = new Vector3(目标变换.position.x, 0f, 目标变换.position.z); Vector3 val = 目标水平位置 - 自身水平位置; 目标方向 = ((Vector3)(ref val)).normalized; 水平距离 = Vector3.Distance(自身水平位置, 目标水平位置); 高度差 = 目标变换.position.y - ((Component)this).transform.position.y; } } private void 计算升力控制() { float num = (((Object)(object)目标变换 != (Object)null && 水平距离 > 攻击距离 + 距离容差) ? 巡航高度 : ((!((Object)(object)目标变换 != (Object)null)) ? 巡航高度 : (巡航高度 + 5f))); float num2 = num - 当前高度; if (num2 > 0f) { 目标升力系数 = 1f; return; } float num3 = Mathf.Abs(num2); 目标升力系数 = Mathf.Clamp01(高度容差 - num3 / 高度容差); } private void 计算偏航控制() { //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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0058: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)目标变换 == (Object)null) { 目标偏航系数 = 0f; return; } Vector3 forward = ((Component)this).transform.forward; forward.y = 0f; ((Vector3)(ref forward)).Normalize(); float y = Vector3.Cross(forward, 目标方向).y; float num = Vector3.Dot(forward, 目标方向); float num2 = Mathf.Acos(Mathf.Clamp(num, -1f, 1f)) * 57.29578f; if (num2 < 3f) { 目标偏航系数 = 0f; return; } float num3 = ((y > 0f) ? 1f : (-1f)); float num4 = Mathf.Clamp(num2 / 90f, 0.1f, 1f); 目标偏航系数 = Mathf.Clamp(num4 * num3, -1f, 1f); } private void 计算姿态控制() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)目标变换 == (Object)null) { 目标俯仰系数 = 0f; 目标翻滚系数 = 0f; return; } float num = 水平距离 - 攻击距离; if (Mathf.Abs(num) <= 距离容差) { 目标俯仰系数 = 0f; } else { float num2 = ((num > 0f) ? 1f : (-1f)); float num3 = Mathf.Clamp(Mathf.Abs(num) / 30f, 0.1f, 1f); 目标俯仰系数 = num2 * num3 * 俯仰灵敏度; 目标俯仰系数 = Mathf.Clamp(目标俯仰系数, (0f - 最大俯仰角) / 45f, 最大俯仰角 / 45f); } Vector3 forward = ((Component)this).transform.forward; forward.y = 0f; ((Vector3)(ref forward)).Normalize(); Vector3 right = ((Component)this).transform.right; right.y = 0f; ((Vector3)(ref right)).Normalize(); float num4 = Vector3.Dot(目标方向, right); if (Mathf.Abs(num4) < 0.1f) { 目标翻滚系数 = 0f; } else { float num5 = ((num4 > 0f) ? 1f : (-1f)); float num6 = Mathf.Abs(num4); 目标翻滚系数 = num5 * num6 * 翻滚灵敏度; 目标翻滚系数 = Mathf.Clamp(目标翻滚系数, (0f - 最大翻滚角) / 45f, 最大翻滚角 / 45f); } if (水平距离 < 攻击距离) { float num7 = Mathf.Clamp01(水平距离 / 攻击距离); 目标俯仰系数 *= num7; 目标翻滚系数 *= num7; } } private void 应用控制() { float num = 直升机控制器.获取主升力系数(); float 系数 = Mathf.Lerp(num, 目标升力系数, Time.deltaTime * 升力响应速度); 直升机控制器.设置主升力系数(系数); 直升机控制器.设置俯仰系数(目标俯仰系数); 直升机控制器.设置翻滚系数(目标翻滚系数); float num2 = 直升机控制器.获取当前尾部力系数(); float 系数2 = Mathf.Lerp(num2, 目标偏航系数, Time.deltaTime * 偏航灵敏度 * 0.1f); 直升机控制器.设置尾部推力系数(系数2); } private void 悬停待命() { float num = 巡航高度 - 当前高度; if (num > 0f) { 目标升力系数 = 1f; } else { float num2 = Mathf.Abs(num); 目标升力系数 = Mathf.Clamp01(高度容差 - num2 / 高度容差); } 目标俯仰系数 = 0f; 目标翻滚系数 = 0f; 目标偏航系数 = 0f; 应用控制(); } public float 获取水平距离() { return 水平距离; } public float 获取当前高度() { return 当前高度; } public bool 在攻击范围内() { return (Object)(object)目标变换 != (Object)null && 水平距离 <= 攻击距离 + 距离容差; } public void 设置巡航高度(float 高度) { 巡航高度 = Mathf.Max(5f, 高度); } public void 设置攻击距离(float 距离) { 攻击距离 = Mathf.Max(10f, 距离); } } public class 自定义重力 : MonoBehaviour { [Header("组件引用")] public Rigidbody 目标刚体; public Transform 射线起点; [Header("重力参数")] public float 基础重力 = 9.81f; public float 最大重力倍数 = 3f; public float 重力影响距离 = 20f; public float 射线检测距离 = 50f; [Header("地面检测")] public LayerMask 地面层 = LayerMask.op_Implicit(512); public bool 显示调试射线 = true; [Header("当前状态(只读)")] [SerializeField] private float 当前距离 = 0f; [SerializeField] private float 当前重力系数 = 1f; [SerializeField] private float 当前重力值 = 9.81f; [SerializeField] private bool 是否检测到地面 = false; private Vector3 地面位置; private RaycastHit 检测信息; private float 最大重力值; private void Awake() { if ((Object)(object)目标刚体 == (Object)null) { 目标刚体 = ((Component)this).GetComponent(); } if ((Object)(object)射线起点 == (Object)null) { 射线起点 = ((Component)this).transform; } } private void Start() { 最大重力值 = 基础重力 * 最大重力倍数; } private void FixedUpdate() { if (!((Object)(object)目标刚体 == (Object)null) && !((Object)(object)射线起点 == (Object)null)) { 检测地面距离(); 计算并施加重力(); } } public void 设置重力(float gran = 19f) { 基础重力 = gran; } private void 检测地面距离() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0012: 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_0047: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Vector3 down = Vector3.down; RaycastHit val = default(RaycastHit); if (Physics.Raycast(射线起点.position, down, ref val, 射线检测距离, LayerMask.op_Implicit(地面层))) { 当前距离 = ((RaycastHit)(ref val)).distance; 是否检测到地面 = true; 地面位置 = ((RaycastHit)(ref val)).point; 检测信息 = val; } else { 当前距离 = 射线检测距离; 是否检测到地面 = false; } } private void 计算并施加重力() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_007c: Unknown result type (might be due to invalid IL or missing references) if (是否检测到地面 && 当前距离 <= 重力影响距离) { 当前重力系数 = Mathf.Lerp(1f, 最大重力倍数, 当前距离 / 重力影响距离); } else { 当前重力系数 = 最大重力倍数; } 当前重力值 = 基础重力 * 当前重力系数; Vector3 down = Vector3.down; 目标刚体.AddForce(down * 当前重力值, (ForceMode)5); } public float 获取当前高度() { return 当前距离; } public float 获取重力系数() { return 当前重力系数; } public float 获取当前重力值() { return 当前重力值; } public bool 是否在地面影响范围内() { return 是否检测到地面 && 当前距离 <= 重力影响距离; } public void 设置地面层(int 层索引) { //IL_0008: 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) 地面层 = LayerMask.op_Implicit(1 << 层索引); } public void 设置重力参数(float 新基础重力, float 新最大倍数, float 新影响距离) { 基础重力 = 新基础重力; 最大重力倍数 = 新最大倍数; 重力影响距离 = 新影响距离; 最大重力值 = 基础重力 * 最大重力倍数; } public bool 获取是否接触地面() { return 是否检测到地面; } public Vector3 获取接触地面位置() { //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) return 地面位置; } public RaycastHit 获取检测信息() { //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) return 检测信息; } } public class 跟随旋转组件 : MonoBehaviour { public Transform 顶部螺旋桨; public Transform 尾部螺旋桨; public 物理直升机控制 直升机引用; public float 旋转速度 = 1000f; public float 尾部旋转速度 = 6000f; public float 尾部初始转速 = 500f; public float 尾部初始转速加速度 = 50f; private float 当前尾部转速 = 0f; public bool 启动 = false; private void Start() { } public void 设置启动(bool g = true) { 启动 = g; } private void Update() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (启动) { 当前尾部转速 += Time.deltaTime * 尾部初始转速加速度; 当前尾部转速 = Mathf.Clamp(当前尾部转速, 0f, 尾部初始转速 * Time.deltaTime); float num = 直升机引用.获取主升力系数() * Time.deltaTime * 旋转速度; float num2 = 直升机引用.获取当前尾部力系数() * Time.deltaTime * 尾部旋转速度; float num3 = num2 - 当前尾部转速; Transform obj = 顶部螺旋桨; obj.rotation *= Quaternion.Euler(0f, 0f, num); Transform obj2 = 尾部螺旋桨; obj2.rotation *= Quaternion.Euler(num3, 0f, 0f); } } } } namespace HeMoDingDingMod.角色类.数学家 { public class 算式伤害计算 : 远程抛射物处理组件基类 { private enum 算式类型 { 加法, 减法, 乘法, 除法, 乘方, 取余, 最大值, 最小值 } [CompilerGenerated] private sealed class <文字弹出动画>d__30 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public TextMesh textMesh; public 算式伤害计算 <>4__this; private Transform 5__1; private Vector3 <原始缩放>5__2; private float <动画时间>5__3; private float <经过时间>5__4; private float 5__5; private float <缩放值>5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <文字弹出动画>d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_004d: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)textMesh == (Object)null) { return false; } 5__1 = ((Component)textMesh).transform; <原始缩放>5__2 = 5__1.localScale; 5__1.localScale = Vector3.zero; <动画时间>5__3 = 0.2f; <经过时间>5__4 = 0f; break; case 1: <>1__state = -1; break; } if (<经过时间>5__4 < <动画时间>5__3) { <经过时间>5__4 += Time.deltaTime; 5__5 = <经过时间>5__4 / <动画时间>5__3; <缩放值>5__6 = Mathf.Sin(5__5 * (float)Math.PI / 2f); 5__1.localScale = <原始缩放>5__2 * <缩放值>5__6; <>2__current = null; <>1__state = 1; return true; } 5__1.localScale = <原始缩放>5__2; 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(); } } [CompilerGenerated] private sealed class <算式计算>d__23 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 算式伤害计算 <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <算式计算>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.初始化文字显示(); <>4__this.计算随机数(); <>2__current = (object)new WaitForSeconds(<>4__this.随机数生成延迟); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.获取随机算式(); <>2__current = (object)new WaitForSeconds(<>4__this.随机数生成延迟); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.计算随机数2(); <>2__current = (object)new WaitForSeconds(<>4__this.随机数生成延迟); <>1__state = 3; return true; case 3: <>1__state = -1; <>4__this.存储伤害值 = <>4__this.进行计算(); if ((Object)(object)<>4__this.文本2 != (Object)null) { <>4__this.文本2.text = $"{<>4__this.随机数2}\n= {<>4__this.存储伤害值}"; } 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(); } } [CompilerGenerated] private sealed class <算式计算_带动画>d__32 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 算式伤害计算 <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <算式计算_带动画>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.初始化文字显示(); <>4__this.计算随机数(); if ((Object)(object)<>4__this.文本1 != (Object)null) { ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.文字弹出动画(<>4__this.文本1)); } <>2__current = (object)new WaitForSeconds(<>4__this.随机数生成延迟); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.获取随机算式(); if ((Object)(object)<>4__this.符号文本 != (Object)null) { ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.文字弹出动画(<>4__this.符号文本)); } <>2__current = (object)new WaitForSeconds(<>4__this.随机数生成延迟); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.计算随机数2(); if ((Object)(object)<>4__this.文本2 != (Object)null) { ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.文字弹出动画(<>4__this.文本2)); } <>2__current = (object)new WaitForSeconds(<>4__this.随机数生成延迟); <>1__state = 3; return true; case 3: <>1__state = -1; <>4__this.存储伤害值 = <>4__this.进行计算(); 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(); } } [Header("位置设置")] public Transform 数字位置1; public Transform 计算符号位置; public Transform 数字位置2; [Header("随机数设置")] public int 最大随机数 = 100; public int 最小随机数 = 0; public float 随机数生成延迟 = 1f; [Header("文字显示设置")] public Color 数字颜色 = Color.white; public int 数字字体大小 = 40; public Color 符号颜色 = Color.yellow; public int 符号字体大小 = 50; [Header("伤害设置")] public int 最小伤害限制 = 0; public int 最大伤害限制 = 9999; private int 随机数1; private int 随机数2; private string 当前算式符号; private Func 当前算式函数; private float 存储伤害值 = 80f; private TextMesh 文本1; private TextMesh 符号文本; private TextMesh 文本2; public override void 完成单次检测(GameObject 实例化的抛射物) { base.完成单次检测(实例化的抛射物); ProjectileHit component = 实例化的抛射物.GetComponent(); if ((Object)(object)component != (Object)null) { component.damage = 存储伤害值; Debug.Log((object)$"最终伤害: {存储伤害值}"); } } public void 开始算式计算() { ((MonoBehaviour)this).StartCoroutine(算式计算()); } [IteratorStateMachine(typeof(<算式计算>d__23))] private IEnumerator 算式计算() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <算式计算>d__23(0) { <>4__this = this }; } private void 初始化文字显示() { //IL_000a: 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_0046: Unknown result type (might be due to invalid IL or missing references) 文本1 = 获取或创建TextMesh(数字位置1, 数字颜色, 数字字体大小); 符号文本 = 获取或创建TextMesh(计算符号位置, 符号颜色, 符号字体大小); 文本2 = 获取或创建TextMesh(数字位置2, 数字颜色, 数字字体大小); } private TextMesh 获取或创建TextMesh(Transform 位置, Color 颜色, int 字体大小) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0053: 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_0077: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)位置 == (Object)null) { Debug.LogWarning((object)"位置未设置,无法创建文字显示"); return null; } TextMesh val = ((Component)位置).GetComponent(); if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("算式文字"); val2.transform.SetParent(位置); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; val = val2.AddComponent(); } val.color = 颜色; val.fontSize = 字体大小; val.anchor = (TextAnchor)4; val.alignment = (TextAlignment)1; if ((Object)(object)val.font == (Object)null) { val.font = Resources.GetBuiltinResource("Arial.ttf"); } val.text = ""; return val; } private void 计算随机数() { 随机数1 = Random.Range(最小随机数, 最大随机数 + 1); if ((Object)(object)文本1 != (Object)null) { 文本1.text = 随机数1.ToString(); } Debug.Log((object)$"第一个随机数: {随机数1}"); } private void 计算随机数2() { 随机数2 = Random.Range(最小随机数, 最大随机数 + 1); if ((Object)(object)文本2 != (Object)null) { 文本2.text = 随机数2.ToString(); } Debug.Log((object)$"第二个随机数: {随机数2}"); } private void 获取随机算式() { switch ((算式类型)Random.Range(0, Enum.GetValues(typeof(算式类型)).Length)) { case 算式类型.加法: 当前算式符号 = "+"; 当前算式函数 = (int a, int b) => a + b; break; case 算式类型.减法: 当前算式符号 = "-"; 当前算式函数 = (int a, int b) => a - b; break; case 算式类型.乘法: 当前算式符号 = "×"; 当前算式函数 = (int a, int b) => a * b; break; case 算式类型.除法: 当前算式符号 = "÷"; 当前算式函数 = (int a, int b) => (b == 0) ? a : (a / b); break; case 算式类型.乘方: 当前算式符号 = "^"; 当前算式函数 = (int a, int b) => (int)Mathf.Pow((float)a, (float)b); break; case 算式类型.取余: 当前算式符号 = "%"; 当前算式函数 = (int a, int b) => (b == 0) ? a : (a % b); break; case 算式类型.最大值: 当前算式符号 = "max"; 当前算式函数 = (int a, int b) => Mathf.Max(a, b); break; case 算式类型.最小值: 当前算式符号 = "min"; 当前算式函数 = (int a, int b) => Mathf.Min(a, b); break; } if ((Object)(object)符号文本 != (Object)null) { 符号文本.text = 当前算式符号; } Debug.Log((object)("算式符号: " + 当前算式符号)); } private int 进行计算() { if (当前算式函数 == null) { Debug.LogError((object)"算式函数未初始化!"); return 0; } int num = 当前算式函数(随机数1, 随机数2); Debug.Log((object)$"计算过程: {随机数1} {当前算式符号} {随机数2} = {num}"); if (num <= -2147483647) { num = int.MaxValue; } return Mathf.Clamp(num, 最小伤害限制, 最大伤害限制); } [IteratorStateMachine(typeof(<文字弹出动画>d__30))] private IEnumerator 文字弹出动画(TextMesh textMesh) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <文字弹出动画>d__30(0) { <>4__this = this, textMesh = textMesh }; } public void 开始算式计算_带动画() { ((MonoBehaviour)this).StartCoroutine(算式计算_带动画()); } [IteratorStateMachine(typeof(<算式计算_带动画>d__32))] private IEnumerator 算式计算_带动画() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <算式计算_带动画>d__32(0) { <>4__this = this }; } [ContextMenu("测试算式计算")] public void 测试算式计算() { Debug.Log((object)"开始测试算式计算"); 开始算式计算(); } [ContextMenu("清空文字显示")] public void 清空文字显示() { if ((Object)(object)文本1 != (Object)null) { 文本1.text = ""; } if ((Object)(object)符号文本 != (Object)null) { 符号文本.text = ""; } if ((Object)(object)文本2 != (Object)null) { 文本2.text = ""; } } } [HarmonyPatch(typeof(RangeWeapon))] public static class 远程获取补丁 { [HarmonyPostfix] [HarmonyPatch("SetProjectileStats")] public static void SetProjectileStatsPostfix(RangeWeapon __instance, GameObject spawnedObject, Vector3 spawnDir, Vector3 directionToTarget, Rigidbody targetRig, Vector3 shootPositionForward, Vector3 targetRigPosition, Vector3 targetRigVelocity, byte? randomSeed) { if (!((Object)(object)spawnedObject == (Object)null)) { ((Component)__instance).GetComponent<远程抛射物处理组件基类>()?.完成单次检测(spawnedObject); } } } public class 远程抛射物处理组件基类 : MonoBehaviour { public virtual void 完成单次检测(GameObject 实例化的抛射物) { } } } namespace HeMoDingDingMod.角色类.幸运方块j { public static class ExtensionMethods { public static List FindAllHideAndDontSave() where T : Object { //IL_0034: 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_003e: Invalid comparison between Unknown and I4 T[] array = Resources.FindObjectsOfTypeAll(); List list = new List(); T[] array2 = array; foreach (T val in array2) { if ((Object)(object)val != (Object)null && (((Object)val).hideFlags & 0x3D) == 61) { list.Add(val); } } return list; } public static List GetAllHideAndDontSaveGameObjects() { return ExtensionMethods.FindAllHideAndDontSave(); } public static List GetAllHideAndDontSaveComponents() where T : Component { return ExtensionMethods.FindAllHideAndDontSave(); } } public static class 幸运方块加载类 { private static UnitBlueprint 单位蓝图幸运方块; private static GameObject 投掷物蓝图幸运方块; private static List 游戏内全部单位列表; private static List 游戏内全部单位列表减去编辑器兵种; private static List 游戏内全部单位列表仅编辑器兵种; private static List 游戏内全部抛射物; private static List 全部爆炸对象; private static List 全部单位效果对象; public static UnitBlueprint 单位蓝图幸运方块只读 => 单位蓝图幸运方块; public static GameObject 投掷物蓝图幸运方块只读 => 投掷物蓝图幸运方块; public static List 游戏内全部单位列表只读 => 游戏内全部单位列表; public static List 游戏内全部单位列表减去编辑器兵种只读 => 游戏内全部单位列表减去编辑器兵种; public static List 游戏内全部单位列表仅编辑器兵种只读 => 游戏内全部单位列表仅编辑器兵种; public static List 游戏内全部抛射物只读 => 游戏内全部抛射物; public static List 全部爆炸对象只读 => 全部爆炸对象; public static List 全部效果对象只读 => 全部单位效果对象; public static void 创建幸运方块(UnitBlueprint 单位, GameObject 投掷物) { 单位蓝图幸运方块 = 单位; 投掷物蓝图幸运方块 = 投掷物; } public static void 更新列表() { List list = ContentDatabase.Instance().GetAllUnitBlueprints().ToList(); 游戏内全部单位列表 = list.Distinct().ToList(); List list2 = new List(list); list2.RemoveAll((UnitBlueprint p) => p.IsCustomUnit); 游戏内全部单位列表减去编辑器兵种 = list2.Distinct().ToList(); List list3 = new List(list); list3.RemoveAll((UnitBlueprint p) => !p.IsCustomUnit); 游戏内全部单位列表仅编辑器兵种 = list3.Distinct().ToList(); 游戏内全部抛射物 = ContentDatabase.Instance().GetAllProjectiles().Distinct() .ToList(); } public static void 更新爆炸对象列表() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Explosion[] array = Resources.FindObjectsOfTypeAll(); List list = new List(); Explosion[] array2 = array; foreach (Explosion val in array2) { if (!((Object)(object)val != (Object)null) || !((Object)(object)((Component)val).gameObject != (Object)null)) { continue; } Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).name == null) { GameObject gameObject = ((Component)val).gameObject; RemoveAfterSeconds component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { list.Add(gameObject); } } } 全部爆炸对象 = (from obj in list group obj by ((Object)obj).GetInstanceID() into @group select @group.First()).ToList(); Debug.Log((object)$"去重后找到 {全部爆炸对象.Count} 个符合条件的爆炸对象"); } public static void 更新效果对象列表() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) UnitEffectBase[] array = Resources.FindObjectsOfTypeAll(); List list = new List(); UnitEffectBase[] array2 = array; foreach (UnitEffectBase val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null) { Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).name == null) { list.Add(val); } } } Dictionary dictionary = new Dictionary(); foreach (UnitEffectBase item in list) { string name = ((Object)item).name; if (!dictionary.ContainsKey(name)) { dictionary.Add(name, item); } else { Debug.Log((object)$"跳过重复的效果对象: {name} (InstanceID: {((Object)item).GetInstanceID()})"); } } 全部单位效果对象 = dictionary.Values.ToList(); Debug.Log((object)$"去重前找到 {list.Count} 个效果对象,按名字去重后找到 {全部单位效果对象.Count} 个唯一的效果对象"); } } public class 幸运方块随机事件_单位随机召唤 : MonoBehaviour { [CompilerGenerated] private sealed class <召唤携程>d__15 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 幸运方块随机事件_单位随机召唤 <>4__this; private int <召唤数量>5__1; private int <已召唤数量>5__2; private UnitBlueprint <预选单位蓝图>5__3; private Vector3 <召唤中心点>5__4; private Vector3 <召唤点>5__5; private UnitBlueprint <当前单位蓝图>5__6; private Exception 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <召唤携程>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <预选单位蓝图>5__3 = null; <当前单位蓝图>5__6 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_0306; } <>1__state = -1; <>4__this.正在召唤 = true; <召唤数量>5__1 = Random.Range(<>4__this.随机最小量, <>4__this.随机最大量 + 1); <已召唤数量>5__2 = 0; <预选单位蓝图>5__3 = null; if (!<>4__this.使用随机单位模式 && <>4__this.可用单位列表.Count > 0) { <预选单位蓝图>5__3 = <>4__this.可用单位列表[Random.Range(0, <>4__this.可用单位列表.Count)]; if ((Object)(object)<预选单位蓝图>5__3 == (Object)null) { Debug.LogError((object)"[幸运方块随机事件] 预选单位蓝图为空"); <>4__this.正在召唤 = false; return false; } } Debug.Log((object)string.Format("[幸运方块随机事件] 开始召唤:数量={0},模式={1},延迟={2}秒", <召唤数量>5__1, <>4__this.使用随机单位模式 ? "随机单位" : "单一单位", <>4__this.召唤延迟)); goto IL_030e; IL_030e: if (<已召唤数量>5__2 < <召唤数量>5__1) { <召唤中心点>5__4 = ((Component)<>4__this).transform.position; <召唤点>5__5 = <>4__this.获取随机位置(<召唤中心点>5__4, <>4__this.召唤半径); <当前单位蓝图>5__6 = null; try { if (<>4__this.使用随机单位模式) { if (<>4__this.可用单位列表.Count > 0) { <当前单位蓝图>5__6 = <>4__this.可用单位列表[Random.Range(0, <>4__this.可用单位列表.Count)]; } } else { <当前单位蓝图>5__6 = <预选单位蓝图>5__3; } if ((Object)(object)<当前单位蓝图>5__6 != (Object)null) { <当前单位蓝图>5__6.Spawn(<召唤点>5__5, Quaternion.identity, <>4__this.队伍标识, 1f, (UnitPoolInfo?)null); Debug.Log((object)$"[幸运方块随机事件] 已召唤第{<已召唤数量>5__2 + 1}/{<召唤数量>5__1}个单位: {((Object)<当前单位蓝图>5__6).name}"); } else { Debug.LogWarning((object)$"[幸运方块随机事件] 第{<已召唤数量>5__2 + 1}次召唤失败:单位蓝图为空"); } } catch (Exception ex) { 5__7 = ex; Debug.LogError((object)$"[幸运方块随机事件] 召唤第{<已召唤数量>5__2 + 1}个单位时发生异常: {5__7.Message}"); } <已召唤数量>5__2++; if (<已召唤数量>5__2 < <召唤数量>5__1 && <>4__this.召唤延迟 > 0f) { <>2__current = (object)new WaitForSeconds(<>4__this.召唤延迟); <>1__state = 1; return true; } goto IL_0306; } <>4__this.正在召唤 = false; Debug.Log((object)"[幸运方块随机事件] 召唤完成"); return false; IL_0306: <当前单位蓝图>5__6 = null; goto IL_030e; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("召唤设置")] public int 随机最小量 = 1; public int 随机最大量 = 5; public float 召唤延迟 = 0.4f; public float 召唤半径 = 5f; [Header("选项")] public bool 开始时释放 = false; public bool 使用随机单位模式 = false; public bool 启动时随机执行召唤模式 = true; [Header("队伍设置")] public Team 队伍标识 = (Team)0; private bool 正在召唤 = false; private List 可用单位列表 = new List(); private void Start() { //IL_001d: 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) InitializeUnitList(); TeamHolder component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { 队伍标识 = component.team; } ValidateParameters(); if (开始时释放) { 启动(); } } private void InitializeUnitList() { try { if (幸运方块加载类.游戏内全部单位列表减去编辑器兵种只读 != null) { 可用单位列表 = 幸运方块加载类.游戏内全部单位列表减去编辑器兵种只读.Where((UnitBlueprint unit) => (Object)(object)unit != (Object)null).ToList(); } else { Debug.LogError((object)"[幸运方块随机事件] 单位列表为空!"); 可用单位列表 = new List(); } } catch (Exception ex) { Debug.LogError((object)("[幸运方块随机事件] 初始化单位列表失败: " + ex.Message)); 可用单位列表 = new List(); } } private void ValidateParameters() { if (随机最小量 > 随机最大量) { Debug.LogWarning((object)"[幸运方块随机事件] 随机最小量大于最大量,已自动交换"); int num = 随机最小量; 随机最小量 = 随机最大量; 随机最大量 = num; } 随机最小量 = Mathf.Max(0, 随机最小量); 随机最大量 = Mathf.Max(随机最小量, 随机最大量); 召唤延迟 = Mathf.Max(0f, 召唤延迟); 召唤半径 = Mathf.Max(0f, 召唤半径); } public void 启动() { if (正在召唤) { Debug.LogWarning((object)"[幸运方块随机事件] 召唤正在进行中,请勿重复启动"); return; } if (可用单位列表 == null || 可用单位列表.Count == 0) { Debug.LogError((object)"[幸运方块随机事件] 无法启动:没有可用的单位蓝图"); return; } if (启动时随机执行召唤模式) { 使用随机单位模式 = Random.value > 0.5f; } ((MonoBehaviour)this).StartCoroutine(召唤携程()); } public void 停止召唤() { if (正在召唤) { ((MonoBehaviour)this).StopCoroutine(召唤携程()); 正在召唤 = false; Debug.Log((object)"[幸运方块随机事件] 已停止召唤"); } } [IteratorStateMachine(typeof(<召唤携程>d__15))] private IEnumerator 召唤携程() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <召唤携程>d__15(0) { <>4__this = this }; } private Vector3 获取随机位置(Vector3 center, float radius) { //IL_0015: 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_0020: 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_0029: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0011: Unknown result type (might be due to invalid IL or missing references) //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) if (radius <= 0f) { return center; } Vector2 val = Random.insideUnitCircle * radius; Vector3 result = default(Vector3); ((Vector3)(ref result))..ctor(center.x + val.x, center.y, center.z + val.y); return result; } public bool Is召唤中() { return 正在召唤; } public void 设置队伍(Team team) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) 队伍标识 = team; } public void 刷新单位列表() { InitializeUnitList(); } private void OnDrawGizmosSelected() { //IL_0010: 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_0032: 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) if (((Behaviour)this).enabled) { Gizmos.color = Color.green; Gizmos.DrawWireSphere(((Component)this).transform.position, 召唤半径); Gizmos.color = Color.yellow; Gizmos.DrawWireSphere(((Component)this).transform.position, 召唤半径 * 0.3f); } } } public class 幸运方块抛射物召唤 : MonoBehaviour { public enum 随机抛射物物体实例化模式 { 瞄准目标连续实例化同一个抛射物, 瞄准目标连续实例化不同抛射物, 随机散射同一个抛射物, 随机散射不同抛射物 } [CompilerGenerated] private sealed class <召唤携程>d__15 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 幸运方块抛射物召唤 <>4__this; private int <召唤数量>5__1; private int <已召唤数量>5__2; private GameObject <预选抛射物>5__3; private 随机抛射物物体实例化模式 <>s__4; private Exception 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <召唤携程>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <预选抛射物>5__3 = null; 5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.正在召唤 = true; <召唤数量>5__1 = Random.Range(<>4__this.随机最小量, <>4__this.随机最大量 + 1); <已召唤数量>5__2 = 0; <预选抛射物>5__3 = null; if ((<>4__this.实例化模式 == 随机抛射物物体实例化模式.瞄准目标连续实例化同一个抛射物 || <>4__this.实例化模式 == 随机抛射物物体实例化模式.随机散射同一个抛射物) && <>4__this.所有抛射物列表.Count > 0) { <预选抛射物>5__3 = <>4__this.所有抛射物列表[Random.Range(0, <>4__this.所有抛射物列表.Count)]; } Debug.Log((object)$"[幸运方块抛射物召唤] 开始召唤:数量={<召唤数量>5__1},模式={<>4__this.实例化模式},延迟={<>4__this.召唤延迟}秒"); break; case 1: <>1__state = -1; break; } while (<已召唤数量>5__2 < <召唤数量>5__1) { try { 随机抛射物物体实例化模式 实例化模式 = <>4__this.实例化模式; <>s__4 = 实例化模式; switch (<>s__4) { case 随机抛射物物体实例化模式.瞄准目标连续实例化同一个抛射物: <>4__this.执行瞄准目标单一抛射物召唤(<预选抛射物>5__3); break; case 随机抛射物物体实例化模式.瞄准目标连续实例化不同抛射物: <>4__this.执行瞄准目标随机抛射物召唤(); break; case 随机抛射物物体实例化模式.随机散射同一个抛射物: <>4__this.执行散射单一抛射物召唤(<预选抛射物>5__3); break; case 随机抛射物物体实例化模式.随机散射不同抛射物: <>4__this.执行散射随机抛射物召唤(); break; } Debug.Log((object)$"[幸运方块抛射物召唤] 已召唤第{<已召唤数量>5__2 + 1}/{<召唤数量>5__1}个抛射物"); } catch (Exception ex) { 5__5 = ex; Debug.LogError((object)$"[幸运方块抛射物召唤] 召唤第{<已召唤数量>5__2 + 1}个抛射物时发生异常: {5__5.Message}"); } <已召唤数量>5__2++; if (<已召唤数量>5__2 < <召唤数量>5__1 && <>4__this.召唤延迟 > 0f) { <>2__current = (object)new WaitForSeconds(<>4__this.召唤延迟); <>1__state = 1; return true; } } <>4__this.正在召唤 = false; Debug.Log((object)"[幸运方块抛射物召唤] 召唤完成"); 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(); } } [Header("召唤设置")] public int 随机最小量 = 1; public int 随机最大量 = 5; public float 召唤延迟 = 0.4f; public float 散射角度 = 30f; [Header("模式设置")] public 随机抛射物物体实例化模式 实例化模式 = 随机抛射物物体实例化模式.瞄准目标连续实例化不同抛射物; public bool 启动时随机执行召唤模式 = true; private List 所有抛射物列表; private Unit 这个单位; private bool 正在召唤 = false; private void Start() { InitializeProjectileList(); TeamHolder component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.spawner)) { 这个单位 = component.spawner.GetComponent(); } ValidateParameters(); } private void InitializeProjectileList() { try { if (幸运方块加载类.游戏内全部抛射物只读 != null) { 所有抛射物列表 = 幸运方块加载类.游戏内全部抛射物只读.Where((GameObject p) => (Object)(object)p != (Object)null).ToList(); } else { Debug.LogError((object)"[幸运方块抛射物召唤] 抛射物列表为空!"); 所有抛射物列表 = new List(); } } catch (Exception ex) { Debug.LogError((object)("[幸运方块抛射物召唤] 初始化抛射物列表失败: " + ex.Message)); 所有抛射物列表 = new List(); } } private void ValidateParameters() { if (随机最小量 > 随机最大量) { Debug.LogWarning((object)"[幸运方块抛射物召唤] 随机最小量大于最大量,已自动交换"); int num = 随机最小量; 随机最小量 = 随机最大量; 随机最大量 = num; } 随机最小量 = Mathf.Max(0, 随机最小量); 随机最大量 = Mathf.Max(随机最小量, 随机最大量); 召唤延迟 = Mathf.Max(0f, 召唤延迟); 散射角度 = Mathf.Clamp(散射角度, 0f, 360f); } public void 随机实例化抛射物() { if (正在召唤) { Debug.LogWarning((object)"[幸运方块抛射物召唤] 召唤正在进行中,请勿重复启动"); return; } if (所有抛射物列表 == null || 所有抛射物列表.Count == 0) { Debug.LogError((object)"[幸运方块抛射物召唤] 无法启动:没有可用的抛射物"); return; } if (启动时随机执行召唤模式) { 实例化模式 = (随机抛射物物体实例化模式)Random.Range(0, 4); Debug.Log((object)$"[幸运方块抛射物召唤] 随机选择模式: {实例化模式}"); } if (Object.op_Implicit((Object)(object)这个单位)) { ((MonoBehaviour)this).StartCoroutine(召唤携程()); return; } Debug.LogWarning((object)"[幸运方块抛射物召唤] 单位引用为空,尝试重新获取"); 重新获取单位(); if (Object.op_Implicit((Object)(object)这个单位)) { ((MonoBehaviour)this).StartCoroutine(召唤携程()); } } private void 重新获取单位() { TeamHolder component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.spawner)) { 这个单位 = component.spawner.GetComponent(); } } [IteratorStateMachine(typeof(<召唤携程>d__15))] private IEnumerator 召唤携程() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <召唤携程>d__15(0) { <>4__this = this }; } private void 执行瞄准目标单一抛射物召唤(GameObject 抛射物预制体) { //IL_0045: 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_004b: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0065: 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_0073: 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_00a7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)抛射物预制体 == (Object)null) && Object.op_Implicit((Object)(object)这个单位.data.targetData)) { Vector3 position = 这个单位.data.targetData.mainRig.position; Vector3 val = position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; GameObject val2 = Object.Instantiate(抛射物预制体, ((Component)this).transform.position, Quaternion.LookRotation(normalized)); TeamHolder.AddTeamHolder(val2, ((Component)this).gameObject); Rigidbody component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = normalized * 10f; } } } private void 执行瞄准目标随机抛射物召唤() { //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_004f: 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_005b: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) if (所有抛射物列表.Count != 0 && Object.op_Implicit((Object)(object)这个单位.data.targetData)) { Vector3 position = 这个单位.data.targetData.mainRig.position; Vector3 val = position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; GameObject val2 = 所有抛射物列表[Random.Range(0, 所有抛射物列表.Count)]; GameObject val3 = Object.Instantiate(val2, ((Component)this).transform.position, Quaternion.LookRotation(normalized)); TeamHolder.AddTeamHolder(val3, ((Component)this).gameObject); Rigidbody component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = normalized * 10f; } } } private void 执行散射单一抛射物召唤(GameObject 抛射物预制体) { //IL_000f: 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_001c: 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_0022: 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) if (!((Object)(object)抛射物预制体 == (Object)null)) { Vector3 val = 获取随机散射方向(); GameObject val2 = Object.Instantiate(抛射物预制体, ((Component)this).transform.position, Quaternion.LookRotation(val)); TeamHolder.AddTeamHolder(val2, ((Component)this).gameObject); Rigidbody component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = val * 10f; } } } private void 执行散射随机抛射物召唤() { //IL_0018: 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_0042: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (所有抛射物列表.Count != 0) { Vector3 val = 获取随机散射方向(); GameObject val2 = 所有抛射物列表[Random.Range(0, 所有抛射物列表.Count)]; GameObject val3 = Object.Instantiate(val2, ((Component)this).transform.position, Quaternion.LookRotation(val)); TeamHolder.AddTeamHolder(val3, ((Component)this).gameObject); Rigidbody component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = val * 10f; } } } private Vector3 获取随机散射方向() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0051: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_006a: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) Vector3 forward = ((Component)this).transform.forward; float num = Random.Range((0f - 散射角度) / 2f, 散射角度 / 2f); float num2 = Random.Range((0f - 散射角度) / 2f, 散射角度 / 2f); Quaternion val = Quaternion.AngleAxis(num, Vector3.up); Quaternion val2 = Quaternion.AngleAxis(num2, ((Component)this).transform.right); Vector3 val3 = val * val2 * forward; return ((Vector3)(ref val3)).normalized; } private Vector3 获取目标方向() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0063: 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) if (Object.op_Implicit((Object)(object)这个单位) && (Object)(object)这个单位.data.targetData.mainRig != (Object)null) { Vector3 val = 这个单位.data.targetData.mainRig.position - ((Component)this).transform.position; return ((Vector3)(ref val)).normalized; } return ((Component)this).transform.forward; } public bool Is召唤中() { return 正在召唤; } public void 停止召唤() { if (正在召唤) { ((MonoBehaviour)this).StopAllCoroutines(); 正在召唤 = false; Debug.Log((object)"[幸运方块抛射物召唤] 已停止召唤"); } } public void 刷新抛射物列表() { InitializeProjectileList(); } private void OnDrawGizmosSelected() { //IL_0108: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0060: 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_006a: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b1: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0165: Unknown result type (might be due to invalid IL or missing references) if (!((Behaviour)this).enabled) { return; } if (实例化模式 == 随机抛射物物体实例化模式.随机散射同一个抛射物 || 实例化模式 == 随机抛射物物体实例化模式.随机散射不同抛射物) { Gizmos.color = Color.red; Vector3 val = ((Component)this).transform.forward * 5f; float num = 散射角度 / 2f; Vector3 val2 = Quaternion.AngleAxis(0f - num, Vector3.up) * val; Vector3 val3 = Quaternion.AngleAxis(num, Vector3.up) * val; Vector3 val4 = Quaternion.AngleAxis(0f - num, ((Component)this).transform.right) * val; Vector3 val5 = Quaternion.AngleAxis(num, ((Component)this).transform.right) * val; Gizmos.DrawRay(((Component)this).transform.position, val2); Gizmos.DrawRay(((Component)this).transform.position, val3); Gizmos.DrawRay(((Component)this).transform.position, val4); Gizmos.DrawRay(((Component)this).transform.position, val5); } else { Gizmos.color = Color.blue; if (Object.op_Implicit((Object)(object)这个单位) && (Object)(object)这个单位.data.targetData.mainRig != (Object)null) { Gizmos.DrawLine(((Component)this).transform.position, 这个单位.data.targetData.mainRig.position); } } } } public enum SettingType { Toggle, Options, Slider } public class SettingInfo { public string Key { get; set; } public string DisplayName { get; set; } public SettingType Type { get; set; } public string[] Options { get; set; } public float DefaultValue { get; set; } public float CurrentValue { get; set; } public float Min { get; set; } = 0f; public float Max { get; set; } = 100f; public Action OnValueChanged { get; set; } public Action OnSliderChanged { get; set; } } public static class 添加设置按钮 { private static GlobalSettingsHandler _settingsHandler; private static Dictionary _originalSettings = new Dictionary(); private static bool _isInitialized = false; public static void Initialize() { if (!_isInitialized) { _settingsHandler = ServiceLocator.GetService(); if ((Object)(object)_settingsHandler == (Object)null) { Debug.LogError((object)"[添加设置按钮] 无法获取 GlobalSettingsHandler"); return; } _isInitialized = true; Debug.Log((object)"[添加设置按钮] 初始化成功"); } } public static SettingsInstance AddGameplaySetting(SettingInfo settingInfo) { return AddSettingToCategory(settingInfo, GetGameplaySettingsList); } public static SettingsInstance AddVideoSetting(SettingInfo settingInfo) { return AddSettingToCategory(settingInfo, GetVideoSettingsList); } public static SettingsInstance AddAudioSetting(SettingInfo settingInfo) { return AddSettingToCategory(settingInfo, GetAudioSettingsList); } public static SettingsInstance AddControlSetting(SettingInfo settingInfo) { return AddSettingToCategory(settingInfo, GetControlSettingsList); } public static SettingsInstance AddToggle(string key, string displayName, bool defaultEnabled = false, Action onToggled = null) { SettingInfo settingInfo = new SettingInfo(); settingInfo.Key = key; settingInfo.DisplayName = displayName; settingInfo.Type = SettingType.Toggle; settingInfo.Options = new string[2] { "Disabled", "Enabled" }; settingInfo.DefaultValue = (defaultEnabled ? 1f : 0f); settingInfo.CurrentValue = (defaultEnabled ? 1f : 0f); settingInfo.OnValueChanged = delegate(int intVal) { bool obj = intVal > 0; onToggled?.Invoke(obj); }; SettingInfo settingInfo2 = settingInfo; return AddGameplaySetting(settingInfo2); } public static SettingsInstance AddOptions(string key, string displayName, string[] options, int defaultIndex = 0, Action onValueChanged = null) { SettingInfo settingInfo = new SettingInfo { Key = key, DisplayName = displayName, Type = SettingType.Options, Options = options, DefaultValue = defaultIndex, CurrentValue = defaultIndex, OnValueChanged = onValueChanged }; return AddGameplaySetting(settingInfo); } public static SettingsInstance AddSlider(string key, string displayName, float defaultValue, float min = 0f, float max = 100f, Action onValueChanged = null) { SettingInfo settingInfo = new SettingInfo { Key = key, DisplayName = displayName, Type = SettingType.Slider, DefaultValue = defaultValue, CurrentValue = defaultValue, Min = min, Max = max, OnSliderChanged = onValueChanged }; return AddGameplaySetting(settingInfo); } public static void RemoveCustomSetting(string settingsKey) { if (!_isInitialized) { Debug.LogWarning((object)("[添加设置按钮] 未初始化,无法移除设置: " + settingsKey)); return; } try { List gameplaySettingsList = GetGameplaySettingsList(); SettingsInstance val = ((IEnumerable)gameplaySettingsList).FirstOrDefault((Func)((SettingsInstance s) => s.m_settingsKey == settingsKey)); if (val != null) { gameplaySettingsList.Remove(val); SetGameplaySettingsList(gameplaySettingsList); Debug.Log((object)("[添加设置按钮] 已移除设置: " + settingsKey)); } } catch (Exception ex) { Debug.LogError((object)("[添加设置按钮] 移除设置失败: " + ex.Message)); } } private static SettingsInstance AddSettingToCategory(SettingInfo info, Func> getSettingsList) { if (!_isInitialized) { Debug.LogError((object)"[添加设置按钮] 未初始化,请先调用 Initialize()"); return null; } try { List list = getSettingsList(); SettingsInstance val = ((IEnumerable)list).FirstOrDefault((Func)((SettingsInstance s) => s.m_settingsKey == info.Key)); if (val != null) { Debug.LogWarning((object)("[添加设置按钮] 设置已存在: " + info.Key)); return val; } SettingsInstance val2 = CreateSettingsInstance(info); list.Add(val2); SetSettingsList(getSettingsList, list); RegisterCallbacks(val2, info); Debug.Log((object)("[添加设置按钮] 成功添加设置: " + info.DisplayName + " (" + info.Key + ")")); return val2; } catch (Exception ex) { Debug.LogError((object)("[添加设置按钮] 添加设置失败: " + ex.Message + "\n" + ex.StackTrace)); return null; } } private static SettingsInstance CreateSettingsInstance(SettingInfo info) { //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_0014: 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_0022: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_005f: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_009d: Expected O, but got Unknown SettingsType settingsType = (SettingsType)(info.Type == SettingType.Slider); return new SettingsInstance { localizeOptions = false, settingsType = settingsType, m_settingsKey = info.Key, settingName = info.DisplayName, toolTip = info.DisplayName, options = info.Options, defaultValue = (int)info.DefaultValue, currentValue = (int)info.CurrentValue, defaultSliderValue = info.DefaultValue, currentSliderValue = info.CurrentValue, min = info.Min, max = info.Max }; } private static void RegisterCallbacks(SettingsInstance instance, SettingInfo info) { if (info.OnValueChanged != null) { instance.OnValueChanged += info.OnValueChanged; } if (info.OnSliderChanged != null) { instance.OnSliderValueChanged += info.OnSliderChanged; } } private static List GetGameplaySettingsList() { FieldInfo field = typeof(GlobalSettingsHandler).GetField("m_gameplaySettings", BindingFlags.Instance | BindingFlags.NonPublic); return ((SettingsInstance[])field.GetValue(_settingsHandler))?.ToList() ?? new List(); } private static void SetGameplaySettingsList(List list) { FieldInfo field = typeof(GlobalSettingsHandler).GetField("m_gameplaySettings", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(_settingsHandler, list.ToArray()); } private static List GetVideoSettingsList() { FieldInfo field = typeof(GlobalSettingsHandler).GetField("m_videoSettings", BindingFlags.Instance | BindingFlags.NonPublic); return ((SettingsInstance[])field.GetValue(_settingsHandler))?.ToList() ?? new List(); } private static void SetVideoSettingsList(List list) { FieldInfo field = typeof(GlobalSettingsHandler).GetField("m_videoSettings", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(_settingsHandler, list.ToArray()); } private static List GetAudioSettingsList() { FieldInfo field = typeof(GlobalSettingsHandler).GetField("m_audioSettings", BindingFlags.Instance | BindingFlags.NonPublic); return ((SettingsInstance[])field.GetValue(_settingsHandler))?.ToList() ?? new List(); } private static void SetAudioSettingsList(List list) { FieldInfo field = typeof(GlobalSettingsHandler).GetField("m_audioSettings", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(_settingsHandler, list.ToArray()); } private static List GetControlSettingsList() { FieldInfo field = typeof(GlobalSettingsHandler).GetField("m_controlSettings", BindingFlags.Instance | BindingFlags.NonPublic); return ((SettingsInstance[])field.GetValue(_settingsHandler))?.ToList() ?? new List(); } private static void SetControlSettingsList(List list) { FieldInfo field = typeof(GlobalSettingsHandler).GetField("m_controlSettings", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(_settingsHandler, list.ToArray()); } private static void SetSettingsList(Func> getter, List list) { if (getter == new Func>(GetGameplaySettingsList)) { SetGameplaySettingsList(list); } else if (getter == new Func>(GetVideoSettingsList)) { SetVideoSettingsList(list); } else if (getter == new Func>(GetAudioSettingsList)) { SetAudioSettingsList(list); } else if (getter == new Func>(GetControlSettingsList)) { SetControlSettingsList(list); } } } public class 简易随机召唤物体 : MonoBehaviour { public List 预制体列表; public void 召唤() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (预制体列表 != null && 预制体列表.Count != 0) { GameObject val = Object.Instantiate(预制体列表[Random.Range(0, 预制体列表.Count)], ((Component)this).transform.position, Quaternion.identity); TeamHolder.AddTeamHolder(val, ((Component)this).gameObject); } } } public class 幸运方块召唤类_随机爆炸物召唤 : MonoBehaviour { public enum 爆炸召唤模式 { 连续召唤同一个爆炸物, 连续召唤不同爆炸物 } [CompilerGenerated] private sealed class <爆炸召唤携程>d__11 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 幸运方块召唤类_随机爆炸物召唤 <>4__this; private int <召唤数量>5__1; private int <已召唤数量>5__2; private float <随机半径>5__3; private GameObject <预选爆炸物>5__4; private GameObject <当前爆炸物>5__5; private Exception 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <爆炸召唤携程>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <预选爆炸物>5__4 = null; <当前爆炸物>5__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.正在召唤 = true; <召唤数量>5__1 = Random.Range(<>4__this.随机最小量, <>4__this.随机最大量 + 1); <已召唤数量>5__2 = 0; <随机半径>5__3 = Random.Range(0, 5); <预选爆炸物>5__4 = null; if (<>4__this.当前模式 == 爆炸召唤模式.连续召唤同一个爆炸物) { <预选爆炸物>5__4 = <>4__this.所有爆炸物[Random.Range(0, <>4__this.所有爆炸物.Count)]; } Debug.Log((object)$"[随机爆炸物召唤] 开始: 数量={<召唤数量>5__1}, 模式={<>4__this.当前模式}"); break; case 1: <>1__state = -1; break; } while (<已召唤数量>5__2 < <召唤数量>5__1) { try { if (<>4__this.当前模式 == 爆炸召唤模式.连续召唤同一个爆炸物) { <当前爆炸物>5__5 = <预选爆炸物>5__4; } else { <当前爆炸物>5__5 = <>4__this.所有爆炸物[Random.Range(0, <>4__this.所有爆炸物.Count)]; } if ((Object)(object)<当前爆炸物>5__5 != (Object)null) { TeamHolder.AddTeamHolder(Object.Instantiate(<当前爆炸物>5__5, <>4__this.获取随机位置(((Component)<>4__this).transform.position, <随机半径>5__3), Quaternion.identity), ((Component)<>4__this).gameObject); Debug.Log((object)$"[随机爆炸物召唤] 第{<已召唤数量>5__2 + 1}/{<召唤数量>5__1}个爆炸物: {((Object)<当前爆炸物>5__5).name}"); } <当前爆炸物>5__5 = null; } catch (Exception ex) { 5__6 = ex; Debug.LogError((object)$"[随机爆炸物召唤] 第{<已召唤数量>5__2 + 1}次召唤异常: {5__6.Message}"); } <已召唤数量>5__2++; if (<已召唤数量>5__2 < <召唤数量>5__1 && <>4__this.召唤延迟 > 0f) { <>2__current = (object)new WaitForSeconds(<>4__this.召唤延迟); <>1__state = 1; return true; } } <>4__this.正在召唤 = false; Debug.Log((object)"[随机爆炸物召唤] 完成"); 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(); } } [Header("召唤设置")] public int 随机最小量 = 1; public int 随机最大量 = 5; public float 召唤延迟 = 0.3f; [Header("模式设置")] public 爆炸召唤模式 当前模式 = 爆炸召唤模式.连续召唤不同爆炸物; public bool 启动时随机模式 = true; private List 所有爆炸物; private bool 正在召唤 = false; private void Start() { 初始化爆炸物列表(); } private void 初始化爆炸物列表() { try { if (幸运方块加载类.全部爆炸对象只读 != null) { 所有爆炸物 = 幸运方块加载类.全部爆炸对象只读.Where((GameObject e) => (Object)(object)e != (Object)null).ToList(); } else { Debug.LogError((object)"[随机爆炸物召唤] 爆炸物列表为空!"); 所有爆炸物 = new List(); } } catch (Exception ex) { Debug.LogError((object)("[随机爆炸物召唤] 初始化失败: " + ex.Message)); 所有爆炸物 = new List(); } } public void 随机召唤爆炸物() { if (正在召唤) { Debug.LogWarning((object)"[随机爆炸物召唤] 召唤进行中,请勿重复启动"); return; } if (所有爆炸物 == null || 所有爆炸物.Count == 0) { Debug.LogError((object)"[随机爆炸物召唤] 没有可用的爆炸物"); return; } if (启动时随机模式) { 当前模式 = (爆炸召唤模式)Random.Range(0, 2); Debug.Log((object)$"[随机爆炸物召唤] 随机模式: {当前模式}"); } ((MonoBehaviour)this).StartCoroutine(爆炸召唤携程()); } [IteratorStateMachine(typeof(<爆炸召唤携程>d__11))] private IEnumerator 爆炸召唤携程() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <爆炸召唤携程>d__11(0) { <>4__this = this }; } public void 停止召唤() { if (正在召唤) { ((MonoBehaviour)this).StopAllCoroutines(); 正在召唤 = false; Debug.Log((object)"[随机爆炸物召唤] 已停止"); } } public bool Is召唤中() { return 正在召唤; } public void 刷新爆炸物列表() { 初始化爆炸物列表(); } private Vector3 获取随机位置(Vector3 center, float radius) { //IL_0015: 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_0020: 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_0029: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0011: Unknown result type (might be due to invalid IL or missing references) //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) if (radius <= 0f) { return center; } Vector2 val = Random.insideUnitCircle * radius; Vector3 result = default(Vector3); ((Vector3)(ref result))..ctor(center.x + val.x, center.y, center.z + val.y); return result; } } } namespace HeMoDingDingMod.角色类.幸运方块j.检测目标并添加 { public class 目标检测添加效果 : 检测目标并操作父类 { private List 所有可用效果列表; protected override void Start() { base.Start(); 所有可用效果列表 = 幸运方块加载类.全部效果对象只读; } public override void 检测操作逻辑(Unit 此单位, DataHandler 此单位数据, DataHandler 目标单位数据) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) base.检测操作逻辑(此单位, 此单位数据, 目标单位数据); UnitEffectBase val = 所有可用效果列表[Random.Range(0, 所有可用效果列表.Count)]; Transform transform = ((Component)目标单位数据.mainRig).transform; UnitEffectBase val2 = UnitEffectBase.AddEffectToTarget(((Component)transform).gameObject, val); if ((Object)(object)val2 == (Object)null) { val2 = Object.Instantiate(val, transform); ((Component)val2).transform.SetPositionAndRotation(transform.position, Quaternion.identity); TeamHolder.AddTeamHolder(((Component)val2).gameObject, ((Component)this).gameObject); val2.DoEffect(); } else { val2.Ping(); } } } public class 碰撞检测随机添加效果 : 碰撞检测获取单位基类 { private List 所有可用效果列表; public bool 随机添加多个效果 = true; protected override void Start() { base.Start(); 所有可用效果列表 = 幸运方块加载类.全部效果对象只读; 随机添加多个效果 = Random.value > 0.5f; } public override void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { base.完成单次检测(效果实例, 召唤者, 受影响者, 召唤物体); if (随机添加多个效果 && Object.op_Implicit((Object)(object)受影响者)) { UnitEffectBase val = 所有可用效果列表[Random.Range(0, 所有可用效果列表.Count)]; Transform transform = ((Component)受影响者.data.mainRig).transform; 添加效果逻辑(transform, val); Debug.Log((object)("进行实例化效果操作完成" + ((Object)val).name + "实例化完成")); } } public override void 完成所有检测(Unit 召唤者, Unit[] 受影响者) { base.完成所有检测(召唤者, 受影响者); if (随机添加多个效果) { return; } Debug.Log((object)"进行全员实例化效果操作"); if (受影响者 != null && 受影响者.Length != 0) { UnitEffectBase val = 所有可用效果列表[Random.Range(0, 所有可用效果列表.Count)]; for (int i = 0; i < 受影响者.Length; i++) { Transform transform = ((Component)受影响者[i].data.mainRig).transform; 添加效果逻辑(transform, val); } Debug.Log((object)$"全员实例化效果操作完成!!总计{受影响者.Length}个单位效果添加,效果名字 : {((Object)val).name}"); } } private void 添加效果逻辑(Transform 添加目标, UnitEffectBase 目标效果) { //IL_0029: 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) UnitEffectBase val = UnitEffectBase.AddEffectToTarget(((Component)添加目标).gameObject, 目标效果); if ((Object)(object)val == (Object)null) { val = Object.Instantiate(目标效果, 添加目标); ((Component)val).transform.SetPositionAndRotation(添加目标.position, Quaternion.identity); TeamHolder.AddTeamHolder(((Component)val).gameObject, ((Component)this).gameObject); val.DoEffect(); } else { val.Ping(); } } } } namespace HeMoDingDingMod.角色类.幸运方块j.好运效果 { public class 单位回血组件_随机事件 : UnitEffectBase { [CompilerGenerated] private sealed class <回血携程>d__2 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float 回血时间; public HealthHandler 健康管理器; public float 随机回血量; public 单位回血组件_随机事件 <>4__this; private float 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <回血携程>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_005a: 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_0089: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0f; break; case 1: <>1__state = -1; break; } if (5__1 < 回血时间 && Object.op_Implicit((Object)(object)健康管理器)) { ((Damagable)健康管理器).TakeDamage(0f - 随机回血量, ((Component)<>4__this).transform.position, (Unit)null, (DamageType)0); 5__1 += 0.5f; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } Object.Destroy((Object)(object)<>4__this); 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(); } } private Coroutine 存储携程 = null; private void Start() { Unit component = ((Component)((Component)this).transform.root).GetComponent(); ((MonoBehaviour)this).StartCoroutine(回血携程(Random.Range(5, 100), component.data.healthHandler, Random.Range(300, 1000))); } [IteratorStateMachine(typeof(<回血携程>d__2))] private IEnumerator 回血携程(float 回血时间, HealthHandler 健康管理器, float 随机回血量) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <回血携程>d__2(0) { <>4__this = this, 回血时间 = 回血时间, 健康管理器 = 健康管理器, 随机回血量 = 随机回血量 }; } public override void DoEffect() { } public override void Ping() { } } public class 增加伤害效果 : UnitEffectBase { private void Start() { Unit component = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)component != (Object)null) { WeaponHandler weaponHandler = component.data.weaponHandler; if ((Object)(object)weaponHandler != (Object)null) { if ((Object)(object)weaponHandler.rightWeapon != (Object)null) { CollisionWeapon component2 = ((Component)weaponHandler.rightWeapon).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.damage *= Random.Range(0.5f, 10f); } } if ((Object)(object)weaponHandler.leftWeapon != (Object)null) { CollisionWeapon component3 = ((Component)weaponHandler.leftWeapon).GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.damage *= Random.Range(0.5f, 10f); } } } } Object.Destroy((Object)(object)this); } public override void DoEffect() { } public override void Ping() { } } public class 最大生命值增加 : UnitEffectBase { private void Start() { Unit component = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)component != (Object)null) { float num = Random.Range(1f, 5f); DataHandler data = component.data; data.maxHealth *= num; DataHandler data2 = component.data; data2.health *= num; } Object.Destroy((Object)(object)this); } public override void DoEffect() { } public override void Ping() { } } } namespace HeMoDingDingMod.角色类.幸运方块j.好运效果.效果添加组件 { public class 目标检测添加效果指定版本 : 检测目标并操作父类 { public List 所有可用效果列表; protected override void Start() { base.Start(); } public override void 检测操作逻辑(Unit 此单位, DataHandler 此单位数据, DataHandler 目标单位数据) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) base.检测操作逻辑(此单位, 此单位数据, 目标单位数据); UnitEffectBase val = 所有可用效果列表[Random.Range(0, 所有可用效果列表.Count)]; Transform transform = ((Component)目标单位数据.mainRig).transform; UnitEffectBase val2 = UnitEffectBase.AddEffectToTarget(((Component)transform).gameObject, val); if ((Object)(object)val2 == (Object)null) { val2 = Object.Instantiate(val, transform); ((Component)val2).transform.SetPositionAndRotation(transform.position, Quaternion.identity); TeamHolder.AddTeamHolder(((Component)val2).gameObject, ((Component)this).gameObject); val2.DoEffect(); } else { val2.Ping(); } } } public class 碰撞检测随机添加效果指定版本 : 碰撞检测获取单位基类 { public List 所有可用效果列表; public bool 随机添加多个效果 = true; protected override void Start() { base.Start(); 随机添加多个效果 = Random.value > 0.5f; } public override void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { base.完成单次检测(效果实例, 召唤者, 受影响者, 召唤物体); if (随机添加多个效果 && Object.op_Implicit((Object)(object)受影响者)) { UnitEffectBase val = 所有可用效果列表[Random.Range(0, 所有可用效果列表.Count)]; Transform transform = ((Component)受影响者.data.mainRig).transform; 添加效果逻辑(transform, val); Debug.Log((object)("进行实例化效果操作完成" + ((Object)val).name + "实例化完成")); } } public override void 完成所有检测(Unit 召唤者, Unit[] 受影响者) { base.完成所有检测(召唤者, 受影响者); if (随机添加多个效果) { return; } Debug.Log((object)"进行全员实例化效果操作"); if (受影响者 != null && 受影响者.Length != 0) { UnitEffectBase val = 所有可用效果列表[Random.Range(0, 所有可用效果列表.Count)]; for (int i = 0; i < 受影响者.Length; i++) { Transform transform = ((Component)受影响者[i].data.mainRig).transform; 添加效果逻辑(transform, val); } Debug.Log((object)$"全员实例化效果操作完成!!总计{受影响者.Length}个单位效果添加,效果名字 : {((Object)val).name}"); } } private void 添加效果逻辑(Transform 添加目标, UnitEffectBase 目标效果) { //IL_0029: 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) UnitEffectBase val = UnitEffectBase.AddEffectToTarget(((Component)添加目标).gameObject, 目标效果); if ((Object)(object)val == (Object)null) { val = Object.Instantiate(目标效果, 添加目标); ((Component)val).transform.SetPositionAndRotation(添加目标.position, Quaternion.identity); TeamHolder.AddTeamHolder(((Component)val).gameObject, ((Component)this).gameObject); val.DoEffect(); } else { val.Ping(); } } } } namespace HeMoDingDingMod.角色类.基兰 { public class 单位复活效果 : MonoBehaviour { [CompilerGenerated] private sealed class <生成复活>d__7 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 单位复活效果 <>4__this; private GameObject[] <生成单位列表>5__1; private Unit <新单位>5__2; private Vector3 <偏移量>5__3; private Rigidbody[] <刚体数组>5__4; private int 5__5; private GameObject <特效实例>5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <生成复活>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <生成单位列表>5__1 = null; <新单位>5__2 = null; <刚体数组>5__4 = null; <特效实例>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0069: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.复活等待时间); <>1__state = 1; return true; case 1: { <>1__state = -1; UnitBlueprint unitBlueprint = <>4__this.当前单位.unitBlueprint; <生成单位列表>5__1 = ((unitBlueprint != null) ? unitBlueprint.Spawn(((Component)<>4__this).transform.position, ((Component)<>4__this).transform.rotation, <>4__this.当前单位.data.team, 1f, (UnitPoolInfo?)null) : null); if (<生成单位列表>5__1 != null && <生成单位列表>5__1.Length != 0) { GameObject obj = <生成单位列表>5__1[0]; <新单位>5__2 = ((obj != null) ? obj.GetComponent() : null); if ((Object)(object)<新单位>5__2 != (Object)null) { <偏移量>5__3 = <>4__this.当前单位.data.mainRig.position - <新单位>5__2.data.mainRig.position; <刚体数组>5__4 = <新单位>5__2.data.allRigs.AllRigs; 5__5 = 0; while (5__5 < <刚体数组>5__4.Length) { <刚体数组>5__4[5__5].MovePosition(<刚体数组>5__4[5__5].position + <偏移量>5__3); 5__5++; } if ((Object)(object)<>4__this.复活特效 != (Object)null) { <特效实例>5__6 = Object.Instantiate(<>4__this.复活特效, <>4__this.当前单位.data.mainRig.position, Quaternion.identity); TeamHolder.AddTeamHolder(<特效实例>5__6, ((Component)<>4__this).gameObject); <特效实例>5__6 = null; } <刚体数组>5__4 = null; } <新单位>5__2 = null; } <>4__this.当前单位.DestroyUnit(); 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(); } } public float 复活等待时间 = 2f; public GameObject 复活特效; private Unit 当前单位; private HealthHandler 健康管理器; private bool 已处理死亡 = false; private void Start() { 当前单位 = ((Component)((Component)this).transform.root).GetComponent(); 健康管理器 = 当前单位.data.healthHandler; 健康管理器.AddDieAction((Action)拦截死亡); } private void 拦截死亡() { if (!已处理死亡) { 已处理死亡 = true; 健康管理器.willBeRewived = true; ((MonoBehaviour)this).StartCoroutine(生成复活()); } } [IteratorStateMachine(typeof(<生成复活>d__7))] private IEnumerator 生成复活() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <生成复活>d__7(0) { <>4__this = this }; } private void OnDestroy() { if ((Object)(object)健康管理器 != (Object)null) { 健康管理器.RemoveDieAction((Action)拦截死亡); } } } public class 在目标位置召唤预制体 : 检测目标并操作父类 { public 地面检测实例化物体 地面检测工具; public GameObject 预制体; public override void 检测操作逻辑(Unit 此单位, DataHandler 此单位数据, DataHandler 目标单位数据) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) base.检测操作逻辑(此单位, 此单位数据, 目标单位数据); if (Object.op_Implicit((Object)(object)预制体) && Object.op_Implicit((Object)(object)地面检测工具)) { 地面检测工具.实例化物体2(预制体, 目标单位数据.mainRig.position); } } } [HarmonyPatch(typeof(Unit), "Start")] public class Patch_Unit_Start { [HarmonyPrefix] private static void Prefix(Unit __instance) { if ((Object)(object)__instance != (Object)null) { 场内单位存储器.AddUnit(__instance); } } } [HarmonyPatch(typeof(Unit), "OnDestroy")] public class Patch_Unit_OnDestroy { [HarmonyPrefix] private static void Prefix(Unit __instance) { if ((Object)(object)__instance != (Object)null) { 场内单位存储器.RemoveUnit(__instance); } } } public static class 场内单位存储器 { private static readonly List _allUnits = new List(); private static readonly object _lockObject = new object(); public static IReadOnlyList 场景内的全部单位数据 => _allUnits; public static int UnitCount => _allUnits.Count; public static IReadOnlyList GetUnitsByTeam(Team team) { //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) lock (_lockObject) { return _allUnits.FindAll((Unit u) => (Object)(object)u != (Object)null && u.Team == team); } } public static IReadOnlyList GetAliveUnits() { lock (_lockObject) { return _allUnits.FindAll((Unit u) => (Object)(object)u != (Object)null && !u.dead); } } internal static void AddUnit(Unit unit) { if ((Object)(object)unit == (Object)null) { return; } lock (_lockObject) { if (!_allUnits.Contains(unit)) { _allUnits.Add(unit); } } } internal static void RemoveUnit(Unit unit) { if ((Object)(object)unit == (Object)null) { return; } lock (_lockObject) { _allUnits.Remove(unit); } } public static void Clear() { lock (_lockObject) { _allUnits.Clear(); } } public static bool Contains(Unit unit) { if ((Object)(object)unit == (Object)null) { return false; } lock (_lockObject) { return _allUnits.Contains(unit); } } } public class 平滑跟随目标 : MonoBehaviour { public Transform 跟随目标; public Transform 需要跟随对象; public float 跟随速度 = 5f; public float 旋转速度 = 5f; private Vector3 相对位置; private Quaternion 相对旋转; private void Start() { //IL_003d: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0063: 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) if ((Object)(object)跟随目标 == (Object)null || (Object)(object)需要跟随对象 == (Object)null) { Debug.LogError((object)"平滑跟随目标:跟随目标或需要跟随对象未赋值!"); return; } 相对位置 = 跟随目标.InverseTransformPoint(需要跟随对象.position); 相对旋转 = Quaternion.Inverse(跟随目标.rotation) * 需要跟随对象.rotation; 需要跟随对象.SetParent(((Component)this).transform.root); } private void Update() { //IL_002b: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0047: 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_0059: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0094: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)跟随目标 == (Object)null) && !((Object)(object)需要跟随对象 == (Object)null)) { Vector3 val = 跟随目标.TransformPoint(相对位置); Quaternion val2 = 跟随目标.rotation * 相对旋转; 需要跟随对象.position = Vector3.Lerp(需要跟随对象.position, val, 跟随速度 * Time.deltaTime); 需要跟随对象.rotation = Quaternion.Slerp(需要跟随对象.rotation, val2, 旋转速度 * Time.deltaTime); } } } public class 旋转动画器 : MonoBehaviour { [Header("旋转参数")] public Vector3 旋转轴 = new Vector3(0f, 1f, 0f); public float 旋转速度 = 90f; [Header("旋转模式")] public bool 本地坐标轴 = true; public bool 自动旋转 = true; public bool 反转方向 = false; [Header("随机起始位置")] public bool 随机起始角度 = false; private float 当前速度; private void Start() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_006e: Unknown result type (might be due to invalid IL or missing references) 当前速度 = (反转方向 ? (0f - 旋转速度) : 旋转速度); if (随机起始角度) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Random.Range(0f, 360f), Random.Range(0f, 360f), Random.Range(0f, 360f)); if (本地坐标轴) { ((Component)this).transform.localRotation = Quaternion.Euler(val); } else { ((Component)this).transform.rotation = Quaternion.Euler(val); } } } private void Update() { if (自动旋转) { 执行旋转(); } } public void 执行旋转() { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) float num = 当前速度 * Time.deltaTime; if (本地坐标轴) { ((Component)this).transform.Rotate(((Vector3)(ref 旋转轴)).normalized * num, (Space)1); } else { ((Component)this).transform.Rotate(((Vector3)(ref 旋转轴)).normalized * num, (Space)0); } } public void 开始旋转() { 自动旋转 = true; } public void 停止旋转() { 自动旋转 = false; } public void 设置旋转速度(float 速度) { 旋转速度 = Mathf.Abs(速度); 当前速度 = (反转方向 ? (0f - 旋转速度) : 旋转速度); } public void 设置旋转方向(bool 反转) { 反转方向 = 反转; 当前速度 = (反转方向 ? (0f - 旋转速度) : 旋转速度); } public void 设置旋转轴(Vector3 新旋转轴) { //IL_0004: 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) 旋转轴 = ((Vector3)(ref 新旋转轴)).normalized; } public void 添加临时旋转(float 角度) { //IL_0015: 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) float num = 角度 * Time.deltaTime; ((Component)this).transform.Rotate(((Vector3)(ref 旋转轴)).normalized * num, (Space)(本地坐标轴 ? 1 : 0)); } public void 重置旋转() { //IL_0024: 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) if (本地坐标轴) { ((Component)this).transform.localRotation = Quaternion.identity; } else { ((Component)this).transform.rotation = Quaternion.identity; } } public void 设置目标旋转角度(Vector3 角度) { //IL_0020: 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) if (本地坐标轴) { ((Component)this).transform.localEulerAngles = 角度; } else { ((Component)this).transform.eulerAngles = 角度; } } } public class 系统测试组件 : GameStateListener { public Unit 这个单位; private void Start() { 这个单位 = ((Component)((Component)this).transform.root).GetComponent(); } public override void OnEnterPlacementState() { } public override void OnEnterBattleState() { //IL_0037: 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) List list = new List(场内单位存储器.场景内的全部单位数据); if (list.Count <= 0) { return; } foreach (Unit item in list) { if ((Object)(object)item != (Object)null && item.Team != 这个单位.Team) { Object.Destroy((Object)(object)((Component)item).gameObject); } } } } public class 赋予高价值单位效果 : MonoBehaviour { [Header("配置")] private Unit 这个单位; public UnitEffectBase 单位效果预制体; public int 最大效果给予个数 = 3; public bool 只对存活单位生效 = true; public bool 排除自己 = true; private List _cachedHighValueUnits; private float _lastUpdateTime = 0f; private float _更新间隔 = 1f; private void Start() { 这个单位 = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)这个单位 == (Object)null) { Debug.LogError((object)"赋予高价值单位效果:未找到Unit组件"); ((Behaviour)this).enabled = false; } } public void 添加效果() { if ((Object)(object)单位效果预制体 == (Object)null) { Debug.LogWarning((object)"单位效果预制体为空"); return; } List list = 获取友方高价值单位并按照价值排序(); if (list == null || list.Count == 0) { Debug.Log((object)"没有找到友方高价值单位"); return; } int num = Mathf.Min(最大效果给予个数, list.Count); for (int i = 0; i < num; i++) { Unit val = list[i]; if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null || (Object)(object)val.data.mainRig == (Object)null) { Debug.LogWarning((object)$"第{i}个目标单位或其mainRig为空"); } else { 添加效果逻辑(((Component)val.data.mainRig).transform, 单位效果预制体); } } Debug.Log((object)$"已为{num}个高价值单位添加效果"); } private List 获取友方高价值单位并按照价值排序() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (_cachedHighValueUnits != null && Time.time - _lastUpdateTime < _更新间隔) { return _cachedHighValueUnits; } IReadOnlyList unitsByTeam = 场内单位存储器.GetUnitsByTeam(这个单位.Team); if (unitsByTeam == null) { return new List(); } List list = new List(); foreach (Unit item in unitsByTeam) { if (!((Object)(object)item == (Object)null) && (!只对存活单位生效 || !item.data.Dead) && (!排除自己 || !((Object)(object)item == (Object)(object)这个单位)) && !((Object)(object)item.unitBlueprint == (Object)null)) { list.Add(item); } } list.Sort(delegate(Unit a, Unit b) { float value = a.unitBlueprint.GetUnitCost(true); return ((float)b.unitBlueprint.GetUnitCost(true)).CompareTo(value); }); _cachedHighValueUnits = list; _lastUpdateTime = Time.time; return list; } private void 添加效果逻辑(Transform 添加目标, UnitEffectBase 目标效果) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)添加目标 == (Object)null || (Object)(object)目标效果 == (Object)null) { return; } UnitEffectBase val = UnitEffectBase.AddEffectToTarget(((Component)添加目标).gameObject, 目标效果); if ((Object)(object)val == (Object)null) { val = Object.Instantiate(目标效果, 添加目标); if ((Object)(object)val != (Object)null) { ((Component)val).transform.SetPositionAndRotation(添加目标.position, Quaternion.identity); TeamHolder.AddTeamHolder(((Component)val).gameObject, ((Component)this).gameObject); val.DoEffect(); } } else { val.Ping(); } } public void 清除缓存() { _cachedHighValueUnits = null; } public List 获取高价值单位列表(int 获取数量) { List list = 获取友方高价值单位并按照价值排序(); if (list == null) { return new List(); } int count = Mathf.Min(获取数量, list.Count); return list.GetRange(0, count); } public void 叠加() { } } public class 效果事件HeMod : UnitEffectBase { public UnityEvent 执行效果事件; public UnityEvent 叠加效果事件; public override void DoEffect() { UnityEvent obj = 执行效果事件; if (obj != null) { obj.Invoke(); } } public override void Ping() { UnityEvent obj = 叠加效果事件; if (obj != null) { obj.Invoke(); } } } } namespace HeMoDingDingMod.角色类.初王 { public class 单位停止攻击行为和释放技能行为 : MonoBehaviour { public float 攻击停止时间 = 9f; public float 技能停止时间 = 9f; private Unit 这个单位; private ConditionalEvent[] 所有技能事件; private void Start() { 这个单位 = ((Component)((Component)this).transform.root).GetComponent(); 所有技能事件 = ((Component)这个单位).GetComponentsInChildren(); } public void Go() { if ((Object)(object)这个单位 != (Object)null && (Object)(object)这个单位.data.weaponHandler != (Object)null) { 这个单位.data.weaponHandler.StopAttacksFor(攻击停止时间); } if (所有技能事件 == null) { return; } ConditionalEvent[] array = 所有技能事件; foreach (ConditionalEvent val in array) { if (val.isStunnable) { val.StunAllOfMyMovesFor(技能停止时间); } } } } public class 刚体给与器 : MonoBehaviour { private void Start() { Unit component = ((Component)((Component)this).transform.root).GetComponent(); WeaponHandler componentInChildren = ((Component)component).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren) && Object.op_Implicit((Object)(object)componentInChildren.rightWeapon)) { Rigidbody component2 = ((Component)componentInChildren.rightWeapon).GetComponent(); if (!((Object)(object)component2 != (Object)null)) { } } } } public class 单位半血事件5 : MonoBehaviour { public Unit 这个单位; public UnityEvent 单位半血事件; private bool 已触发 = false; private bool 单位半血量引用 { get { if ((Object)(object)这个单位 == (Object)null || (Object)(object)这个单位.data == (Object)null) { return false; } return 这个单位.data.health <= 这个单位.data.maxHealth * 0.5f; } } private void Start() { if ((Object)(object)((Component)this).transform == (Object)null || (Object)(object)((Component)this).transform.root == (Object)null) { Debug.LogError((object)"[单位半血事件5] Transform或root为空,脚本将禁用"); ((Behaviour)this).enabled = false; return; } Unit component = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)("[单位半血事件5] 在根物体 " + ((Object)((Component)this).transform.root).name + " 上找不到Unit组件,脚本将禁用")); ((Behaviour)this).enabled = false; return; } 这个单位 = component; if ((Object)(object)这个单位.data == (Object)null) { Debug.LogWarning((object)("[单位半血事件5] 单位 " + ((Object)这个单位).name + " 的data数据为空")); } } private void Update() { if ((Object)(object)这个单位 == (Object)null) { Debug.LogWarning((object)"[单位半血事件5] 单位引用已丢失,脚本将禁用"); ((Behaviour)this).enabled = false; } else if ((Object)(object)这个单位.data == (Object)null) { Debug.LogWarning((object)("[单位半血事件5] 单位 " + ((Object)这个单位).name + " 的data数据为空,无法检测血量")); } else if (单位半血量引用 && !已触发) { UnityEvent obj = 单位半血事件; if (obj != null) { obj.Invoke(); } 已触发 = true; ((Behaviour)this).enabled = false; } } } public class 向下检测地面清除刚体动能 : MonoBehaviour { [CompilerGenerated] private sealed class <检测携程>d__16 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GameObject dim; public 向下检测地面清除刚体动能 <>4__this; private float <已用时间>5__1; private RaycastHit <击中信息>5__2; private GameObject <新实例>5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <检测携程>d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <新实例>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0051: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <已用时间>5__1 = 0f; break; case 1: <>1__state = -1; break; } if (<已用时间>5__1 < <>4__this.检测时间) { <已用时间>5__1 += Time.deltaTime; if (!Physics.Raycast(<>4__this.检测点.position, Vector3.down, ref <击中信息>5__2, <>4__this.检测距离, 512)) { <>2__current = null; <>1__state = 1; return true; } if ((Object)(object)dim != (Object)null && !<>4__this.已检测成功) { <新实例>5__3 = Object.Instantiate(dim, ((RaycastHit)(ref <击中信息>5__2)).point, Quaternion.identity); TeamHolder.AddTeamHolder(<新实例>5__3, ((Component)<>4__this).gameObject); <新实例>5__3 = null; } if (<>4__this.检测成功后自动清除刚体动能 && !<>4__this.已检测成功) { <>4__this.清除刚体动能(); } if (!<>4__this.已检测成功) { UnityEvent 检测成功事件 = <>4__this.检测成功事件; if (检测成功事件 != null) { 检测成功事件.Invoke(); } <>4__this.已检测成功 = true; } } <>4__this.正在检测携程 = 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(); } } public float 检测时间 = 2f; public Transform 检测点; public float 检测距离 = 2f; public bool 检测成功后自动清除刚体动能; public UnityEvent 检测成功事件; private Unit 这个单位; private Rigidbody[] 单位全部刚体; private Coroutine 正在检测携程; private bool 已检测成功 = false; private void Start() { 这个单位 = ((Component)((Component)this).transform.root).GetComponent(); if (Object.op_Implicit((Object)(object)这个单位)) { 单位全部刚体 = 这个单位.data.allRigs.AllRigs; } if ((Object)(object)检测点 == (Object)null) { 检测点 = ((Component)this).transform; } } public void 开始检测(GameObject 实例化地面物体) { if (正在检测携程 != null) { ((MonoBehaviour)this).StopCoroutine(正在检测携程); } 已检测成功 = false; 正在检测携程 = ((MonoBehaviour)this).StartCoroutine(检测携程(实例化地面物体)); } public void 停止检测() { if (正在检测携程 != null) { ((MonoBehaviour)this).StopCoroutine(正在检测携程); 正在检测携程 = null; } } public void 清除刚体动能() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (单位全部刚体 == null || 单位全部刚体.Length == 0) { return; } Rigidbody[] array = 单位全部刚体; foreach (Rigidbody val in array) { if ((Object)(object)val != (Object)null) { val.velocity = Vector3.zero; val.angularVelocity = Vector3.zero; } } } public void 清除指定刚体动能(Rigidbody 目标刚体) { //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) if ((Object)(object)目标刚体 != (Object)null) { 目标刚体.velocity = Vector3.zero; 目标刚体.angularVelocity = Vector3.zero; } } public bool 是否检测到地面() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); return Physics.Raycast(检测点.position, Vector3.down, ref val, 检测距离, 512); } public Vector3 获取地面点位置() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_002f: 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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(检测点.position, Vector3.down, ref val, 检测距离, 512)) { return ((RaycastHit)(ref val)).point; } return Vector3.zero; } [IteratorStateMachine(typeof(<检测携程>d__16))] private IEnumerator 检测携程(GameObject dim) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <检测携程>d__16(0) { <>4__this = this, dim = dim }; } } internal class 斧头震地 : 长条形状碰撞检测 { public float 向上力大小 = 9000f; public float 伤害 = 900f; public override void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { //IL_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references) base.完成单次检测(效果实例, 召唤者, 受影响者, 召唤物体); if (!Object.op_Implicit((Object)(object)受影响者)) { return; } if ((Object)(object)召唤者 == (Object)null) { TeamHolder component = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)component != (Object)null) { 召唤者 = ((Component)component).GetComponent(); } } ((Damagable)受影响者.data.healthHandler).TakeDamage(伤害, ((Component)this).transform.position, 召唤者, (DamageType)0); Rigidbody[] allRigs = 受影响者.data.allRigs.AllRigs; for (int i = 0; i < allRigs.Length; i++) { allRigs[i].AddForce(Vector3.up * 向上力大小, (ForceMode)5); } } } internal class 斧头震地圆形版本 : 碰撞检测获取单位基类 { public float 向上力大小 = 9000f; public float 伤害 = 900f; public override void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { //IL_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references) base.完成单次检测(效果实例, 召唤者, 受影响者, 召唤物体); if (!Object.op_Implicit((Object)(object)受影响者)) { return; } if ((Object)(object)召唤者 == (Object)null) { TeamHolder component = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)component != (Object)null) { 召唤者 = ((Component)component).GetComponent(); } } ((Damagable)受影响者.data.healthHandler).TakeDamage(伤害, ((Component)this).transform.position, 召唤者, (DamageType)0); Rigidbody[] allRigs = 受影响者.data.allRigs.AllRigs; for (int i = 0; i < allRigs.Length; i++) { allRigs[i].AddForce(Vector3.up * 向上力大小, (ForceMode)5); } } } public class 最近单位获取工具类32 : MonoBehaviour { public bool useUnitTeam = false; private Unit unit; private Team team; private TeamHolder teamholder; private TeamSystem m_teamSystem; private List orderedUnits; private void Start() { SetTeamSystem(); } private List GetUnitsAndSort() { //IL_0003: 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_0014: Unknown result type (might be due to invalid IL or missing references) team = GetTeam(); List teamUnits = m_teamSystem.GetTeamUnits((Team)(((int)team == 0) ? 1 : 0)); teamUnits.Sort((Unit x, Unit y) => Vector3.Distance(((Component)this).transform.position, x.data.mainRig.position).CompareTo(Vector3.Distance(((Component)this).transform.position, y.data.mainRig.position))); return teamUnits; } public List GetTargets(float? maxRange = 0f) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) orderedUnits = new List(); orderedUnits.AddRange(GetUnitsAndSort()); if (maxRange != 0f) { for (int i = 0; i < orderedUnits.Count; i++) { if (Vector3.Distance(((Component)this).transform.position, ((Component)orderedUnits[i].data.mainRig).transform.position) > maxRange) { orderedUnits.RemoveRange(i, orderedUnits.Count - i); break; } } } return orderedUnits; } private Team GetTeam() { //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_002f: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (useUnitTeam) { unit = ((Component)this).GetComponentInParent(); if (Object.op_Implicit((Object)(object)unit)) { team = unit.Team; } } else { teamholder = ((Component)((Component)this).transform).GetComponent(); if (Object.op_Implicit((Object)(object)teamholder)) { team = teamholder.team; } } return team; } private void SetTeamSystem() { m_teamSystem = World.Active.GetOrCreateManager(); } } public class 抓取投技技能 : MonoBehaviour { private enum 投技状态 { 空闲, 第一阶段_冲刺, 等待击飞冷却, 第二阶段_手部抓取, 第三阶段_砸地向密集区, 完成 } [CompilerGenerated] private sealed class <击飞协程>d__53 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 抓取投技技能 <>4__this; private float <击飞计时器>5__1; private float <击飞总时间>5__2; private RotationHandler <旋转管理器>5__3; private float <曲线值>5__4; private float <力度值>5__5; private Vector3 <击飞方向>5__6; private Exception 5__7; private float <与地面距离>5__8; private Exception 5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <击飞协程>d__53(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <旋转管理器>5__3 = null; 5__7 = null; 5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_0155: 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_016a: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <击飞计时器>5__1 = 0f; <击飞总时间>5__2 = <>4__this.Get曲线总时间(<>4__this.击飞力度曲线); if (<击飞总时间>5__2 <= 0f) { <>4__this.记录异常("击飞协程: 击飞总时间无效"); return false; } <旋转管理器>5__3 = ((Component)<>4__this.目标数据).GetComponent(); if (Object.op_Implicit((Object)(object)<>4__this.目标数据) && Object.op_Implicit((Object)(object)<旋转管理器>5__3)) { <旋转管理器>5__3.rotationMultiplier = 0f; } break; case 1: <>1__state = -1; break; } if (<击飞计时器>5__1 < <击飞总时间>5__2 && (Object)(object)<>4__this.目标主刚体 != (Object)null) { <击飞计时器>5__1 += Time.deltaTime; <曲线值>5__4 = 0f; <力度值>5__5 = 0f; try { <曲线值>5__4 = <>4__this.击飞力度曲线.Evaluate(<击飞计时器>5__1); <力度值>5__5 = <>4__this.击飞力度 * <曲线值>5__4; } catch (Exception ex) { 5__7 = ex; <>4__this.记录异常("击飞协程计算异常: " + 5__7.Message); goto IL_02c2; } Vector3 val = Vector3.up * 3f + <>4__this.记录朝向目标方向; <击飞方向>5__6 = ((Vector3)(ref val)).normalized; try { <与地面距离>5__8 = Vector3.Distance(<>4__this.记录地面位置, <>4__this.目标主刚体.position); if (<与地面距离>5__8 >= 40f) { if (<与地面距离>5__8 >= 60f) { <>4__this.目标主刚体.velocity = Vector3.zero; if (Object.op_Implicit((Object)(object)<>4__this.目标主刚体)) { <>4__this.目标主刚体.isKinematic = true; } } } else { <>4__this.目标主刚体.AddForce(<击飞方向>5__6 * <力度值>5__5 * <>4__this.时间倍率, (ForceMode)5); } } catch (Exception ex) { 5__9 = ex; <>4__this.记录异常("击飞协程施加力异常: " + 5__9.Message); goto IL_02c2; } <>2__current = null; <>1__state = 1; return true; } goto IL_02c2; IL_02c2: <>4__this.目标主刚体.isKinematic = false; if (Object.op_Implicit((Object)(object)<>4__this.目标数据) && Object.op_Implicit((Object)(object)<旋转管理器>5__3)) { <旋转管理器>5__3.rotationMultiplier = 1f; } <>4__this.当前击飞协程 = 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(); } } [Header("第一阶段:冲刺")] public float 冲刺力度; public AnimationCurve 冲刺力度曲线; [Tooltip("触发击飞的关键帧索引(从0开始)")] public int 击飞触发关键帧索引 = 1; [Tooltip("距离触发击飞的距离阈值,小于此距离时立即触发击飞")] public float 击飞距离阈值 = 3f; [Header("第二阶段:手部抓取")] public float 手部抓取力度; public AnimationCurve 手部抓取力度曲线; public float 手部展开力度; public AnimationCurve 手部展开力度曲线; [Header("第三阶段:砸地")] public float 下落力度; public AnimationCurve 下落力度曲线; public GameObject 下落冲击波预制体; public GameObject 冲刺时生成预制体; public GameObject 半血生成额外预制体; public bool 释放额外实例化预制体 = false; [Header("击飞设置")] public float 击飞力度; public AnimationCurve 击飞力度曲线; public 最近单位获取工具类32 单位获取工具; public UnityEvent 到达触发击飞事件; [Header("调试")] public bool 启用异常日志 = true; public bool 强制抓取 = true; public float 强制抓取时间参数 = 3f; private 投技状态 当前状态 = 投技状态.空闲; private Unit 这个单位; private DataHandler 单位数据; private Rigidbody 单位主刚体; private Rigidbody 单位左手; private Rigidbody 单位右手; private DataHandler 目标数据; private Rigidbody 目标主刚体; private Vector3 密集区域位置; private float 状态计时器 = 0f; private float 冲刺第一阶段计时器 = 0f; private bool 已触发击飞 = false; private bool 已抓取成功 = false; private float 击飞触发时间点 = 0f; private float 曲线总时间 = 0f; private Coroutine 当前击飞协程 = null; private float 时间倍率; private Vector3 抓取偏移位置; private Vector3 记录朝向目标方向; private Rigidbody[] 记录目标全部刚体数组; private Vector3 固定抓取位置 = new Vector3(0f, 0f, 1f); private bool 有密集区域; private Vector3 记录地面位置; private bool 记录密集 = false; public bool 启用 = true; private void Start() { try { 这个单位 = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)这个单位 == (Object)null) { 记录异常("Start: 未找到Unit组件"); return; } 单位数据 = 这个单位.data; if ((Object)(object)单位数据 == (Object)null) { 记录异常("Start: 单位数据为空"); return; } 单位主刚体 = 单位数据.mainRig; if ((Object)(object)单位主刚体 == (Object)null) { 记录异常("Start: 单位主刚体为空"); } if (Object.op_Implicit((Object)(object)单位数据.leftHand)) { 单位左手 = ((Component)单位数据.leftHand).GetComponent(); if ((Object)(object)单位左手 == (Object)null) { 记录异常("Start: 左手刚体为空"); } } else { 记录异常("Start: 左手对象为空"); } if (Object.op_Implicit((Object)(object)单位数据.rightHand)) { 单位右手 = ((Component)单位数据.rightHand).GetComponent(); if ((Object)(object)单位右手 == (Object)null) { 记录异常("Start: 右手刚体为空"); } } else { 记录异常("Start: 右手对象为空"); } if (冲刺力度曲线 == null) { 记录异常("Start: 冲刺力度曲线为空"); } if (手部抓取力度曲线 == null) { 记录异常("Start: 手部抓取力度曲线为空"); } if (下落力度曲线 == null) { 记录异常("Start: 下落力度曲线为空"); } if (击飞力度曲线 == null) { 记录异常("Start: 击飞力度曲线为空"); } 曲线总时间 = Get曲线总时间(冲刺力度曲线); 缓存击飞触发时间(); } catch (Exception ex) { 记录异常("Start发生异常: " + ex.Message + "\n" + ex.StackTrace); } } private void 记录异常(string 消息) { if (启用异常日志) { Debug.LogError((object)("[抓取投技技能] " + 消息)); } } private void 缓存击飞触发时间() { try { if (冲刺力度曲线 == null || 冲刺力度曲线.length == 0) { 击飞触发时间点 = 0.3f; 记录异常("缓存击飞触发时间: 冲刺力度曲线为空,使用默认值0.3f"); } else if (击飞触发关键帧索引 >= 0 && 击飞触发关键帧索引 < 冲刺力度曲线.length) { 击飞触发时间点 = ((Keyframe)(ref 冲刺力度曲线.keys[击飞触发关键帧索引])).time; } else { 击飞触发时间点 = ((Keyframe)(ref 冲刺力度曲线.keys[冲刺力度曲线.length - 1])).time; 记录异常($"缓存击飞触发时间: 关键帧索引{击飞触发关键帧索引}无效,使用最后关键帧时间{击飞触发时间点}"); } } catch (Exception ex) { 记录异常("缓存击飞触发时间异常: " + ex.Message); 击飞触发时间点 = 0.3f; } } private void Update() { if (!启用) { return; } try { 时间倍率 = Time.deltaTime * 220f; if (时间倍率 <= 0f) { 时间倍率 = 1f; } switch (当前状态) { case 投技状态.第一阶段_冲刺: 更新冲刺阶段(); break; case 投技状态.等待击飞冷却: 更新等待阶段(); break; case 投技状态.第二阶段_手部抓取: 更新手部抓取阶段(); break; case 投技状态.第三阶段_砸地向密集区: 更新砸地阶段(); break; } } catch (Exception ex) { 记录异常("Update异常: " + ex.Message + "\n" + ex.StackTrace); } } private void 更新冲刺阶段() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_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) //IL_0095: 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_00a2: 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_00cf: 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) try { if (冲刺力度曲线 == null) { 记录异常("更新冲刺阶段: 冲刺力度曲线为空"); return; } 冲刺第一阶段计时器 += Time.deltaTime; float num = 冲刺力度曲线.Evaluate(冲刺第一阶段计时器); if ((Object)(object)目标主刚体 != (Object)null && (Object)(object)单位主刚体 != (Object)null) { Vector3 val = 目标主刚体.position - 单位主刚体.position; Vector3 normalized = ((Vector3)(ref val)).normalized; 单位主刚体.AddForce(normalized * 冲刺力度 * num * 时间倍率, (ForceMode)5); if (!已触发击飞) { float num2 = Vector3.Distance(单位主刚体.position, 目标主刚体.position); if (num2 <= 击飞距离阈值) { 冲刺第一阶段计时器 = 击飞触发时间点; 触发击飞(); } } } else if ((Object)(object)目标主刚体 == (Object)null && 当前状态 == 投技状态.第一阶段_冲刺) { 记录异常("更新冲刺阶段: 目标主刚体为空"); } if (!(冲刺第一阶段计时器 >= 曲线总时间) && !已触发击飞 && 冲刺第一阶段计时器 >= 击飞触发时间点) { 触发击飞(); } } catch (Exception ex) { 记录异常("更新冲刺阶段异常: " + ex.Message); } } private void 触发击飞() { //IL_00c3: 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_00d7: Unknown result type (might be due to invalid IL or missing references) try { if (已触发击飞) { return; } 已触发击飞 = true; if (到达触发击飞事件 != null) { UnityEvent obj = 到达触发击飞事件; if (obj != null) { obj.Invoke(); } } if ((Object)(object)目标主刚体 == (Object)null) { 记录异常("触发击飞: 目标主刚体为空"); return; } if (击飞力度曲线 == null) { 记录异常("触发击飞: 击飞力度曲线为空"); return; } if (当前击飞协程 != null) { ((MonoBehaviour)this).StopCoroutine(当前击飞协程); } if (Object.op_Implicit((Object)(object)单位主刚体)) { 清除刚体动能(单位主刚体); } 切换到等待阶段(); 记录地面位置 = 获取地面位置(目标主刚体.position); 当前击飞协程 = ((MonoBehaviour)this).StartCoroutine(击飞协程()); } catch (Exception ex) { 记录异常("触发击飞异常: " + ex.Message); } } [IteratorStateMachine(typeof(<击飞协程>d__53))] private IEnumerator 击飞协程() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <击飞协程>d__53(0) { <>4__this = this }; } private void 切换到等待阶段() { try { 当前状态 = 投技状态.等待击飞冷却; 状态计时器 = 0f; 计算密集区域(); } catch (Exception ex) { 记录异常("切换到等待阶段异常: " + ex.Message); } } private void 计算密集区域() { //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)单位获取工具 != (Object)null) { List targets = 单位获取工具.GetTargets(80f); if (targets != null && targets.Count > 0) { if (Object.op_Implicit((Object)(object)目标数据)) { targets.RemoveAll((Unit p) => (Object)(object)p == (Object)(object)目标数据.unit); } if (targets.Count > 0) { List list = new List(); foreach (Unit item in targets) { if ((Object)(object)item != (Object)null && (Object)(object)item.data != (Object)null && (Object)(object)item.data.mainRig != (Object)null) { list.Add(item.data.mainRig.position); } } if (list.Count > 0) { 密集区域位置 = 获取地面位置(FindDensestPositionGrid(list.ToArray(), 7f)); 有密集区域 = true; return; } 有密集区域 = false; } else { 有密集区域 = false; } } } 密集区域位置 = 获取地面位置(((Component)this).transform.position); } catch (Exception ex) { 记录异常("计算密集区域异常: " + ex.Message); 密集区域位置 = 获取地面位置(((Component)this).transform.position); } } private void 更新等待阶段() { try { 状态计时器 += Time.deltaTime; float num = 获取等待时间(); if (状态计时器 >= num) { 当前状态 = 投技状态.第二阶段_手部抓取; 状态计时器 = 0f; 已抓取成功 = false; } } catch (Exception ex) { 记录异常("更新等待阶段异常: " + ex.Message); } } private float 获取等待时间() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0056: Unknown result type (might be due to invalid IL or missing references) try { if (冲刺力度曲线 == null || 冲刺力度曲线.length < 2) { return 0.5f; } Keyframe val = 冲刺力度曲线.keys[击飞触发关键帧索引 + 1]; Keyframe val2 = 冲刺力度曲线.keys[击飞触发关键帧索引]; return ((Keyframe)(ref val)).time - ((Keyframe)(ref val2)).time; } catch (Exception ex) { 记录异常("获取等待时间异常: " + ex.Message); } return 0.3f; } private void 更新手部抓取阶段() { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0155: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: 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_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) try { if (手部抓取力度曲线 == null) { 记录异常("更新手部抓取阶段: 手部抓取力度曲线为空"); return; } 状态计时器 += Time.deltaTime; float num = 手部抓取力度曲线.Evaluate(状态计时器); float num2 = 0f; try { num2 = ((冲刺力度曲线 == null || 击飞触发关键帧索引 + 1 >= 冲刺力度曲线.length) ? 1f : 冲刺力度曲线.Evaluate(状态计时器 + ((Keyframe)(ref 冲刺力度曲线.keys[击飞触发关键帧索引 + 1])).time)); } catch (Exception ex) { 记录异常("更新手部抓取阶段计算曲线值异常: " + ex.Message); num2 = 1f; } if ((Object)(object)目标主刚体 != (Object)null && (Object)(object)单位主刚体 != (Object)null && (Object)(object)单位左手 != (Object)null && (Object)(object)单位右手 != (Object)null) { Vector3 val = 目标主刚体.position - 单位主刚体.position; Vector3 normalized = ((Vector3)(ref val)).normalized; val = 目标主刚体.position + 目标主刚体.velocity * 0.3f - 单位主刚体.position; Vector3 normalized2 = ((Vector3)(ref val)).normalized; if (!float.IsNaN(normalized.x) && !float.IsNaN(normalized.y) && !float.IsNaN(normalized.z)) { if ((double)状态计时器 <= 1.5) { 单位主刚体.AddForce(normalized2 * 冲刺力度 * num2 * 时间倍率, (ForceMode)5); } else { 单位主刚体.AddForce(normalized * 冲刺力度 * num2 * 时间倍率, (ForceMode)5); } } val = 单位左手.position - 单位主刚体.position; Vector3 normalized3 = ((Vector3)(ref val)).normalized; val = 单位右手.position - 单位主刚体.position; Vector3 normalized4 = ((Vector3)(ref val)).normalized; if (!float.IsNaN(normalized3.x)) { 单位左手.AddForce(normalized3 * 手部抓取力度 * num * 时间倍率, (ForceMode)5); } if (!float.IsNaN(normalized4.x)) { 单位右手.AddForce(normalized4 * 手部抓取力度 * num * 时间倍率, (ForceMode)5); } if (!已抓取成功) { float num3 = Vector3.Distance(单位主刚体.position, 目标主刚体.position); if (强制抓取) { if (num3 < 4f) { 抓取成功(); } } else if (num3 < 1f) { 抓取成功(); } } } else { if ((Object)(object)目标主刚体 == (Object)null) { 记录异常("更新手部抓取阶段: 目标主刚体为空"); } if ((Object)(object)单位主刚体 == (Object)null) { 记录异常("更新手部抓取阶段: 单位主刚体为空"); } if ((Object)(object)单位左手 == (Object)null) { 记录异常("更新手部抓取阶段: 单位左手为空"); } if ((Object)(object)单位右手 == (Object)null) { 记录异常("更新手部抓取阶段: 单位右手为空"); } } if (强制抓取 && 状态计时器 >= 强制抓取时间参数) { 强制抓取成功(); } float num4 = Get曲线总时间(手部抓取力度曲线); if (状态计时器 >= num4 && !已抓取成功) { 记录异常("更新手部抓取阶段: 抓取超时,重置投技"); 重置投技(); } } catch (Exception ex2) { 记录异常("更新手部抓取阶段异常: " + ex2.Message); } } private void 清除刚体动能(Rigidbody rigidbody) { //IL_0011: 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) if ((Object)(object)rigidbody == (Object)null) { return; } try { rigidbody.velocity = Vector3.zero; rigidbody.angularVelocity = Vector3.zero; } catch (Exception ex) { 记录异常("清除刚体动能异常: " + ex.Message); } } private void 抓取成功() { //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_00f1: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)单位右手 != (Object)null) { 清除刚体动能(单位右手); } if ((Object)(object)单位左手 != (Object)null) { 清除刚体动能(单位左手); } if ((Object)(object)单位主刚体 != (Object)null) { 清除刚体动能(单位主刚体); } if ((Object)(object)目标主刚体 != (Object)null) { 清除刚体动能(目标主刚体); } if ((Object)(object)目标主刚体 != (Object)null) { 目标主刚体.useGravity = false; 目标主刚体.drag = 5f; 目标主刚体.angularDrag = 5f; } if ((Object)(object)单位主刚体 != (Object)null && (Object)(object)目标主刚体 != (Object)null) { if (强制抓取) { 抓取偏移位置 = 固定抓取位置; } else { 抓取偏移位置 = ((Component)单位主刚体).transform.InverseTransformPoint(目标主刚体.position); } } 目标主刚体.isKinematic = false; 当前状态 = 投技状态.第三阶段_砸地向密集区; 状态计时器 = 0f; 已抓取成功 = true; } catch (Exception ex) { 记录异常("抓取成功异常: " + ex.Message); } } private void 强制抓取成功() { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)单位右手 != (Object)null) { 清除刚体动能(单位右手); } if ((Object)(object)单位左手 != (Object)null) { 清除刚体动能(单位左手); } if ((Object)(object)单位主刚体 != (Object)null) { 清除刚体动能(单位主刚体); } if ((Object)(object)目标主刚体 != (Object)null) { 清除刚体动能(目标主刚体); } if ((Object)(object)目标主刚体 != (Object)null) { 目标主刚体.useGravity = false; 目标主刚体.drag = 5f; 目标主刚体.angularDrag = 5f; } if ((Object)(object)单位主刚体 != (Object)null && (Object)(object)目标主刚体 != (Object)null) { 抓取偏移位置 = 固定抓取位置; } Debug.Log((object)"强制抓取成功!!!"); 目标主刚体.isKinematic = false; 当前状态 = 投技状态.第三阶段_砸地向密集区; 状态计时器 = 0f; 已抓取成功 = true; } catch (Exception ex) { 记录异常("抓取成功异常: " + ex.Message); } } private void 更新砸地阶段() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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) try { if (下落力度曲线 == null) { 记录异常("更新砸地阶段: 下落力度曲线为空"); return; } 状态计时器 += Time.deltaTime; float num = 下落力度曲线.Evaluate(状态计时器); if ((Object)(object)目标主刚体 != (Object)null && (Object)(object)单位主刚体 != (Object)null) { Vector3 val = ((Component)单位主刚体).transform.TransformPoint(抓取偏移位置); if (状态计时器 < 1f && (Object)(object)目标主刚体 != (Object)null) { Vector3 val2 = val; Vector3 val3 = val - 目标主刚体.position; if (!float.IsNaN(val2.x) && 记录目标全部刚体数组 != null && 记录目标全部刚体数组.Length != 0) { for (int i = 0; i < 记录目标全部刚体数组.Length; i++) { 记录目标全部刚体数组[i].MovePosition(记录目标全部刚体数组[i].position + val3); } } } Vector3 val4; Vector3 normalized; if (有密集区域) { if (记录密集) { val4 = 密集区域位置 - 单位主刚体.position; normalized = ((Vector3)(ref val4)).normalized; } else { val4 = -Vector3.up * 1.8f + 记录朝向目标方向; normalized = ((Vector3)(ref val4)).normalized; } } else { val4 = -Vector3.up * 1.8f + 记录朝向目标方向; normalized = ((Vector3)(ref val4)).normalized; } float num2 = 下落力度 * num; if (!float.IsNaN(normalized.x)) { 单位主刚体.AddForce(normalized * num2 * 时间倍率, (ForceMode)5); } Vector3 val5 = val - 目标主刚体.position; if (!float.IsNaN(val5.x)) { 目标主刚体.velocity = (单位主刚体.velocity * 0.9f + val5 * 5f) * 时间倍率; } } RaycastHit val6 = default(RaycastHit); if ((Object)(object)单位主刚体 != (Object)null && Physics.Raycast(单位主刚体.position, Vector3.down, ref val6, 3f, 512)) { 生成砸地特效(((RaycastHit)(ref val6)).point); 重置投技(); } float num3 = Get曲线总时间(下落力度曲线); if (状态计时器 >= num3) { 记录异常("更新砸地阶段: 砸地超时,重置投技"); 重置投技(); } } catch (Exception ex) { 记录异常("更新砸地阶段异常: " + ex.Message); } } private void 生成砸地特效(Vector3 位置) { //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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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) try { if ((Object)(object)下落冲击波预制体 != (Object)null) { GameObject val = Object.Instantiate(下落冲击波预制体, 位置, Quaternion.identity); if ((Object)(object)val != (Object)null) { TeamHolder.AddTeamHolder(val, ((Component)this).gameObject); } Explosion component = val.GetComponent(); if ((Object)(object)component != (Object)null && Object.op_Implicit((Object)(object)目标数据)) { component.damage = 目标数据.maxHealth; ((Damagable)目标数据.healthHandler).TakeDamage(目标数据.maxHealth * 0.7f, ((Component)this).transform.position, (Unit)null, (DamageType)0); } if (释放额外实例化预制体) { GameObject val2 = Object.Instantiate(半血生成额外预制体, 位置, Quaternion.identity); TeamHolder.AddTeamHolder(val2, ((Component)this).gameObject); } } } catch (Exception ex) { 记录异常("生成砸地特效异常: " + ex.Message); } } public void 启动投技() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) try { if (!启用) { 记录异常("启动投技: 技能未启用"); return; } if ((Object)(object)单位数据 == (Object)null) { 记录异常("启动投技: 单位数据为空"); return; } 目标数据 = 单位数据.targetData; if ((Object)(object)目标数据 == (Object)null) { 记录异常("启动投技: 目标数据为空"); return; } 目标主刚体 = 目标数据.mainRig; if ((Object)(object)目标主刚体 == (Object)null) { 记录异常("启动投技: 目标主刚体为空"); return; } if ((Object)(object)目标主刚体 != (Object)null && (Object)(object)单位主刚体 != (Object)null) { Vector3 val = 目标主刚体.position - 单位主刚体.position; Vector3 normalized = ((Vector3)(ref val)).normalized; 记录朝向目标方向 = new Vector3(normalized.x, 0f, normalized.z); if (Object.op_Implicit((Object)(object)冲刺时生成预制体)) { GameObject val2 = Object.Instantiate(冲刺时生成预制体, ((Component)this).transform.position, Quaternion.LookRotation(normalized)); TeamHolder.AddTeamHolder(val2, ((Component)this).gameObject); } } 记录目标全部刚体数组 = 目标数据.allRigs.AllRigs; if (冲刺力度曲线 == null) { 记录异常("启动投技: 冲刺力度曲线为空"); return; } 重置投技(); 当前状态 = 投技状态.第一阶段_冲刺; 冲刺第一阶段计时器 = 0f; 已触发击飞 = false; 已抓取成功 = false; } catch (Exception ex) { 记录异常("启动投技异常: " + ex.Message); } } public void 设置升级技能(bool d = true) { 释放额外实例化预制体 = d; } public void 重置投技() { try { 当前状态 = 投技状态.空闲; 状态计时器 = 0f; 冲刺第一阶段计时器 = 0f; 已触发击飞 = false; 已抓取成功 = false; if (当前击飞协程 != null) { ((MonoBehaviour)this).StopCoroutine(当前击飞协程); 当前击飞协程 = null; } if ((Object)(object)目标主刚体 != (Object)null) { 目标主刚体.useGravity = true; 目标主刚体.drag = 0f; 目标主刚体.angularDrag = 0f; } } catch (Exception ex) { 记录异常("重置投技异常: " + ex.Message); } } private float Get曲线总时间(AnimationCurve 曲线) { if (曲线 == null || 曲线.length == 0) { return 1f; } try { return ((Keyframe)(ref 曲线.keys[曲线.length - 1])).time; } catch (Exception ex) { 记录异常("Get曲线总时间异常: " + ex.Message); return 1f; } } public void 设置击飞触发关键帧(int 索引) { 击飞触发关键帧索引 = 索引; 缓存击飞触发时间(); } public Vector3 FindDensestPositionGrid(Vector3[] positions, float cellSize) { //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_0010: 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_0030: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_006a: 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) //IL_00ac: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) if (positions == null || positions.Length == 0) { return Vector3.zero; } try { Dictionary> dictionary = new Dictionary>(); Vector3Int key = default(Vector3Int); foreach (Vector3 val in positions) { ((Vector3Int)(ref key))..ctor(Mathf.FloorToInt(val.x / cellSize), Mathf.FloorToInt(val.y / cellSize), Mathf.FloorToInt(val.z / cellSize)); if (!dictionary.ContainsKey(key)) { dictionary[key] = new List(); } dictionary[key].Add(val); } Vector3Int val2 = Vector3Int.zero; int num = 0; foreach (KeyValuePair> item in dictionary) { if (item.Value.Count > num) { num = item.Value.Count; val2 = item.Key; } } return new Vector3((float)((Vector3Int)(ref val2)).x * cellSize + cellSize / 2f, (float)((Vector3Int)(ref val2)).y * cellSize + cellSize / 2f, (float)((Vector3Int)(ref val2)).z * cellSize + cellSize / 2f); } catch (Exception ex) { 记录异常("FindDensestPositionGrid异常: " + ex.Message); return Vector3.zero; } } public Vector3 获取地面位置(Vector3 测试位置, float 检测高度 = 10f, int 地面层级 = 512) { //IL_0004: 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_0012: 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_0026: 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_006b: 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_0084: 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_0088: Unknown result type (might be due to invalid IL or missing references) try { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(测试位置.x, 测试位置.y + 检测高度, 测试位置.z); float num = 检测高度 * 10f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, 地面层级)) { return ((RaycastHit)(ref val2)).point; } } catch (Exception ex) { 记录异常("获取地面位置异常: " + ex.Message); } return new Vector3(测试位置.x, 测试位置.y - 检测高度 * 0.5f, 测试位置.z); } private void OnDestroy() { 重置投技(); } } public class 死亡后进入2阶段 : MonoBehaviour { [CompilerGenerated] private sealed class <生成二阶段>d__8 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 死亡后进入2阶段 <>4__this; private GameObject[] <生成单位列表>5__1; private Unit <新单位>5__2; private Vector3 <偏移量>5__3; private Rigidbody[] <刚体数组>5__4; private int 5__5; private GameObject <特效实例>5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <生成二阶段>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <生成单位列表>5__1 = null; <新单位>5__2 = null; <刚体数组>5__4 = null; <特效实例>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0064: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.阶段转换时间); <>1__state = 1; return true; case 1: { <>1__state = -1; UnitBlueprint 二阶段单位蓝图 = <>4__this.二阶段单位蓝图; <生成单位列表>5__1 = ((二阶段单位蓝图 != null) ? 二阶段单位蓝图.Spawn(((Component)<>4__this).transform.position, ((Component)<>4__this).transform.rotation, <>4__this.当前单位.data.team, 1f, (UnitPoolInfo?)null) : null); if (<生成单位列表>5__1 != null && <生成单位列表>5__1.Length != 0) { GameObject obj = <生成单位列表>5__1[0]; <新单位>5__2 = ((obj != null) ? obj.GetComponent() : null); if ((Object)(object)<新单位>5__2 != (Object)null) { <偏移量>5__3 = <>4__this.当前单位.data.mainRig.position - <新单位>5__2.data.mainRig.position; <刚体数组>5__4 = <新单位>5__2.data.allRigs.AllRigs; 5__5 = 0; while (5__5 < <刚体数组>5__4.Length) { <刚体数组>5__4[5__5].MovePosition(<刚体数组>5__4[5__5].position + <偏移量>5__3); 5__5++; } if ((Object)(object)<>4__this.转阶段特效 != (Object)null) { <特效实例>5__6 = Object.Instantiate(<>4__this.转阶段特效, <>4__this.当前单位.data.mainRig.position, Quaternion.identity); TeamHolder.AddTeamHolder(<特效实例>5__6, ((Component)<>4__this).gameObject); <特效实例>5__6 = null; } <刚体数组>5__4 = null; } <新单位>5__2 = null; } Object.Destroy((Object)(object)((Component)<>4__this.当前单位).gameObject); 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(); } } public UnitBlueprint 二阶段单位蓝图; public float 阶段转换时间 = 2f; public GameObject 转阶段特效; private Unit 当前单位; private HealthHandler 健康管理器; private bool 已处理死亡 = false; private void Start() { 当前单位 = ((Component)((Component)this).transform.root).GetComponent(); 健康管理器 = 当前单位.data.healthHandler; 健康管理器.AddDieAction((Action)拦截死亡); } private void 拦截死亡() { if (!已处理死亡) { 已处理死亡 = true; 健康管理器.willBeRewived = true; ((MonoBehaviour)this).StartCoroutine(生成二阶段()); } } [IteratorStateMachine(typeof(<生成二阶段>d__8))] private IEnumerator 生成二阶段() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <生成二阶段>d__8(0) { <>4__this = this }; } private void OnDestroy() { if ((Object)(object)健康管理器 != (Object)null) { 健康管理器.RemoveDieAction((Action)拦截死亡); } } } public class 距离目标事件 : MonoBehaviour { public UnityEvent 距离事件; public UnityEvent 反向事件; public float 触发距离 = 20f; private Unit 此单位; private DataHandler 单位数据; private void Start() { 此单位 = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)此单位 != (Object)null) { 单位数据 = 此单位.data; } } public void 触发事件() { if ((Object)(object)此单位 == (Object)null || (Object)(object)单位数据 == (Object)null) { Debug.LogError((object)"单位数据为null"); } else if (单位数据.distanceToTarget <= 触发距离) { UnityEvent obj = 距离事件; if (obj != null) { obj.Invoke(); } } else { UnityEvent obj2 = 反向事件; if (obj2 != null) { obj2.Invoke(); } } } } public class 辅助事件触发类 : MonoBehaviour { public UnityEvent[] 事件组; public int 默认事件索引 = 0; private void Start() { if (事件组 != null && 事件组.Length != 0) { 默认事件索引 = Mathf.Clamp(默认事件索引, 0, 事件组.Length - 1); } } public void 触发默认事件() { if (((Behaviour)this).enabled && 事件组 != null && 事件组.Length != 0 && 事件组[默认事件索引] != null) { UnityEvent obj = 事件组[默认事件索引]; if (obj != null) { obj.Invoke(); } } } public void 触发指定索引事件(int 索引 = 0) { if (!((Behaviour)this).enabled) { return; } if (事件组 != null && 事件组.Length != 0) { if (索引 >= 0 && 索引 < 事件组.Length) { if (事件组[索引] != null) { UnityEvent obj = 事件组[索引]; if (obj != null) { obj.Invoke(); } } } else { Debug.LogWarning((object)$"索引 {索引} 超出范围!事件组大小为 {事件组.Length}"); } } else { Debug.LogWarning((object)"事件组为空或未初始化!"); } } public void 修改默认索引(int 索引 = 0) { if (事件组 != null && 事件组.Length != 0) { int num = Mathf.Clamp(索引, 0, 事件组.Length - 1); if (num != 默认事件索引) { 默认事件索引 = num; Debug.Log((object)$"默认事件索引已修改为: {默认事件索引}"); } } else { Debug.LogWarning((object)"无法修改默认索引:事件组为空!"); } } public void 添加事件(UnityEvent 新事件) { if (事件组 == null) { 事件组 = (UnityEvent[])(object)new UnityEvent[0]; } List list = new List(事件组); list.Add(新事件); 事件组 = list.ToArray(); } public void 移除事件(int 索引) { if (事件组 != null && 索引 >= 0 && 索引 < 事件组.Length) { List list = new List(事件组); list.RemoveAt(索引); 事件组 = list.ToArray(); if (默认事件索引 >= 事件组.Length) { 默认事件索引 = Mathf.Max(0, 事件组.Length - 1); } } } public int 获取事件组大小() { UnityEvent[] array = 事件组; return (array != null) ? array.Length : 0; } public bool 事件是否有效(int 索引) { return 事件组 != null && 索引 >= 0 && 索引 < 事件组.Length && 事件组[索引] != null; } } public class 长条形状碰撞检测 : MonoBehaviour { public enum 施加方式 { 对敌方, 全部, 对自己和对于, 仅自己 } public enum 检测方式 { 物体, 单位 } public interface IDamageable { void TakeDamage(int damage); void Heal(int amount); } public UnitEffectBase 效果设置; [Header("盒状检测参数")] public Vector3 检测范围 = new Vector3(3f, 2f, 3f); public bool 跟随物体旋转 = false; public LayerMask 检测层; private Unit 存储单位; public 施加方式 效果施加对应 = 施加方式.对敌方; private Team 队伍信息; public 检测方式 sss = 检测方式.单位; private void Start() { //IL_0027: 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) //IL_0047: 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) if (sss == 检测方式.单位) { 存储单位 = ((Component)this).GetComponentInParent(); 队伍信息 = 存储单位.data.team; } if (sss == 检测方式.物体) { 队伍信息 = ((Component)this).GetComponentInParent().team; } } public void 开始检测() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_004d: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; Quaternion val = Quaternion.identity; if (跟随物体旋转) { val = Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f); } Collider[] array = Physics.OverlapBox(position, 检测范围 * 0.5f, val, LayerMask.op_Implicit(检测层)); if (array.Length == 0) { 完成所有检测(存储单位, null); return; } List list = new List(); for (int i = 0; i < array.Length; i++) { Unit componentInParent = ((Component)array[i]).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || componentInParent.data.Dead) { continue; } bool flag = false; switch (效果施加对应) { case 施加方式.对敌方: flag = componentInParent.data.team != 队伍信息; break; case 施加方式.全部: flag = true; break; case 施加方式.对自己和对于: flag = componentInParent.data.team == 队伍信息; break; case 施加方式.仅自己: { Unit componentInParent2 = ((Component)this).GetComponentInParent(); flag = (Object)(object)componentInParent == (Object)(object)componentInParent2; break; } } if (!flag) { continue; } list.Add(componentInParent); if (Object.op_Implicit((Object)(object)效果设置)) { UnitEffectBase val2 = UnitEffectBase.AddEffectToTarget(((Component)((Component)array[i]).transform).gameObject, 效果设置); if ((Object)(object)val2 == (Object)null) { val2 = Object.Instantiate(效果设置, ((Component)array[i]).transform); ((Component)val2).transform.SetPositionAndRotation(((Component)array[i]).transform.position, Quaternion.identity); TeamHolder.AddTeamHolder(((Component)val2).gameObject, ((Component)this).gameObject); val2.DoEffect(); } else { val2.Ping(); } 完成单次检测(val2, 存储单位, componentInParent, ((Component)((Component)this).transform).gameObject); } else { 完成单次检测(null, 存储单位, componentInParent, ((Component)((Component)this).transform).gameObject); } } 完成所有检测(存储单位, list.ToArray()); } public virtual void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { } public virtual void 完成所有检测(Unit 召唤者, Unit[] 受影响者) { } private void OnDrawGizmos() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_00c4: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_007c: 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_008d: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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) if (((Behaviour)this).enabled) { Gizmos.color = new Color(0f, 1f, 0f, 0.2f); Matrix4x4 matrix = Gizmos.matrix; if (跟随物体旋转 && Application.isPlaying) { Gizmos.matrix = Matrix4x4.TRS(((Component)this).transform.position, Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f), Vector3.one); Gizmos.DrawCube(Vector3.zero, 检测范围); Gizmos.color = Color.green; Gizmos.DrawWireCube(Vector3.zero, 检测范围); } else { Gizmos.DrawCube(((Component)this).transform.position, 检测范围); Gizmos.color = Color.green; Gizmos.DrawWireCube(((Component)this).transform.position, 检测范围); } Gizmos.matrix = matrix; } } } } namespace HeMoDingDingMod.我的反射 { public static class UnitBlueprintExtensions { public static bool SetField(this UnitBlueprint blueprint, string fieldName, object value) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[SetField] 兵种蓝图为空"); return false; } FieldInfo field = typeof(UnitBlueprint).GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { PropertyInfo property = typeof(UnitBlueprint).GetProperty(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { try { if (value != null && !property.PropertyType.IsAssignableFrom(value.GetType())) { value = Convert.ChangeType(value, property.PropertyType); } property.SetValue(blueprint, value); return true; } catch (Exception ex) { Debug.LogError((object)("[SetField] 设置属性 '" + fieldName + "' 失败: " + ex.Message)); return false; } } Debug.LogError((object)("[SetField] 字段/属性 '" + fieldName + "' 不存在")); return false; } try { if (value != null && !field.FieldType.IsAssignableFrom(value.GetType())) { value = Convert.ChangeType(value, field.FieldType); } field.SetValue(blueprint, value); return true; } catch (Exception ex2) { Debug.LogError((object)("[SetField] 设置字段 '" + fieldName + "' 失败: " + ex2.Message)); return false; } } public static T GetField(this UnitBlueprint blueprint, string fieldName) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[GetField] 兵种蓝图为空"); return default(T); } FieldInfo field = typeof(UnitBlueprint).GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { PropertyInfo property = typeof(UnitBlueprint).GetProperty(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { try { object value = property.GetValue(blueprint); return (value != null) ? ((T)value) : default(T); } catch (Exception ex) { Debug.LogError((object)("[GetField] 获取属性 '" + fieldName + "' 失败: " + ex.Message)); return default(T); } } return default(T); } try { object value2 = field.GetValue(blueprint); return (value2 != null) ? ((T)value2) : default(T); } catch (Exception ex2) { Debug.LogError((object)("[GetField] 获取字段 '" + fieldName + "' 失败: " + ex2.Message)); return default(T); } } public static bool SetUnitSounds(this UnitBlueprint blueprint, string vocalSound, string deathSound, float pitch = 1f, string footstepSound = "Footsteps/Minotaur") { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[SetUnitSounds] 兵种蓝图为空"); return false; } bool result = true; if (!blueprint.SetField("vocalRef", vocalSound)) { result = false; } if (!blueprint.SetField("deathRef", deathSound)) { result = false; } if (!blueprint.SetField("footRef", footstepSound)) { result = false; } if (!blueprint.SetField("voicePitch", pitch)) { result = false; } VoiceBundle field = blueprint.GetField("voiceBundle"); if ((Object)(object)field != (Object)null) { blueprint.SetField("voiceBundle", null); } typeof(UnitBlueprint).GetMethod("Validate", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(blueprint, null); return result; } public static bool SetRider(this UnitBlueprint blueprint, UnitBlueprint riderBlueprint) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[SetRider] 兵种蓝图为空"); return false; } if ((Object)(object)riderBlueprint == (Object)null) { Debug.LogError((object)"[SetRider] 骑手蓝图为空"); return false; } blueprint.SetCustomRider(riderBlueprint.Entity.GUID); return true; } public static bool SetRiders(this UnitBlueprint blueprint, UnitBlueprint[] riderBlueprints) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[SetRiders] 兵种蓝图为空"); return false; } if (riderBlueprints == null || riderBlueprints.Length == 0) { blueprint.SetNoCustomRider(); return blueprint.SetField("Riders", null); } return blueprint.SetField("Riders", riderBlueprints); } public static bool AddRider(this UnitBlueprint blueprint, UnitBlueprint riderBlueprint) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[AddRider] 兵种蓝图为空"); return false; } if ((Object)(object)riderBlueprint == (Object)null) { Debug.LogError((object)"[AddRider] 骑手蓝图为空"); return false; } UnitBlueprint[] field = blueprint.GetField("Riders"); UnitBlueprint[] value; if (field == null || field.Length == 0) { value = (UnitBlueprint[])(object)new UnitBlueprint[1] { riderBlueprint }; } else { if (field.Any((UnitBlueprint r) => r.Entity.GUID == riderBlueprint.Entity.GUID)) { Debug.LogWarning((object)("[AddRider] 骑手 '" + riderBlueprint.Name + "' 已存在")); return false; } value = field.Concat((IEnumerable)(object)new UnitBlueprint[1] { riderBlueprint }).ToArray(); } return blueprint.SetField("Riders", value); } public static bool RemoveRider(this UnitBlueprint blueprint, UnitBlueprint riderBlueprint) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[RemoveRider] 兵种蓝图为空"); return false; } if ((Object)(object)riderBlueprint == (Object)null) { Debug.LogError((object)"[RemoveRider] 骑手蓝图为空"); return false; } UnitBlueprint[] field = blueprint.GetField("Riders"); if (field == null || field.Length == 0) { return true; } UnitBlueprint[] array = field.Where((UnitBlueprint r) => r.Entity.GUID != riderBlueprint.Entity.GUID).ToArray(); if (array.Length == field.Length) { Debug.LogWarning((object)("[RemoveRider] 未找到骑手 '" + riderBlueprint.Name + "'")); return false; } if (array.Length == 0) { blueprint.SetNoCustomRider(); return blueprint.SetField("Riders", null); } return blueprint.SetField("Riders", array); } public static bool ClearRiders(this UnitBlueprint blueprint) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[ClearRiders] 兵种蓝图为空"); return false; } blueprint.SetNoCustomRider(); return blueprint.SetField("Riders", null); } public static UnitBlueprint[] GetRiders(this UnitBlueprint blueprint) { if ((Object)(object)blueprint == (Object)null) { Debug.LogError((object)"[GetRiders] 兵种蓝图为空"); return Array.Empty(); } return blueprint.UnitRiders ?? Array.Empty(); } } internal static class 多国语言部分333 { public static void 添加语言() { 语言添加("UNIT_KONGBUSHENGWU", "恐怖生物#Horror Beast#恐怖生物#Schreckenskreatur#Créature d'horreur#Ужасающий зверь#Bestia Horrorífica#Bestia Orripilante"); 语言添加("UNIT_SHIJIETUNSHIZHE", "世界吞噬者#World Devourer#世界吞噬者#Weltenverschlinger#Dévoreur du Monde#Пожиратель миров#Devoramundos#Divoramondi"); 语言添加("UNIT_YILIUTI", "遗留体#Remnant#遺留體#Überbleibsel#Relicat#Реликт#Reliquia#Relitto"); 语言添加("UNIT_JUEXINGSHUBING", "觉醒骷髅兵#Awakened Skeleton#覚醒したスケルトン兵#Erwachter Skelettkrieger#Squelette éveillé#Пробужденный скелет#Esqueleto Despertado#Scheletro Risvegliato"); 语言添加("UNIT_HEIJIABUBUSIZHAN", "黑剑加不死斩#Black Sword & Immortal Slash#黒剣・不死斬り#Schwarzes Schwert & Unsterblichkeitsschnitt#Épée Noire & Tranchant Immortel#Черный меч и Бессмертный удар#Espada Negra y Corte Inmortal#Spada Nera e Taglio Immortale"); 语言添加("UNIT_KUANGBAOZHADANREN", "狂暴炸弹人#Raging Bomber#狂暴爆弾兵#Tobsüchtiger Bomber#Bombardier Enragé#Неистовый подрывник#Bombardero Furioso#Bombardiere Furioso"); 语言添加("UNIT_YONGYEQIANXINGZHE", "永夜潜行者#Evernight Stalker#永夜の潜行者#Nachtwanderer#Rôdeur de la Nuit éternelle#Ночной сталкер#Acechador de la Noche Eterna#Inseguitore dell'Eterna Notte"); 语言添加("UNIT_SHIluoTANXIANJIA", "失落探险家#Lost Explorer#失われた探検家#Verlorener Entdecker#Explorateur Perdu#Потерянный исследователь#Explorador Perdido#Esploratore Perduto"); 语言添加("UNIT_ZHONGXINGJUNCHUANQIANGQBING", "重型军团长枪兵#Heavy Legionary Lancer#重装軍団長槍兵#Schwerer Legionärslanzenträger#Lancier Lourd de Légion#Тяжелый копейщик легиона#Lancero Pesado de Legión#Lanciere Pesante della Legione"); 语言添加("UNIT_XINGUIREN", "猩红之月_基兰#Blood Moon Zilean#紅の月_ジリアン#Blutmond Zilean#Lune de Sang Zilean#Кровавая Луна Зилеан#Luna de Sangre Zilean#Luna di Sangue Zilean"); 语言添加("UNIT_SHETI", "瑟提#Sett#セット#Sett#Sett#Сетт#Sett#Sett"); 语言添加("UNIT_AERDENGZHINAGEFULEI", "艾尔登之王_葛孚雷#Elden Lord Godfrey#エルデの王_ゴッドフレイ#Gottfrey, der Elden-Lord#Seigneur Élden Godfrey#Повелитель Элдена Годфри#Señor del Anillo Godfrey#Signore dell'Anello Godfrey"); 语言添加("UNIT_SHUXUELAOSHI", "数学老师#Math Teacher#数学の先生#Mathematiklehrer#Professeur de mathématiques#Учитель математики#Profesor de matemáticas#Insegnante di matematica"); 语言添加("UNIT_XINGYUNFANGKUAI", "幸运方块#Lucky Block#ラッキーブロック#Glücksblock#Lucky Block#Удачный блок#Bloque de la Suerte#Blocco Fortunato"); 语言添加("UNIT_WUZHUANGZHISHENGJI", "武装直升机#Attack Helicopter#武装ヘリコプター#Kampfhubschrauber#Hélicoptère d'attaque#Боевой вертолёт#Helicóptero de Ataque#Elicottero d'Attacco"); } public static void 语言添加(string key, string trans) { //IL_01df: 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) //IL_01ff: 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_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(key)) { Debug.LogError((object)"翻译键不能为空!"); return; } if (string.IsNullOrEmpty(trans)) { Debug.LogError((object)"翻译内容不能为空!"); return; } string[] array = trans.Split(new string[1] { "#" }, StringSplitOptions.RemoveEmptyEntries); if (array.Length != 8) { Debug.LogError((object)$"翻译格式错误:需要8种语言,但只提供了{array.Length}种。格式应为:中文#英文#日文#德文#法文#俄文#西班牙文#意大利文"); return; } for (int i = 0; i < array.Length; i++) { if (string.IsNullOrWhiteSpace(array[i])) { string[] array2 = new string[8] { "中文", "英文", "日文", "德文", "法文", "俄文", "西班牙文", "意大利文" }; Debug.LogError((object)$"第{i}个位置({array2[i]})的翻译内容为空!"); return; } } try { Dictionary dictionary = new Dictionary(); dictionary.Add(0, (Language)7); dictionary.Add(1, (Language)0); dictionary.Add(2, (Language)8); dictionary.Add(3, (Language)3); dictionary.Add(4, (Language)1); dictionary.Add(5, (Language)6); dictionary.Add(6, (Language)4); dictionary.Add(7, (Language)2); FieldInfo field = typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic); if (field == null) { Debug.LogError((object)"无法访问Localizer的m_localization字段!"); return; } if (!(field.GetValue(null) is Dictionary> dictionary2)) { Debug.LogError((object)"本地化字典为空或类型不匹配!"); return; } foreach (Language value in dictionary.Values) { if (!dictionary2.ContainsKey(value)) { Debug.LogError((object)$"本地化字典中缺少语言:{value}"); return; } } int num = 0; for (int j = 0; j < dictionary.Count; j++) { Language val = dictionary[j]; if (!dictionary2[val].ContainsKey(key)) { dictionary2[val].Add(key, array[j]); num++; } else { Debug.LogWarning((object)$"语言{val}中已存在键'{key}',跳过添加"); } } field.SetValue(null, dictionary2); if (num > 0) { Debug.Log((object)$"成功为{num}种语言添加了翻译键:{key}"); } else { Debug.Log((object)("所有语言中都已存在键'" + key + "',未添加任何新翻译")); } } catch (Exception ex) { Debug.LogError((object)("添加翻译时发生错误:" + ex.Message + "\n" + ex.StackTrace)); } } } } namespace HeMoDingDingMod.unity脚本 { public class 添加自定义内容 : MonoBehaviour { public 添加自定义内容() { SceneManager.sceneLoaded += SceneLoaded; } public void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { //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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00ab: Expected O, but got Unknown if (!(((Scene)(ref scene)).name == "UnitCreator_GamepadUI")) { return; } UnitEditorManager component = ((Scene)(ref scene)).GetRootGameObjects().ToList().Find((GameObject x) => Object.op_Implicit((Object)(object)x.GetComponent())) .GetComponent(); List list = new List(component.UnitBases); UnitBlueprint[] array = UManager.编辑器单位基础.ToArray(); foreach (UnitBlueprint val in array) { UnitBaseWrapper wrapper = new UnitBaseWrapper { BaseDisplayName = val.Entity.Name, UnitBaseBlueprint = val, UnitBaseRestriction = (UnitBaseRestrictions)0 }; val.Entity.GetSpriteIconAsync((Action)delegate(Sprite sprite) { wrapper.BaseIcon = sprite; }); list.Add(wrapper); } component.UnitBases = list.ToArray(); } } } namespace HeMoDingDingMod.unity脚本.补丁空间 { [HarmonyPatch(typeof(ProjectileHit))] [HarmonyPatch("DoGameplayEffects")] public class ProjectileHit_DoGameplayEffects1_HEMODINHGDING { [CompilerGenerated] private sealed class d__1 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ProjectileHit instance; public float originalDamage; public float originalForce; private Traverse 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; 5__1 = Traverse.Create((object)instance); 5__1.Field("damage").SetValue((object)originalDamage); 5__1.Field("force").SetValue((object)originalForce); 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(); } } [HarmonyPrefix] public static bool DoGameplayEffects_Prefix(ProjectileHit __instance, HitData hit, float m = 1f, Unit unit = null) { if ((Object)(object)hit.transform == (Object)null || (Object)(object)hit.rigidbody == (Object)null) { return true; } Transform root = hit.transform.root; if ((Object)(object)root == (Object)null) { return true; } 抛射物免疫组件ghao component = ((Component)root).GetComponent<抛射物免疫组件ghao>(); if ((Object)(object)component == (Object)null || !component.是否启用) { return true; } float 抛射物抗性 = component.抛射物抗性; if (抛射物抗性 > 0f) { Traverse val = Traverse.Create((object)__instance); float value = val.Field("damage").GetValue(); float num = value * (1f - 抛射物抗性); val.Field("damage").SetValue((object)num); float value2 = val.Field("force").GetValue(); float num2 = value2 * (1f - 抛射物抗性); val.Field("force").SetValue((object)num2); if (抛射物抗性 >= 1f) { val.Field("damage").SetValue((object)value); val.Field("force").SetValue((object)value2); return false; } ((MonoBehaviour)__instance).StartCoroutine(RestoreValuesAfterDelay(__instance, value, value2)); } if (component.免疫最低) { float num3 = component.计算伤害(__instance.damage); Traverse val2 = Traverse.Create((object)__instance); val2.Field("damage").SetValue((object)num3); } return true; } [IteratorStateMachine(typeof(d__1))] private static IEnumerator RestoreValuesAfterDelay(ProjectileHit instance, float originalDamage, float originalForce) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0) { instance = instance, originalDamage = originalDamage, originalForce = originalForce }; } } public class 抛射物免疫组件ghao : MonoBehaviour { [Header("基础设置")] public bool 是否启用 = true; [Header("抛射物抗性")] [Range(0f, 1f)] [Tooltip("0无抗性,1完全免疫抛射物伤害")] public float 抛射物抗性 = 0.5f; [Header("状态记录")] public int 已触发次数 = 0; public DateTime 最后触发时间; public float 免疫最低伤害 = 500f; public bool 免疫最低 = false; public void 触发免疫() { 已触发次数++; 最后触发时间 = DateTime.Now; Debug.Log((object)$"{((Object)((Component)this).gameObject).name} 触发抛射物免疫,已触发次数: {已触发次数}"); } public float 计算伤害(float 原始伤害) { if (原始伤害 <= 免疫最低伤害) { return 0f; } return 原始伤害; } } } namespace HeMoDingDingMod.unity脚本.补丁空间.锁定胜利判断单例 { [HarmonyPatch(typeof(BaseGameMode), "DecideWinner")] public class Patch_DecideWinner { [HarmonyPrefix] private static bool Prefix() { if (HeMoDingDing游戏模式单例.Instance.IsLocked) { Debug.Log((object)"[LockVictory] 已锁定,拦截 DecideWinner"); return false; } return true; } } [HarmonyPatch] public class Patch_AllGameMode_OnWinnerDecided { [CompilerGenerated] private sealed class d__0 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private MethodBase <>2__current; private int <>l__initialThreadId; private IEnumerable 5__1; private IEnumerator <>s__2; private Type 5__3; private MethodInfo 5__4; MethodBase IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; <>s__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -3; goto IL_00db; } <>1__state = -1; 5__1 = from t in typeof(BaseGameMode).Assembly.GetTypes() where t.IsSubclassOf(typeof(BaseGameMode)) && !t.IsAbstract select t; <>s__2 = 5__1.GetEnumerator(); <>1__state = -3; goto IL_00ea; IL_00ea: if (<>s__2.MoveNext()) { 5__3 = <>s__2.Current; 5__4 = 5__3.GetMethod("OnWinnerDecided", BindingFlags.Instance | BindingFlags.Public); if (5__4 != null) { <>2__current = 5__4; <>1__state = 1; return true; } goto IL_00db; } <>m__Finally1(); <>s__2 = null; return false; IL_00db: 5__4 = null; 5__3 = null; goto IL_00ea; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__2 != null) { <>s__2.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new d__0(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [IteratorStateMachine(typeof(d__0))] private static IEnumerable TargetMethods() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__0(-2); } [HarmonyPrefix] private static bool Prefix(BaseGameMode __instance, Team winningTeam, string winSubText) { if (HeMoDingDing游戏模式单例.Instance.IsLocked) { Debug.Log((object)("[LockVictory] 拦截子类 " + ((object)__instance).GetType().Name + ".OnWinnerDecided")); return false; } return true; } } public class HeMoDingDing游戏模式单例 { private static HeMoDingDing游戏模式单例 _instance; private bool _isLocked = false; public static HeMoDingDing游戏模式单例 Instance { get { if (_instance == null) { _instance = new HeMoDingDing游戏模式单例(); } return _instance; } } public bool IsLocked { get { return _isLocked; } set { if (_isLocked != value) { Debug.Log((object)$"[LockVictoryCondition] 胜利锁定状态变更: {_isLocked} -> {value}"); _isLocked = value; } } } public void Lock() { IsLocked = true; } public void Unlock() { IsLocked = false; } public void Toggle() { IsLocked = !IsLocked; } } } namespace HeMoDingDingMod.unity脚本.补丁空间.补丁添加进 { public class 重装亡灵抛射物免疫添加工具 : MonoBehaviour { private void Start() { Transform root = ((Component)this).transform.root; 抛射物免疫组件ghao 抛射物免疫组件ghao = ((Component)root).gameObject.AddComponent<抛射物免疫组件ghao>(); 抛射物免疫组件ghao.抛射物抗性 = 0.9f; } } } namespace HeMoDingDingMod.unity脚本.蠕虫类 { public class 吞噬者移动类 : MonoBehaviour { public enum 行动模式 { 空中巡游, 追击目标, 直线冲刺 } public Transform 目标; public float 巡游速度; public float 追击速度; public float 冲刺速度; public float 转向速度; public float 冲刺时间; public float 巡游时间; public float 冲刺触发距离; public float 巡游状态目标切换时间; public float 巡游半径 = 20f; public float 巡游高度范围 = 10f; public Rigidbody 物体刚体; public 行动模式 行动行为 = 行动模式.追击目标; public float 减速时间 = 1f; private float 减速计时器 = 0f; private bool 正在减速 = false; private float 目标速度; private Vector3 随机位置; private float 与目标距离; private float 冲刺计时器 = 0f; private float 巡游计时器 = 0f; private float 巡游目标切换计时器 = 0f; public bool 启用 = true; private Unit 此单位; private void Start() { if (!Object.op_Implicit((Object)(object)物体刚体)) { 物体刚体 = ((Component)this).GetComponent(); } 此单位 = ((Component)this).GetComponentInParent(); if (Object.op_Implicit((Object)(object)物体刚体)) { 物体刚体.useGravity = false; 物体刚体.drag = 5f; 物体刚体.angularDrag = 5f; 物体刚体.collisionDetectionMode = (CollisionDetectionMode)2; } 生成随机巡游位置(); } private void Update() { //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) if (!启用 || !Object.op_Implicit((Object)(object)此单位)) { return; } if (此单位.data.Dead) { 物体刚体.useGravity = true; Transform val = ((Component)this).transform.Find("碰撞伤害体"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } 启用 = false; } 目标 = ((Component)此单位.data.targetData.mainRig).transform; if (!Object.op_Implicit((Object)(object)物体刚体) || (Object)(object)目标 == (Object)null) { return; } switch (行动行为) { case 行动模式.空中巡游: 巡游计时器 += Time.deltaTime; 巡游目标切换计时器 += Time.deltaTime; break; case 行动模式.直线冲刺: 冲刺计时器 += Time.deltaTime; break; } if (正在减速) { 减速计时器 += Time.deltaTime; float num = 减速计时器 / 减速时间; num = Mathf.SmoothStep(0f, 1f, num); float num2 = Mathf.Lerp(冲刺速度, 目标速度, num); 物体刚体.velocity = ((Component)this).transform.forward * num2; if (减速计时器 >= 减速时间) { 正在减速 = false; 减速计时器 = 0f; } } } private void FixedUpdate() { //IL_003f: 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) if (!启用 || !Object.op_Implicit((Object)(object)物体刚体) || (Object)(object)目标 == (Object)null) { return; } 与目标距离 = Vector3.Distance(((Component)this).transform.position, 目标.position); if (行动行为 == 行动模式.追击目标 && 与目标距离 <= 冲刺触发距离) { 行动行为 = 行动模式.直线冲刺; 冲刺计时器 = 0f; 正在减速 = false; } else if (行动行为 == 行动模式.直线冲刺 && 冲刺计时器 >= 冲刺时间) { 开始减速过渡(行动模式.空中巡游, 巡游速度); } else if (行动行为 == 行动模式.空中巡游 && 巡游计时器 >= 巡游时间) { 行动行为 = 行动模式.追击目标; } if (!正在减速) { switch (行动行为) { case 行动模式.空中巡游: 处理巡游模式移动(); break; case 行动模式.追击目标: 处理追击模式移动(); break; case 行动模式.直线冲刺: 处理冲刺模式移动(); break; } } } public void 设置启用(bool d = true) { 启用 = d; } private void 开始减速过渡(行动模式 下一状态, float 目标速度值) { 行动行为 = 下一状态; 目标速度 = 目标速度值; 正在减速 = true; 减速计时器 = 0f; 巡游计时器 = 0f; 生成随机巡游位置(); } private void 处理巡游模式移动() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0058: 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_0065: 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_0072: Unknown result type (might be due to invalid IL or missing references) if (巡游目标切换计时器 >= 巡游状态目标切换时间) { 生成随机巡游位置(); 巡游目标切换计时器 = 0f; } 物体刚体.velocity = ((Component)this).transform.forward * 巡游速度; Vector3 val = 随机位置 - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; 平滑面向方向(转向速度, normalized); } private void 处理追击模式移动() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_001a: 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_0026: 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) Vector3 forward = ((Component)this).transform.forward; 物体刚体.velocity = forward * 追击速度; if (forward != Vector3.zero) { 平滑面向目标(转向速度, 目标.position); } } private void 处理冲刺模式移动() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_004a: 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) Vector3 forward = ((Component)this).transform.forward; 物体刚体.velocity = forward * 冲刺速度; Vector3 val = 目标.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; if (normalized != Vector3.zero) { 平滑面向目标(转向速度 * 0.3f, 目标.position); } } private void 生成随机巡游位置() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0053: 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) if (!((Object)(object)目标 == (Object)null)) { Vector2 val = Random.insideUnitCircle * 巡游半径; float num = Random.Range(0f, 巡游高度范围); 随机位置 = 目标.position + new Vector3(val.x, num, val.y); } } private void 平滑面向目标(float 速度, Vector3 目标点) { //IL_0001: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0023: 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) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0043: Unknown result type (might be due to invalid IL or missing references) Vector3 val = 目标点 - ((Component)this).transform.position; if (val != Vector3.zero) { Quaternion val2 = Quaternion.LookRotation(val); ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val2, 速度 * Time.deltaTime); } } private void 平滑面向方向(float 速度, Vector3 方向) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (方向 != Vector3.zero) { Quaternion val = Quaternion.LookRotation(方向); ((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val, 速度 * Time.deltaTime); } } private void 重置状态() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) 冲刺计时器 = 0f; 巡游计时器 = 0f; 巡游目标切换计时器 = 0f; 行动行为 = 行动模式.追击目标; if (Object.op_Implicit((Object)(object)物体刚体)) { 物体刚体.velocity = Vector3.zero; } } private void OnDisable() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)物体刚体)) { 物体刚体.velocity = Vector3.zero; } } } public class 平滑蠕虫跟随 : MonoBehaviour { [Header("引用设置")] public Transform 头部; public List 身体节列表 = new List(); [Header("跟随参数")] public float 节间距 = 1f; public float 跟随刚度 = 15f; public float 旋转刚度 = 10f; [Header("平滑设置")] [Range(0.1f, 1f)] public float 位置插值速度 = 0.5f; [Range(0.1f, 1f)] public float 旋转插值速度 = 0.3f; [Header("方向设置")] public bool 反转方向 = true; [Header("断裂防止")] public float 最大允许距离倍数 = 2f; public bool 防止断裂 = true; [Header("暂停处理")] public bool 暂停时保持位置 = true; private List 目标位置列表 = new List(); private List 目标旋转列表 = new List(); private float 路径更新间隔 = 0.002f; private float 上次路径更新时间; private Vector3 上次头部位置; private float 头部速度; private void Start() { //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) 初始化身体节(); 上次路径更新时间 = Time.time; 上次头部位置 = 头部.position; } private void LateUpdate() { //IL_005e: 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) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) if ((Mathf.Approximately(Time.timeScale, 0f) && 暂停时保持位置) || (Object)(object)头部 == (Object)null || 身体节列表.Count == 0) { return; } float deltaTime = GetDeltaTime(); 头部速度 = Vector3.Distance(头部.position, 上次头部位置) / deltaTime; 上次头部位置 = 头部.position; float num = Mathf.Clamp(路径更新间隔 / (1f + 头部速度 * 0.1f), 0.001f, 0.01f); if (GetTime() - 上次路径更新时间 > num) { 更新路径点(); 上次路径更新时间 = GetTime(); } for (int i = 0; i < 身体节列表.Count; i++) { if ((Object)(object)身体节列表[i] == (Object)null) { continue; } int num2 = Mathf.Min(i + 1, 目标位置列表.Count - 1); Vector3 val = 目标位置列表[num2]; Vector3 val2; if (防止断裂 && i == 0) { float num3 = Vector3.Distance(身体节列表[i].position, 头部.position); float num4 = 节间距 * 最大允许距离倍数; if (num3 > num4) { val2 = 身体节列表[i].position - 头部.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; val = 头部.position + normalized * 节间距; } } float num5 = Mathf.Max(跟随刚度, 头部速度 * 2f); float num6 = 位置插值速度 * num5 * deltaTime; num6 = Mathf.Clamp01(num6); if (num6 > 0f) { 身体节列表[i].position = Vector3.Lerp(身体节列表[i].position, val, num6); } if (num2 <= 0 || num2 >= 目标位置列表.Count) { continue; } Vector3 normalized2; if (i < 身体节列表.Count - 1) { val2 = 目标位置列表[num2 + 1] - 身体节列表[i].position; normalized2 = ((Vector3)(ref val2)).normalized; } else { val2 = 目标位置列表[num2] - 身体节列表[i].position; normalized2 = ((Vector3)(ref val2)).normalized; } if (normalized2 != Vector3.zero && ((Vector3)(ref normalized2)).sqrMagnitude > 0.001f) { Quaternion val3 = ((!反转方向) ? Quaternion.LookRotation(normalized2) : Quaternion.LookRotation(-normalized2)); float num7 = Mathf.Max(旋转刚度, 头部速度 * 1.5f); float num8 = 旋转插值速度 * num7 * deltaTime; num8 = Mathf.Clamp01(num8); if (num8 > 0f) { 身体节列表[i].rotation = Quaternion.Slerp(身体节列表[i].rotation, val3, num8); } } } } private void 初始化身体节() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_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_0094: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) 目标位置列表.Clear(); 目标旋转列表.Clear(); 目标位置列表.Add(头部.position); 目标旋转列表.Add(头部.rotation); for (int i = 0; i < 身体节列表.Count; i++) { if ((Object)(object)身体节列表[i] != (Object)null) { Vector3 val = 头部.position - 头部.forward * (节间距 * (float)(i + 1)); 身体节列表[i].position = val; Vector3 val2 = 头部.position - val; Vector3 normalized = ((Vector3)(ref val2)).normalized; 身体节列表[i].rotation = Quaternion.LookRotation(-normalized); 目标位置列表.Add(val); 目标旋转列表.Add(身体节列表[i].rotation); } } } private void 更新路径点() { //IL_0021: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) //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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) if (目标位置列表.Count > 0) { 目标位置列表[0] = 头部.position; 目标旋转列表[0] = 头部.rotation; } for (int i = 1; i < 目标位置列表.Count; i++) { Vector3 val = 目标位置列表[i - 1]; Vector3 val2 = val - 目标位置列表[i]; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > 0.001f) { Vector3 val3 = val2 / magnitude; if (magnitude > 节间距 * 1.2f || magnitude < 节间距 * 0.8f) { 目标位置列表[i] = val - val3 * 节间距; } } if (i <= 0) { continue; } Vector3 val4; Vector3 normalized; if (i < 目标位置列表.Count - 1) { val4 = 目标位置列表[i + 1] - 目标位置列表[i]; normalized = ((Vector3)(ref val4)).normalized; } else { val4 = 目标位置列表[i] - 目标位置列表[i - 1]; normalized = ((Vector3)(ref val4)).normalized; } if (normalized != Vector3.zero && ((Vector3)(ref normalized)).sqrMagnitude > 0.001f) { if (反转方向) { 目标旋转列表[i] = Quaternion.LookRotation(-normalized); } else { 目标旋转列表[i] = Quaternion.LookRotation(normalized); } } } } private float GetDeltaTime() { if (Mathf.Approximately(Time.timeScale, 0f)) { return Time.unscaledDeltaTime; } return Time.deltaTime; } private float GetTime() { if (Mathf.Approximately(Time.timeScale, 0f)) { return Time.unscaledTime; } return Time.time; } public void 游戏结束() { ((Behaviour)this).enabled = false; } private void OnDisable() { } private void OnDrawGizmosSelected() { //IL_002f: 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_0041: 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_0079: 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_0083: 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) //IL_0090: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0188: Unknown result type (might be due to invalid IL or missing references) if (!Application.isPlaying || 目标位置列表 == null) { return; } for (int i = 0; i < 目标位置列表.Count; i++) { Gizmos.color = ((i == 0) ? Color.blue : Color.yellow); Gizmos.DrawSphere(目标位置列表[i], 0.2f); if (i < 目标旋转列表.Count) { Gizmos.color = Color.red; Vector3 val = 目标旋转列表[i] * Vector3.forward; Gizmos.DrawRay(目标位置列表[i], val * 0.5f); if (反转方向) { Gizmos.color = Color.green; if (i < 目标位置列表.Count - 1) { Vector3 val2 = 目标位置列表[i + 1] - 目标位置列表[i]; Vector3 normalized = ((Vector3)(ref val2)).normalized; Gizmos.DrawRay(目标位置列表[i], normalized * 0.5f); } } } if (i > 0) { float num = Vector3.Distance(目标位置列表[i - 1], 目标位置列表[i]); Gizmos.color = ((Mathf.Abs(num - 节间距) < 0.1f) ? Color.green : Color.red); Gizmos.DrawLine(目标位置列表[i - 1], 目标位置列表[i]); } } } } public class 游戏开始事件启动器 : MonoBehaviour { private GameStateManager man; private bool 已开始 = false; public UnityEvent 开始战斗事件; private void Start() { man = ServiceLocator.GetService(); if (man == null) { Debug.LogError((object)"GameStateManager not found in ServiceLocator"); } } private void Update() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (!已开始 && (int)man.GameState == 1) { UnityEvent obj = 开始战斗事件; if (obj != null) { obj.Invoke(); } 已开始 = true; ((Behaviour)this).enabled = false; } } } public class 兵种ai地面检测121 : MonoBehaviour { private Unit unit; private DataHandler dataq; private bool 判断1 = true; private float 计时器 = 0f; private LayerMask 地面层掩码 = LayerMask.op_Implicit(512); private Vector3 当前地面位置; private Vector3 当前地面法线; private bool 是否在地面 = false; private float 距离地面距离 = 0f; public Vector3 当前地面位置信息 => 当前地面位置; public Vector3 当前地面法线信息 => 当前地面法线; public float 距离地面距离信息 => 距离地面距离; public bool 角色在地面 => 是否在地面; public void Start() { unit = ((Component)((Component)this).gameObject.transform.root).gameObject.GetComponentInChildren(); dataq = unit.data; } public bool 获取地面数据(out Vector3 地面位置, out Vector3 地面法线, out float 距离) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_003d: 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_0047: 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_0058: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) 地面位置 = Vector3.zero; 地面法线 = Vector3.up; 距离 = 0f; Vector3 val = unit.data.mainRig.position + Vector3.up * 2f; float num = 5f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, LayerMask.op_Implicit(地面层掩码))) { 地面位置 = ((RaycastHit)(ref val2)).point; 地面法线 = ((RaycastHit)(ref val2)).normal; 距离 = Vector3.Distance(unit.data.mainRig.position, ((RaycastHit)(ref val2)).point); return true; } return false; } public Vector3 获取地面位置(float 检测高度 = 10f) { //IL_0011: 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_0017: 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: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_009d: 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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) Vector3 position = unit.data.mainRig.position; Vector3 val = position + Vector3.up * 检测高度; float num = 检测高度 * 3f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, LayerMask.op_Implicit(地面层掩码))) { 当前地面位置 = ((RaycastHit)(ref val2)).point; 当前地面法线 = ((RaycastHit)(ref val2)).normal; 是否在地面 = true; 距离地面距离 = Vector3.Distance(position, ((RaycastHit)(ref val2)).point); return ((RaycastHit)(ref val2)).point; } 是否在地面 = false; return ((Component)this).transform.position; } public Vector3 获取地面法线(float 检测高度 = 10f) { //IL_0011: 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_0017: 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: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0065: Unknown result type (might be due to invalid IL or missing references) Vector3 position = unit.data.mainRig.position; Vector3 val = position + Vector3.up * 检测高度; float num = 检测高度 * 3f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, LayerMask.op_Implicit(地面层掩码))) { return ((RaycastHit)(ref val2)).normal; } return Vector3.up; } public float 获取距离地面距离(float 检测高度 = 10f) { //IL_0011: 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_0017: 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: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0051: 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) Vector3 position = unit.data.mainRig.position; Vector3 val = position + Vector3.up * 检测高度; float num = 检测高度 * 3f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, LayerMask.op_Implicit(地面层掩码))) { return Vector3.Distance(position, ((RaycastHit)(ref val2)).point); } return float.MaxValue; } public bool 是否接触地面(float 最大距离 = 1.5f) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) 获取地面位置(2f); return 是否在地面 && 距离地面距离 <= 最大距离; } public void 更新地面数据() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) //IL_0094: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_010b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)unit) || !Object.op_Implicit((Object)(object)unit.data)) { return; } 获取地面位置(2f); if (是否在地面) { dataq.isGrounded = true; dataq.groundedThisFrame = true; dataq.sinceGrounded = 0f; dataq.distanceToGround = 距离地面距离; dataq.groundNormal = 当前地面法线; dataq.groundPosition = 当前地面位置; if ((Object)(object)dataq.groundedMovementDirectionObject != (Object)null && (Object)(object)dataq.characterForwardObject != (Object)null) { dataq.forwardGroundNormal = Vector3.Cross(dataq.groundedMovementDirectionObject.right, dataq.groundNormal); dataq.groundedMovementDirectionObject.rotation = Quaternion.LookRotation(dataq.forwardGroundNormal); } } else { dataq.isGrounded = false; } } private void Update() { if (Object.op_Implicit((Object)(object)unit) && Object.op_Implicit((Object)(object)unit.data)) { 计时器 += Time.deltaTime; if (计时器 > 0.1f) { 更新地面数据(); 计时器 = 0f; } } } } public class 蠕虫碰撞伤害 : MonoBehaviour { [SerializeField] public float 碰撞伤害 = 400f; [SerializeField] private float 伤害冷却时间 = 0.1f; [SerializeField] private LayerMask 目标层 = LayerMask.op_Implicit(16385); private Unit 当前单位; private Team 当前队伍; private Dictionary 上次伤害时间 = new Dictionary(); private void Start() { //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) 当前单位 = ((Component)this).GetComponentInParent(); if ((Object)(object)当前单位 == (Object)null) { TeamHolder componentInParent = ((Component)this).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { 当前队伍 = ((Component)this).GetComponentInParent().team; } else { 当前队伍 = (Team)0; } } else { 当前队伍 = 当前单位.data.team; } } private void OnTriggerEnter(Collider other) { if (IsInTargetLayer(((Component)other).gameObject)) { 尝试造成伤害(other); } } private void OnTriggerStay(Collider other) { if (IsInTargetLayer(((Component)other).gameObject)) { 尝试造成伤害(other); } } private bool IsInTargetLayer(GameObject obj) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return ((1 << obj.layer) & LayerMask.op_Implicit(目标层)) != 0; } private void 尝试造成伤害(Collider other) { //IL_0012: 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_007c: Unknown result type (might be due to invalid IL or missing references) DataHandler componentInParent = ((Component)other).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && componentInParent.team != 当前队伍 && !componentInParent.Dead && (!上次伤害时间.TryGetValue(other, out var value) || !(Time.time - value < 伤害冷却时间))) { ((Damagable)componentInParent.healthHandler).TakeDamage(碰撞伤害, ((Component)other).transform.position, (Unit)null, (DamageType)0); Debug.Log((object)$"对 {((Object)((Component)other).gameObject).name} 造成了 {碰撞伤害} 点伤害"); 上次伤害时间[other] = Time.time; } } private void OnTriggerExit(Collider other) { 上次伤害时间.Remove(other); } } public class 单位被附身事件 : MonoBehaviour { private MainCam 主摄像机; private CameraAbilityPossess 摄像机能力; private Unit 此单位; private bool 被附身 = false; public UnityEvent 被附身事件; public UnityEvent 离开附身事件; private void Start() { 此单位 = ((Component)((Component)this).transform.root).GetComponent(); 主摄像机 = MainCam.instance; if ((Object)(object)主摄像机 != (Object)null) { 摄像机能力 = ((Component)主摄像机).GetComponentInParent(); if ((Object)(object)摄像机能力 != (Object)null) { 摄像机能力.AddOnPossessEnterAction((Action)On附身进入); 摄像机能力.AddOnPossessExitAction((Action)On附身退出); } } } private void On附身进入() { if ((Object)(object)摄像机能力 != (Object)null && (Object)(object)摄像机能力.currentUnit == (Object)(object)此单位 && !被附身) { 被附身 = true; UnityEvent obj = 被附身事件; if (obj != null) { obj.Invoke(); } Debug.Log((object)"此单位正在被玩家操控!"); } } private void On附身退出() { if (被附身) { 被附身 = false; UnityEvent obj = 离开附身事件; if (obj != null) { obj.Invoke(); } Debug.Log((object)"此单位离开了玩家操控!"); } } public bool 是否被附身() { return 被附身; } private void OnDestroy() { if ((Object)(object)摄像机能力 != (Object)null) { 摄像机能力.AddOnPossessEnterAction((Action)null); 摄像机能力.AddOnPossessExitAction((Action)null); } } } public class 蠕虫手动操作类 : MonoBehaviour { public 吞噬者移动类 蠕虫ai; public float 上抬程度 = 0.5f; private Rigidbody 被操纵的刚体; private bool 启动sss; private MainCam 主摄像机; public PossesionCamera 第三人才偏移; private Vector3 面向方向; private void Start() { if ((Object)(object)蠕虫ai == (Object)null) { 蠕虫ai = ((Component)this).GetComponent<吞噬者移动类>(); } 被操纵的刚体 = 蠕虫ai.物体刚体; 主摄像机 = MainCam.instance; if ((Object)(object)第三人才偏移 != (Object)null) { 第三人才偏移.thirdPersonOffset.y = 5f; } } private void Update() { if (启动sss) { if (Input.GetKey((KeyCode)119)) { 向前移动(); } 设置鼠标滚轮缩放(); } } private void 向前移动() { //IL_0056: 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_002b: 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) if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) { 被操纵的刚体.velocity = ((Component)this).transform.forward * 蠕虫ai.冲刺速度; return; } 被操纵的刚体.velocity = ((Component)this).transform.forward * 蠕虫ai.追击速度; 计算旋转(); } private void 计算旋转() { //IL_001e: 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_0028: 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_003a: 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) if (!((Object)(object)主摄像机 == (Object)null)) { Quaternion val = Quaternion.LookRotation(((Component)主摄像机).transform.forward); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val, Time.deltaTime * 蠕虫ai.转向速度 * 0.05f); } } public void 设置启用(bool v = true) { 启动sss = v; } private void 设置鼠标滚轮缩放() { if (!((Object)(object)第三人才偏移 == (Object)null)) { float axis = Input.GetAxis("Mouse ScrollWheel"); if (axis != 0f) { 第三人才偏移.thirdPersonOffset.z += axis * 2f; } } } } public class 蠕虫服饰调整 : MonoBehaviour { private void Start() { //IL_002f: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) Transform root = ((Component)this).transform.root; 平滑蠕虫跟随 componentInChildren = ((Component)root).GetComponentInChildren<平滑蠕虫跟随>(); if (!Object.op_Implicit((Object)(object)componentInChildren)) { return; } componentInChildren.节间距 = ((Component)this).transform.localScale.x; 体节生成器 componentInChildren2 = ((Component)root).GetComponentInChildren<体节生成器>(); if (Object.op_Implicit((Object)(object)componentInChildren2)) { componentInChildren2.体节数量 = (int)((Component)this).transform.localScale.y; ((Component)root.Find("Rigidbodies").Find("Scale").Find("世界吞噬者") .Find("Base") .Find("碰撞伤害体")).GetComponent<蠕虫碰撞伤害>().碰撞伤害 = ((Component)this).transform.localScale.z; bool active = (int)((Component)this).transform.localPosition.x != 1; ((Component)root.Find("Rigidbodies").Find("Scale").Find("世界吞噬者") .Find("Base") .Find("刚体碰撞体")).gameObject.SetActive(active); ((Component)root.Find("Rigidbodies").Find("Scale").Find("世界吞噬者") .Find("身") .Find("身体部位")).GetComponent<蠕虫碰撞伤害>().碰撞伤害 = ((Component)this).transform.localPosition.y; if ((int)((Component)this).transform.localPosition.z != 1) { ((Component)root.Find("Rigidbodies").Find("Scale").Find("世界吞噬者") .Find("Base") .Find("头") .Find("游戏efkjda")).gameObject.SetActive(false); ((Component)root.Find("Rigidbodies").Find("Scale").Find("世界吞噬者") .Find("魏") .Find("立方体.004")).gameObject.SetActive(false); ((Component)root.Find("Rigidbodies").Find("Scale").Find("世界吞噬者") .Find("身") .Find("石屯")).gameObject.SetActive(false); } } } } public class 蠕虫服饰调整2 : MonoBehaviour { private void Start() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) 吞噬者移动类 componentInChildren = ((Component)((Component)this).transform.root).GetComponentInChildren<吞噬者移动类>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.冲刺时间 = ((Component)this).transform.localScale.x; componentInChildren.巡游时间 = ((Component)this).transform.localScale.y; componentInChildren.减速时间 = ((Component)this).transform.localScale.z; componentInChildren.冲刺触发距离 = ((Component)this).transform.localPosition.x; componentInChildren.追击速度 = ((Component)this).transform.localPosition.y; componentInChildren.冲刺速度 = ((Component)this).transform.localPosition.z; } } } public class 蠕虫服饰调整3 : MonoBehaviour { private void Start() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) 吞噬者移动类 componentInChildren = ((Component)((Component)this).transform.root).GetComponentInChildren<吞噬者移动类>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.减速时间 = ((Component)this).transform.localScale.x; componentInChildren.巡游高度范围 = ((Component)this).transform.localScale.y; componentInChildren.巡游半径 = ((Component)this).transform.localScale.z; componentInChildren.巡游状态目标切换时间 = ((Component)this).transform.localPosition.x; componentInChildren.巡游速度 = ((Component)this).transform.localPosition.y; componentInChildren.转向速度 = ((Component)this).transform.localPosition.z; } } } public class 体节生成器 : MonoBehaviour { public enum 排列方式 { 沿头部后方直线排列, 沿头部后方曲线排列, 原地生成稍后调整 } public enum 插入位置 { 替换整个列表, 插入到列表开头_靠近头部, 追加到列表末尾_靠近尾部 } [CompilerGenerated] private sealed class <延迟初始化>d__20 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 体节生成器 <>4__this; private MethodInfo 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <延迟初始化>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>4__this.目标蠕虫脚本 != (Object)null) { 5__1 = typeof(平滑蠕虫跟随).GetMethod("初始化身体节", BindingFlags.Instance | BindingFlags.NonPublic); if (5__1 != null) { 5__1.Invoke(<>4__this.目标蠕虫脚本, null); } 5__1 = 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(); } } [Header("目标引用")] [Tooltip("要添加体节的平滑蠕虫跟随脚本")] public 平滑蠕虫跟随 目标蠕虫脚本; [Tooltip("体节的预制体(必须包含Transform组件,建议是空物体或带有模型的物体)")] public Transform 体节预制体; [Header("生成设置")] [Tooltip("要生成的体节数量")] public int 体节数量 = 5; [Tooltip("是否在Start时自动生成")] public bool 启动时自动生成 = true; [Tooltip("生成的体节是否自动命名")] public bool 自动命名 = true; [Tooltip("生成体节的父物体(默认为当前物体的子物体)")] public Transform 体节父物体; [Tooltip("生成后是否自动设置节间距为预制体的长度")] public bool 自动设置节间距 = true; [Tooltip("如果自动设置节间距,预制体的长度(在模型的朝向上)")] public float 预制体长度 = 1f; [Header("插入位置设置")] [Tooltip("新体节插入到列表的位置")] public 插入位置 体节插入位置 = 插入位置.插入到列表开头_靠近头部; [Tooltip("如果插入到开头,新体节与头部的距离")] public float 新体节与头部距离 = 0.5f; [Header("初始位置设置")] [Tooltip("生成时体节的排列方式")] public 排列方式 初始排列 = 排列方式.沿头部后方直线排列; [Tooltip("初始弯曲度(0=直线,正值=向右弯曲,负值=向左弯曲)")] [Range(-45f, 45f)] public float 初始弯曲角度 = 0f; [Tooltip("弯曲半径倍数(相对于节间距)")] public float 弯曲半径倍数 = 2f; private List 生成的体节 = new List(); private void Start() { if (启动时自动生成) { 生成体节(); } } public void 生成体节() { if (!验证设置()) { Debug.LogError((object)"体节生成器:设置不完整,无法生成体节!"); return; } Transform 父物体 = (((Object)(object)体节父物体 != (Object)null) ? 体节父物体 : ((Component)this).transform); 生成的体节.Clear(); for (int i = 0; i < 体节数量; i++) { Transform val = 创建单个体节(i, 父物体); if ((Object)(object)val != (Object)null) { 生成的体节.Add(val); } } 合并到现有列表(); if (自动设置节间距) { 目标蠕虫脚本.节间距 = 预制体长度; } if (Application.isPlaying) { ((MonoBehaviour)this).StartCoroutine(延迟初始化()); } Debug.Log((object)$"体节生成器:成功生成 {体节数量} 个体节,插入位置:{体节插入位置}"); } private void 合并到现有列表() { if ((Object)(object)目标蠕虫脚本 == (Object)null) { return; } switch (体节插入位置) { case 插入位置.替换整个列表: 清除已生成体节(仅清理场景中的旧体节: true); 目标蠕虫脚本.身体节列表.Clear(); foreach (Transform item in 生成的体节) { 目标蠕虫脚本.身体节列表.Add(item); } Debug.Log((object)$"替换整个列表:新列表包含 {生成的体节.Count} 个体节"); break; case 插入位置.插入到列表开头_靠近头部: if (目标蠕虫脚本.身体节列表.Count > 0) { Debug.Log((object)$"插入到开头:原有 {目标蠕虫脚本.身体节列表.Count} 个体节,将在前面插入 {生成的体节.Count} 个新体节"); List list = new List(); list.AddRange(生成的体节); list.AddRange(目标蠕虫脚本.身体节列表); 目标蠕虫脚本.身体节列表 = list; 调整新体节位置(); break; } { foreach (Transform item2 in 生成的体节) { 目标蠕虫脚本.身体节列表.Add(item2); } break; } case 插入位置.追加到列表末尾_靠近尾部: foreach (Transform item3 in 生成的体节) { 目标蠕虫脚本.身体节列表.Add(item3); } Debug.Log((object)$"追加到末尾:原有 {目标蠕虫脚本.身体节列表.Count - 生成的体节.Count} 个体节,末尾追加 {生成的体节.Count} 个新体节"); break; } } private void 调整新体节位置() { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00f8: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0145: 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) if ((Object)(object)目标蠕虫脚本 == (Object)null || (Object)(object)目标蠕虫脚本.头部 == (Object)null) { return; } Transform 头部 = 目标蠕虫脚本.头部; float num = (自动设置节间距 ? 预制体长度 : 目标蠕虫脚本.节间距); List 身体节列表 = 目标蠕虫脚本.身体节列表; for (int i = 0; i < 生成的体节.Count; i++) { if (i >= 身体节列表.Count) { continue; } Transform val = 身体节列表[i]; if ((Object)(object)val != (Object)null && 身体节列表.Count > 生成的体节.Count) { Transform val2 = 身体节列表[生成的体节.Count]; float num2 = Vector3.Distance(头部.position, val2.position); float num3 = num2 / (float)(生成的体节.Count + 1); Vector3 val3 = val2.position - 头部.position; Vector3 normalized = ((Vector3)(ref val3)).normalized; val.position = 头部.position + normalized * (num3 * (float)(i + 1)); if (目标蠕虫脚本.反转方向) { val.rotation = Quaternion.LookRotation(-normalized); } else { val.rotation = Quaternion.LookRotation(normalized); } } } } [IteratorStateMachine(typeof(<延迟初始化>d__20))] private IEnumerator 延迟初始化() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <延迟初始化>d__20(0) { <>4__this = this }; } private Transform 创建单个体节(int 索引, Transform 父物体) { //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_0032: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_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) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)体节预制体 == (Object)null) { return null; } Vector3 val = 计算初始位置(索引); if (Application.isPlaying) { Transform val2 = Object.Instantiate(体节预制体, val, Quaternion.identity, 父物体); if (自动命名) { if (体节插入位置 == 插入位置.插入到列表开头_靠近头部) { ((Object)val2).name = $"新体节_{索引 + 1:00}_靠近头部"; } else { ((Object)val2).name = $"体节_{索引 + 1:00}"; } } if (初始排列 == 排列方式.沿头部后方直线排列) { val2.rotation = Quaternion.LookRotation(-目标蠕虫脚本.头部.forward); } else if (初始排列 == 排列方式.沿头部后方曲线排列) { float num = 初始弯曲角度 * (float)(索引 + 1) / (float)体节数量; Quaternion val3 = Quaternion.Euler(0f, num, 0f); val2.rotation = val3 * Quaternion.LookRotation(-目标蠕虫脚本.头部.forward); } return val2; } return null; } private Vector3 计算初始位置(int 索引) { //IL_0029: 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_0181: 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_00d0: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_0151: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_0173: 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_0103: 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_0114: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)目标蠕虫脚本 == (Object)null || (Object)(object)目标蠕虫脚本.头部 == (Object)null) { return Vector3.zero; } Transform 头部 = 目标蠕虫脚本.头部; float num = (自动设置节间距 ? 预制体长度 : 目标蠕虫脚本.节间距); bool flag = 体节插入位置 == 插入位置.插入到列表开头_靠近头部; int num2 = (flag ? 索引 : 索引); float num3 = num * (float)(num2 + 1); if (flag && 目标蠕虫脚本.身体节列表.Count > 0) { num3 = 新体节与头部距离 + num * (float)num2; } switch (初始排列) { case 排列方式.沿头部后方直线排列: return 头部.position - 头部.forward * num3; case 排列方式.沿头部后方曲线排列: { if (初始弯曲角度 == 0f) { return 头部.position - 头部.forward * num3; } float num4 = num * 弯曲半径倍数; float num5 = (float)(num2 + 1) * 初始弯曲角度 * ((float)Math.PI / 180f); Vector3 val = 头部.right * Mathf.Sin(num5) * num4; Vector3 val2 = 头部.position - 头部.forward * num3; return val2 + val; } default: return 头部.position; } } private bool 验证设置() { if ((Object)(object)目标蠕虫脚本 == (Object)null) { Debug.LogError((object)"体节生成器:未指定目标蠕虫脚本!"); return false; } if ((Object)(object)目标蠕虫脚本.头部 == (Object)null) { Debug.LogError((object)"体节生成器:目标蠕虫脚本的头部未设置!"); return false; } if ((Object)(object)体节预制体 == (Object)null) { Debug.LogError((object)"体节生成器:未指定体节预制体!"); return false; } if (体节数量 <= 0) { Debug.LogError((object)"体节生成器:体节数量必须大于0!"); return false; } return true; } public void 清除已生成体节(bool 仅清理场景中的旧体节 = false) { if (!仅清理场景中的旧体节 && (Object)(object)目标蠕虫脚本 != (Object)null) { 目标蠕虫脚本.身体节列表.Clear(); } foreach (Transform item in 生成的体节) { if ((Object)(object)item != (Object)null && Application.isPlaying) { Object.Destroy((Object)(object)((Component)item).gameObject); } } 生成的体节.Clear(); } public void 重新生成体节() { 清除已生成体节(); 生成体节(); } public int 获取当前体节总数() { if ((Object)(object)目标蠕虫脚本 != (Object)null) { return 目标蠕虫脚本.身体节列表.Count; } return 0; } private void OnDrawGizmosSelected() { //IL_003a: 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_0070: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_01f6: 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_00bc: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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) if ((Object)(object)目标蠕虫脚本 == (Object)null || (Object)(object)目标蠕虫脚本.头部 == (Object)null || 体节数量 <= 0) { return; } Gizmos.color = Color.green; float num = (自动设置节间距 ? 预制体长度 : 目标蠕虫脚本.节间距); for (int i = 0; i < 体节数量; i++) { Vector3 val = 计算初始位置(i); if (体节插入位置 == 插入位置.插入到列表开头_靠近头部) { Gizmos.color = Color.cyan; } else { Gizmos.color = Color.green; } Gizmos.DrawWireSphere(val, 0.2f); if (i > 0) { Vector3 val2 = 计算初始位置(i - 1); Gizmos.DrawLine(val2, val); } if (初始排列 == 排列方式.沿头部后方直线排列 || 初始排列 == 排列方式.沿头部后方曲线排列) { Gizmos.color = Color.blue; Vector3 val3 = -目标蠕虫脚本.头部.forward; if (初始排列 == 排列方式.沿头部后方曲线排列 && 初始弯曲角度 != 0f) { float num2 = 初始弯曲角度 * (float)(i + 1) / (float)体节数量; Quaternion val4 = Quaternion.Euler(0f, num2, 0f); val3 = val4 * -目标蠕虫脚本.头部.forward; } Gizmos.DrawRay(val, val3 * 0.5f); } } if (体节插入位置 == 插入位置.插入到列表开头_靠近头部) { Gizmos.color = Color.yellow; Vector3 val5 = 计算初始位置(0); Gizmos.DrawLine(目标蠕虫脚本.头部.position, val5); if (目标蠕虫脚本.身体节列表.Count <= 0) { return; } Gizmos.color = Color.white; { foreach (Transform item in 目标蠕虫脚本.身体节列表) { if ((Object)(object)item != (Object)null) { Gizmos.DrawSphere(item.position, 0.15f); } } return; } } Gizmos.color = Color.yellow; Gizmos.DrawLine(目标蠕虫脚本.头部.position, 计算初始位置(0)); } } } namespace HeMoDingDingMod.unity脚本.脚本2 { public class 更换天空盒 : MonoBehaviour { [Header("天空盒材质")] [SerializeField] private Material skyboxMaterial; [Header("后处理设置")] [SerializeField] private bool keepPostProcess = true; private void Start() { ChangeSkybox(); } private void ChangeSkybox() { if ((Object)(object)skyboxMaterial == (Object)null) { Debug.LogWarning((object)"请指定天空盒材质!"); return; } if (keepPostProcess) { Debug.Log((object)"后处理效果将保持不变"); } RenderSettings.skybox = skyboxMaterial; DynamicGI.UpdateEnvironment(); Debug.Log((object)("天空盒已更换为: " + ((Object)skyboxMaterial).name)); } } public class 飘动的头发 : MonoBehaviour { public enum 跟随模式 { 位置, 位置和旋转 } public enum 旋转位置跟随方向 { x, y, z } public Transform 头部骨骼; public List 骨骼列表; public float 方向化 = 1f; public float 与头部的间距 = 3f; public float 骨骼之间的间距 = 3f; public float 头部跟随强度 = 1f; public float 骨骼跟随强度 = 1f; public 跟随模式 跟随方式 = 跟随模式.位置; public 旋转位置跟随方向 旋转位置跟随方向1 = 旋转位置跟随方向.z; private void Update() { if (骨骼列表.Count != 0 && !((Object)(object)头部骨骼 == (Object)null)) { switch (跟随方式) { case 跟随模式.位置: 位置跟随(); break; case 跟随模式.位置和旋转: 位置和旋转跟随(); break; } } } private void 位置跟随() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0063: 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) for (int i = 0; i < 骨骼列表.Count; i++) { if (i == 0) { if (Vector3.Distance(骨骼列表[i].position, 头部骨骼.position) > 与头部的间距) { 骨骼列表[i].position = Vector3.Lerp(骨骼列表[i].position, 头部骨骼.position, Time.deltaTime * 头部跟随强度); } } else if (Vector3.Distance(骨骼列表[i].position, 骨骼列表[i - 1].position) > 骨骼之间的间距) { 骨骼列表[i].position = Vector3.Lerp(骨骼列表[i].position, 骨骼列表[i - 1].position, Time.deltaTime * 骨骼跟随强度); } } } private void 位置和旋转跟随() { for (int i = 0; i < 骨骼列表.Count; i++) { if (i == 0) { 处理第一根骨骼(); } else { 处理后续骨骼(i); } } } private void 处理第一根骨骼() { //IL_0010: 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_0018: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_003d: 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_0052: Unknown result type (might be due to invalid IL or missing references) Transform val = 骨骼列表[0]; Vector3 val2 = 计算目标位置(val); val.position = Vector3.Lerp(val.position, val2, Time.deltaTime * 头部跟随强度); Quaternion val3 = 计算指定轴向的旋转(val, val2); val.rotation = Quaternion.Lerp(val.rotation, val3, Time.deltaTime * 头部跟随强度); } private Vector3 计算目标位置(Transform currentBone) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0053: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0084: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_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) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) switch (旋转位置跟随方向1) { case 旋转位置跟随方向.x: { Vector3 val3 = 头部骨骼.right * 与头部的间距 * 方向化; return 头部骨骼.position + val3; } case 旋转位置跟随方向.y: { Vector3 val2 = 头部骨骼.up * 与头部的间距 * 方向化; return 头部骨骼.position + val2; } default: { Vector3 val = 头部骨骼.forward * 与头部的间距 * 方向化; return 头部骨骼.position + val; } } } private Quaternion 计算指定轴向的旋转(Transform currentBone, Vector3 目标位置) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_000d: 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) //IL_004a: 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_0051: 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) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0060: 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_0068: Unknown result type (might be due to invalid IL or missing references) Vector3 val = 目标位置 - currentBone.position; if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { return currentBone.rotation; } return (Quaternion)(旋转位置跟随方向1 switch { 旋转位置跟随方向.x => 使用X轴面向目标(val, currentBone), 旋转位置跟随方向.y => 使用Y轴面向目标(val, currentBone), _ => Quaternion.LookRotation(val), }); } private Quaternion 使用X轴面向目标(Vector3 方向, Transform 物体) { //IL_0003: 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_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_001a: 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_0022: 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_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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Vector3 normalized = ((Vector3)(ref 方向)).normalized; Vector3 val = 物体.right * 方向化; Quaternion val2 = Quaternion.FromToRotation(val, normalized); return val2 * ((Component)this).transform.rotation; } private Quaternion 使用Y轴面向目标(Vector3 方向, Transform 物体) { //IL_0003: 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_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_001a: 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_0022: 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_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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Vector3 normalized = ((Vector3)(ref 方向)).normalized; Vector3 val = 物体.up * 方向化; Quaternion val2 = Quaternion.FromToRotation(val, normalized); return val2 * ((Component)this).transform.rotation; } private void 处理后续骨骼(int index) { //IL_001f: 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) //IL_0027: 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) //IL_0039: 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_004b: 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_0055: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_007c: 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) Transform val = 骨骼列表[index]; Transform val2 = 骨骼列表[index - 1]; Vector3 val3 = 计算目标位置1(val2); val.position = Vector3.Lerp(val.position, val3, Time.deltaTime * 骨骼跟随强度); Vector3 val4 = val.position - val2.position; if (((Vector3)(ref val4)).sqrMagnitude > 0.0001f) { Quaternion val5 = 计算指定轴向的旋转(val, val3); val.rotation = Quaternion.Lerp(val.rotation, val5, Time.deltaTime * 骨骼跟随强度); } } private Vector3 计算目标位置1(Transform currentBone) { //IL_0021: 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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0043: 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_0059: 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) //IL_0069: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0091: 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) //IL_0098: 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_009e: 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_00a7: Unknown result type (might be due to invalid IL or missing references) switch (旋转位置跟随方向1) { case 旋转位置跟随方向.x: { Vector3 val3 = currentBone.right * 骨骼之间的间距 * 方向化; return currentBone.position + val3; } case 旋转位置跟随方向.y: { Vector3 val2 = currentBone.up * 骨骼之间的间距 * 方向化; return currentBone.position + val2; } default: { Vector3 val = currentBone.forward * 骨骼之间的间距 * 方向化; return currentBone.position + val; } } } } public class 披风脚本 : MonoBehaviour { [Serializable] public class 记录相对位置类 { public Vector3 相对于上一个骨骼的局部位置; public Quaternion 相对于上一个骨骼的局部旋转; public float 与上一个骨骼的距离; public 记录相对位置类(Vector3 局部偏移, Quaternion 局部旋转, float 距离) { //IL_0009: 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_0010: 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) 相对于上一个骨骼的局部位置 = 局部偏移; 相对于上一个骨骼的局部旋转 = 局部旋转; 与上一个骨骼的距离 = 距离; } } public Transform 根部披风; public List 披风骨骼组; [Header("间隔距离设置")] public float 移动速度 = 9f; public float 旋转速度 = 9f; [Header("拉伸限制")] public float 最大拉伸距离 = 0.5f; public bool 启用拉伸限制 = true; [Header("轴向映射")] public Vector3 物体指向目标的轴 = Vector3.up; public Vector3 物体的上方向轴 = Vector3.forward; [Header("世界参考")] public Vector3 世界向上方向 = Vector3.up; public bool 物体局部指定为准 = true; public Transform 指定为替换世界空间物体; public Vector3 局部世界物体指向 = Vector3.up; public bool 以上一个物体的局部轴为例 = false; public Vector3 上一个物体局部世界物体指向 = Vector3.up; private float 第一根骨骼与根骨骼的距离; private Vector3 第一根骨骼相对于根的局部位置; private Quaternion 第一根骨骼相对于根的局部旋转; public List<记录相对位置类> 骨骼组 = new List<记录相对位置类>(); private void Start() { 初始化骨骼关系(); } private void 初始化骨骼关系() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00cd: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_0102: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0047: 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_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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) 骨骼组.Clear(); for (int i = 0; i < 披风骨骼组.Count; i++) { if (i == 0) { 第一根骨骼相对于根的局部位置 = 根部披风.InverseTransformPoint(披风骨骼组[i].position); 第一根骨骼相对于根的局部旋转 = Quaternion.Inverse(根部披风.rotation) * 披风骨骼组[i].rotation; 第一根骨骼与根骨骼的距离 = Vector3.Distance(披风骨骼组[i].position, 根部披风.position); } else { Vector3 局部偏移 = 披风骨骼组[i - 1].InverseTransformPoint(披风骨骼组[i].position); Quaternion 局部旋转 = Quaternion.Inverse(披风骨骼组[i - 1].rotation) * 披风骨骼组[i].rotation; 骨骼组.Add(new 记录相对位置类(局部偏移, 局部旋转, Vector3.Distance(披风骨骼组[i].position, 披风骨骼组[i - 1].position))); } } } private void Update() { //IL_0039: 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_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_0053: 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_005b: 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_005e: Unknown result type (might be due to invalid IL or missing references) 处理骨骼(); if (物体局部指定为准 && !以上一个物体的局部轴为例 && (Object)(object)指定为替换世界空间物体 != (Object)null) { Vector3 val = 指定为替换世界空间物体.TransformPoint(局部世界物体指向) - 指定为替换世界空间物体.position; Vector3 normalized = ((Vector3)(ref val)).normalized; 世界向上方向 = normalized; } } private void 处理骨骼() { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_0029: 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_003f: 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_0055: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0097: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00c1: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 披风骨骼组.Count; i++) { Vector3 val; if (i == 0) { 披风骨骼组[i].position = 计算最大拉伸距离(根部披风.TransformPoint(第一根骨骼相对于根的局部位置), 披风骨骼组[i].position); val = 根部披风.position - 披风骨骼组[i].position; Vector3 normalized = ((Vector3)(ref val)).normalized; 披风骨骼组[i].rotation = Quaternion.Lerp(披风骨骼组[i].rotation, 计算旋转(normalized, 世界向上方向, 物体指向目标的轴, 物体的上方向轴, 根部披风), Time.deltaTime * 旋转速度); } else { 披风骨骼组[i].position = 计算最大拉伸距离(披风骨骼组[i - 1].TransformPoint(骨骼组[i - 1].相对于上一个骨骼的局部位置), 披风骨骼组[i].position); val = 披风骨骼组[i - 1].position - 披风骨骼组[i].position; Vector3 normalized2 = ((Vector3)(ref val)).normalized; 披风骨骼组[i].rotation = Quaternion.Lerp(披风骨骼组[i].rotation, 计算旋转(normalized2, 世界向上方向, 物体指向目标的轴, 物体的上方向轴, 披风骨骼组[i - 1]), Time.deltaTime * 旋转速度); } } } private Vector3 计算最大拉伸距离(Vector3 目标位置, Vector3 当前位置) { //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_000f: 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_0015: 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_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_004f: 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_0033: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) Vector3 val = Vector3.Lerp(当前位置, 目标位置, Time.deltaTime * 移动速度); Vector3 val2 = val - 目标位置; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > 最大拉伸距离) { return 目标位置 + val2 / magnitude * 最大拉伸距离; } return val; } private Quaternion 计算旋转(Vector3 目标方向, Vector3 世界向上, Vector3 物体指向轴, Vector3 物体向上轴, Transform 指定世界之上) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_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_0034: 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_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_0041: 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_0083: 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) //IL_008c: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) //IL_0069: 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_00fe: 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_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_010f: 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_0112: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_00b0: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00dc: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) Vector3 val; Vector3 val2; if (以上一个物体的局部轴为例 && (Object)(object)指定世界之上 != (Object)null) { val = 指定世界之上.TransformPoint(上一个物体局部世界物体指向) - 指定世界之上.position; val2 = ((Vector3)(ref val)).normalized; float num = Mathf.Abs(Vector3.Dot(val2, ((Vector3)(ref 目标方向)).normalized)); if (num > 0.9999f) { val2 = 指定世界之上.right; } } else { val2 = ((Vector3)(ref 世界向上)).normalized; } 目标方向 = ((Vector3)(ref 目标方向)).normalized; 物体指向轴 = ((Vector3)(ref 物体指向轴)).normalized; 物体向上轴 = ((Vector3)(ref 物体向上轴)).normalized; float num2 = Mathf.Abs(Vector3.Dot(目标方向, val2)); Vector3 val4; if (num2 > 0.9999f) { Vector3 val3 = ((Mathf.Abs(Vector3.Dot(目标方向, Vector3.right)) < 0.9999f) ? Vector3.right : Vector3.forward); val = Vector3.Cross(val3, 目标方向); Vector3 normalized = ((Vector3)(ref val)).normalized; val = Vector3.Cross(目标方向, normalized); val4 = ((Vector3)(ref val)).normalized; } else { val = Vector3.Cross(val2, 目标方向); Vector3 normalized2 = ((Vector3)(ref val)).normalized; val = Vector3.Cross(目标方向, normalized2); val4 = ((Vector3)(ref val)).normalized; if (Vector3.Dot(val4, val2) < 0f) { val4 = -val4; } } Quaternion val5 = Quaternion.LookRotation(目标方向, val4); Quaternion val6 = Quaternion.LookRotation(物体指向轴, 物体向上轴); return val5 * Quaternion.Inverse(val6); } } public class 攻击瞬移类 : MonoBehaviour { public Unit 此单位; public float 偏移距离 = 1.5f; public float 垂直偏移 = 1.5f; private void Start() { 此单位 = ((Component)((Component)this).transform.root).GetComponent(); } public void 瞬移开始(GameObject 残影) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00d0: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: 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) if ((Object)(object)此单位.data.targetData == (Object)null || (Object)(object)此单位.data.targetData.mainRig == (Object)null) { Debug.LogWarning((object)"没有目标单位或目标单位没有mainRig"); return; } Vector3 position = 此单位.data.mainRig.position; if ((Object)(object)残影 != (Object)null) { GameObject val = Object.Instantiate(残影, position, Quaternion.identity); TeamHolder.AddTeamHolder(val, ((Component)this).gameObject); } Vector3 position2 = 此单位.data.targetData.mainRig.position; Vector3 val2 = 此单位.data.mainRig.position - position2; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val3 = position2 + normalized * 偏移距离; val3.y += 垂直偏移; Vector3 val4 = val3 - position; DataHandler data = 此单位.data; for (int i = 0; i < ((Component)data).transform.childCount; i++) { Transform child = ((Component)data).transform.GetChild(i); child.position += val4; } WeaponHandler component = ((Component)data).GetComponent(); if ((Object)(object)component != (Object)null) { if (Object.op_Implicit((Object)(object)component.rightWeapon)) { Transform transform = ((Component)component.rightWeapon).transform; transform.position += val4; } if (Object.op_Implicit((Object)(object)component.leftWeapon)) { Transform transform2 = ((Component)component.leftWeapon).transform; transform2.position += val4; } } if ((Object)(object)残影 != (Object)null) { GameObject val5 = Object.Instantiate(残影, val3, Quaternion.identity); TeamHolder.AddTeamHolder(val5, ((Component)this).gameObject); } } } public class 最近单位获取3231 : MonoBehaviour { public bool useUnitTeam = false; private Unit unit; private Team team; private TeamHolder teamholder; private TeamSystem m_teamSystem; private List orderedUnits; private void Start() { SetTeamSystem(); } private List GetUnitsAndSort() { //IL_0003: 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_0014: Unknown result type (might be due to invalid IL or missing references) team = GetTeam(); List teamUnits = m_teamSystem.GetTeamUnits((Team)(((int)team == 0) ? 1 : 0)); teamUnits.Sort((Unit x, Unit y) => Vector3.Distance(((Component)this).transform.position, x.data.mainRig.position).CompareTo(Vector3.Distance(((Component)this).transform.position, y.data.mainRig.position))); return teamUnits; } public List GetTargets(float? maxRange = 0f) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) orderedUnits = new List(); orderedUnits.AddRange(GetUnitsAndSort()); if (maxRange != 0f) { for (int i = 0; i < orderedUnits.Count; i++) { if (Vector3.Distance(((Component)this).transform.position, ((Component)orderedUnits[i].data.mainRig).transform.position) > maxRange) { orderedUnits.RemoveRange(i, orderedUnits.Count - i); break; } } } return orderedUnits; } private Team GetTeam() { //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_002f: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (useUnitTeam) { unit = ((Component)this).GetComponentInParent(); if (Object.op_Implicit((Object)(object)unit)) { team = unit.Team; } } else { teamholder = ((Component)((Component)this).transform).GetComponent(); if (Object.op_Implicit((Object)(object)teamholder)) { team = teamholder.team; } } return team; } private void SetTeamSystem() { m_teamSystem = World.Active.GetOrCreateManager(); } } public class 暗影刺客随机瞬移技能 : MonoBehaviour { public 最近单位获取3231 单位获取工具; public Unit 此单位; public float 偏移距离 = 1.5f; public float 垂直偏移 = 1.5f; private void Start() { 此单位 = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)单位获取工具 == (Object)null) { 单位获取工具 = ((Component)this).GetComponent<最近单位获取3231>(); } } public void 瞬移开始(GameObject 残影) { //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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0112: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_016d: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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) if ((Object)(object)此单位.data.targetData == (Object)null || (Object)(object)此单位.data.targetData.mainRig == (Object)null || (Object)(object)单位获取工具 == (Object)null) { Debug.LogWarning((object)"没有目标单位或目标单位没有mainRig"); return; } List targets = 单位获取工具.GetTargets(9999f); if (targets.Count == 0) { return; } Unit val = targets[Random.Range(0, targets.Count)]; Vector3 position = 此单位.data.mainRig.position; if ((Object)(object)残影 != (Object)null) { GameObject val2 = Object.Instantiate(残影, position, Quaternion.identity); TeamHolder.AddTeamHolder(val2, ((Component)this).gameObject); } Vector3 position2 = val.data.mainRig.position; Vector3 val3 = 此单位.data.mainRig.position - position2; Vector3 normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = position2 + normalized * 偏移距离; val4.y += 垂直偏移; Vector3 val5 = val4 - position; DataHandler data = 此单位.data; for (int i = 0; i < ((Component)data).transform.childCount; i++) { Transform child = ((Component)data).transform.GetChild(i); child.position += val5; } WeaponHandler component = ((Component)data).GetComponent(); if ((Object)(object)component != (Object)null) { if (Object.op_Implicit((Object)(object)component.rightWeapon)) { Transform transform = ((Component)component.rightWeapon).transform; transform.position += val5; } if (Object.op_Implicit((Object)(object)component.leftWeapon)) { Transform transform2 = ((Component)component.leftWeapon).transform; transform2.position += val5; } } if ((Object)(object)残影 != (Object)null) { GameObject val6 = Object.Instantiate(残影, val4, Quaternion.identity); TeamHolder.AddTeamHolder(val6, ((Component)this).gameObject); } } } [ExecuteInEditMode] [RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))] public class 刀光拖尾渲染器 : MonoBehaviour { private struct 历史顶点 { public Vector3[] 刀身点位置; public float 创建时间; public 历史顶点(Vector3[] positions, float time) { //IL_001d: 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) 刀身点位置 = (Vector3[])(object)new Vector3[positions.Length]; for (int i = 0; i < positions.Length; i++) { 刀身点位置[i] = positions[i]; } 创建时间 = time; } } [Header("位置引用")] public Transform[] 刀身点; [Tooltip("用于检测移动距离的中心点,如果不设置则使用第一个刀身点")] public Transform 拖尾中心点; [Header("材质设置")] public Material 拖尾材质; [Header("颜色设置")] [Tooltip("控制拖尾颜色随时间变化")] public Gradient 拖尾颜色渐变 = new Gradient(); [Header("时间参数")] public float 每次网格生成间隔时间 = 0.05f; public float 每段网格存在时间 = 0.5f; [Header("距离触发参数")] [Tooltip("基于距离触发时,移动多少距离才生成新顶点")] public float 触发移动距离 = 0.1f; [Tooltip("启用基于距离的触发模式(将忽略时间间隔)")] public bool 使用距离触发 = false; [Header("更新模式")] [Tooltip("开启后每帧更新网格,不受生成间隔时间影响")] public bool 每帧更新 = false; [Header("永久顶点设置")] [Tooltip("是否始终保留当前刀身位置作为最新顶点")] public bool 保留当前帧为永久顶点 = true; [Header("状态控制")] [SerializeField] private bool 是否启用 = true; [Header("编辑器设置")] public bool 编辑器模式下运行 = true; private List<历史顶点> 历史顶点列表 = new List<历史顶点>(); private Mesh 刀光拖尾网格; private MeshFilter 网格过滤器; private float 上次生成时间 = 0f; private float 上次编辑器时间 = 0f; private bool 上次运行状态 = false; private Color[] 顶点颜色数组; private Vector3 上次中心点位置; private bool 首次记录中心点 = true; private Vector3[] 当前帧刀身点位置; public bool 启用状态 { get { return 是否启用; } set { 是否启用 = value; } } private void Start() { 初始化组件(); 上次生成时间 = GetCurrentTime(); 上次编辑器时间 = GetCurrentTime(); 重置中心点记录(); 初始化渐变(); } private void OnEnable() { if ((Object)(object)网格过滤器 == (Object)null || (Object)(object)刀光拖尾网格 == (Object)null) { 初始化组件(); } 上次生成时间 = GetCurrentTime(); 上次编辑器时间 = GetCurrentTime(); 重置中心点记录(); 初始化渐变(); } private void 初始化渐变() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) if (拖尾颜色渐变 == null || 拖尾颜色渐变.colorKeys.Length == 0) { 拖尾颜色渐变 = new Gradient(); GradientColorKey[] array = (GradientColorKey[])(object)new GradientColorKey[2]; array[0].color = Color.white; array[0].time = 0f; array[1].color = new Color(1f, 1f, 1f, 0f); array[1].time = 1f; GradientAlphaKey[] array2 = (GradientAlphaKey[])(object)new GradientAlphaKey[2]; array2[0].alpha = 1f; array2[0].time = 0f; array2[1].alpha = 0f; array2[1].time = 1f; 拖尾颜色渐变.SetKeys(array, array2); } } private void OnDisable() { if ((Object)(object)刀光拖尾网格 != (Object)null) { 刀光拖尾网格.Clear(); } } private void Update() { if (Application.isPlaying != 上次运行状态) { if (!Application.isPlaying) { 上次编辑器时间 = GetCurrentTime(); } 上次运行状态 = Application.isPlaying; } if (!Application.isPlaying && (!编辑器模式下运行 || Application.isPlaying)) { if ((Object)(object)刀光拖尾网格 != (Object)null && 刀光拖尾网格.vertexCount > 0) { 刀光拖尾网格.Clear(); } return; } 更新当前帧位置(); 移除过期顶点对(); if (是否启用) { float currentTime = GetCurrentTime(); bool flag = false; if (每帧更新 || ((!使用距离触发) ? (currentTime - 上次生成时间 >= 每次网格生成间隔时间) : 检查距离触发())) { 添加新顶点对(); 上次生成时间 = currentTime; } } if (刀身点 != null && 刀身点.Length >= 2) { 更新网格(); } else if ((Object)(object)刀光拖尾网格 != (Object)null) { 刀光拖尾网格.Clear(); } } private bool 检查距离触发() { //IL_004c: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0061: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (刀身点 == null || 刀身点.Length == 0) { return false; } Vector3 val = ((!((Object)(object)拖尾中心点 != (Object)null)) ? 刀身点[0].position : 拖尾中心点.position); if (首次记录中心点) { 上次中心点位置 = val; 首次记录中心点 = false; return true; } float num = Vector3.Distance(val, 上次中心点位置); if (num >= 触发移动距离) { 上次中心点位置 = val; return true; } return false; } public void 重置中心点记录() { 首次记录中心点 = true; } public void 更新中心点位置() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) if ((Object)(object)拖尾中心点 != (Object)null) { 上次中心点位置 = 拖尾中心点.position; } else if (刀身点 != null && 刀身点.Length != 0) { 上次中心点位置 = 刀身点[0].position; } 首次记录中心点 = false; } public Vector3 获取当前中心点位置() { //IL_0018: 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_0052: 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_0042: 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) if ((Object)(object)拖尾中心点 != (Object)null) { return 拖尾中心点.position; } if (刀身点 != null && 刀身点.Length != 0) { return 刀身点[0].position; } return Vector3.zero; } public Vector3 获取上次中心点位置() { //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) return 上次中心点位置; } public float 获取当前移动距离() { //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_0069: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (首次记录中心点) { return 0f; } Vector3 position; if ((Object)(object)拖尾中心点 != (Object)null) { position = 拖尾中心点.position; } else { if (刀身点 == null || 刀身点.Length == 0) { return 0f; } position = 刀身点[0].position; } return Vector3.Distance(position, 上次中心点位置); } private void 更新当前帧位置() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (刀身点 != null && 刀身点.Length >= 2) { if (当前帧刀身点位置 == null || 当前帧刀身点位置.Length != 刀身点.Length) { 当前帧刀身点位置 = (Vector3[])(object)new Vector3[刀身点.Length]; } for (int i = 0; i < 刀身点.Length && (Object)(object)刀身点[i] != (Object)null; i++) { 当前帧刀身点位置[i] = 刀身点[i].position; } } } private void 初始化组件() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown 网格过滤器 = ((Component)this).GetComponent(); if ((Object)(object)网格过滤器 == (Object)null) { 网格过滤器 = ((Component)this).gameObject.AddComponent(); } MeshRenderer val = ((Component)this).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)this).gameObject.AddComponent(); } if ((Object)(object)刀光拖尾网格 == (Object)null) { 刀光拖尾网格 = new Mesh(); ((Object)刀光拖尾网格).name = "刀光拖尾网格"; } 网格过滤器.mesh = 刀光拖尾网格; if ((Object)(object)拖尾材质 != (Object)null && (Object)(object)((Renderer)val).sharedMaterial != (Object)(object)拖尾材质) { ((Renderer)val).sharedMaterial = 拖尾材质; } if (刀身点 == null || 刀身点.Length < 2) { Debug.LogError((object)"刀光拖尾渲染器:需要至少2个刀身点!"); } 初始化渐变(); } private float GetCurrentTime() { if (Application.isPlaying) { return Time.time; } return Time.timeSinceLevelLoad; } public void 启用() { 是否启用 = true; 上次生成时间 = GetCurrentTime(); 重置中心点记录(); } public void 禁用() { 是否启用 = false; } public void 切换启用状态() { 是否启用 = !是否启用; if (是否启用) { 上次生成时间 = GetCurrentTime(); 重置中心点记录(); } } public void 设置启用状态(bool 启用) { 是否启用 = 启用; if (是否启用) { 上次生成时间 = GetCurrentTime(); 重置中心点记录(); } } public void 立即清除拖尾() { 历史顶点列表.Clear(); if ((Object)(object)刀光拖尾网格 != (Object)null) { 刀光拖尾网格.Clear(); } 重置中心点记录(); } public void 设置使用距离触发(bool 启用) { 使用距离触发 = 启用; if (启用) { 重置中心点记录(); } } public void 切换触发模式() { 使用距离触发 = !使用距离触发; if (使用距离触发) { 重置中心点记录(); } } public bool 获取使用距离触发状态() { return 使用距离触发; } public void 设置触发移动距离(float 距离) { 触发移动距离 = Mathf.Max(0.01f, 距离); } public float 获取触发移动距离() { return 触发移动距离; } public void 设置拖尾中心点(Transform 中心点) { 拖尾中心点 = 中心点; 重置中心点记录(); } public void 设置保留当前帧(bool 保留) { 保留当前帧为永久顶点 = 保留; } public bool 获取保留当前帧状态() { return 保留当前帧为永久顶点; } public void 设置生成间隔时间(float 间隔时间) { 每次网格生成间隔时间 = Mathf.Max(0.01f, 间隔时间); } public void 设置拖尾存在时间(float 存在时间) { 每段网格存在时间 = Mathf.Max(0.1f, 存在时间); } public void 设置拖尾持续时间(float 持续时间) { 每段网格存在时间 = Mathf.Max(0.1f, 持续时间); } public void 设置每帧更新(bool 启用每帧更新) { 每帧更新 = 启用每帧更新; } public void 切换每帧更新() { 每帧更新 = !每帧更新; } public bool 获取每帧更新状态() { return 每帧更新; } public void 设置刀身点(Transform[] 新刀身点) { 刀身点 = 新刀身点; } public void 设置刀身点AtIndex(int 索引, Transform 刀身点Transform) { if (刀身点 != null && 索引 >= 0 && 索引 < 刀身点.Length) { 刀身点[索引] = 刀身点Transform; } } public void 清空历史数据() { 历史顶点列表.Clear(); 重置中心点记录(); } public void 设置拖尾材质(Material 新材质) { 拖尾材质 = 新材质; MeshRenderer component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)拖尾材质 != (Object)null) { ((Renderer)component).sharedMaterial = 拖尾材质; } } public void 设置拖尾渐变(Gradient 新渐变) { 拖尾颜色渐变 = 新渐变; } public Gradient 获取拖尾渐变() { return 拖尾颜色渐变; } public void 重置渐变() { 初始化渐变(); } public void 设置材质颜色(Color 颜色) { //IL_0048: 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_009e: Unknown result type (might be due to invalid IL or missing references) MeshRenderer component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)((Renderer)component).sharedMaterial != (Object)null) { if (((Renderer)component).sharedMaterial.HasProperty("_Color")) { ((Renderer)component).sharedMaterial.SetColor("_Color", 颜色); } else if (((Renderer)component).sharedMaterial.HasProperty("_TintColor")) { ((Renderer)component).sharedMaterial.SetColor("_TintColor", 颜色); } else if (((Renderer)component).sharedMaterial.HasProperty("_MainColor")) { ((Renderer)component).sharedMaterial.SetColor("_MainColor", 颜色); } } } public void 设置材质透明度(float 透明度) { //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) //IL_0069: 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_009a: 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) MeshRenderer component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)((Renderer)component).sharedMaterial != (Object)null) { 透明度 = Mathf.Clamp01(透明度); if (((Renderer)component).sharedMaterial.HasProperty("_Color")) { Color color = ((Renderer)component).sharedMaterial.GetColor("_Color"); color.a = 透明度; ((Renderer)component).sharedMaterial.SetColor("_Color", color); } else if (((Renderer)component).sharedMaterial.HasProperty("_TintColor")) { Color color2 = ((Renderer)component).sharedMaterial.GetColor("_TintColor"); color2.a = 透明度; ((Renderer)component).sharedMaterial.SetColor("_TintColor", color2); } } } public void 设置编辑器模式下运行(bool 运行) { 编辑器模式下运行 = 运行; } public void 重置为默认设置() { 每次网格生成间隔时间 = 0.05f; 每段网格存在时间 = 0.5f; 每帧更新 = false; 保留当前帧为永久顶点 = true; 使用距离触发 = false; 触发移动距离 = 0.1f; 初始化渐变(); 立即清除拖尾(); 重置中心点记录(); } public void 快速设置拖尾(float 持续时间, float 生成间隔 = 0.05f) { 每段网格存在时间 = Mathf.Max(0.1f, 持续时间); 每次网格生成间隔时间 = Mathf.Max(0.01f, 生成间隔); } private void 添加新顶点对() { //IL_004c: 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) if (刀身点 == null || 刀身点.Length < 2) { return; } Vector3[] array = (Vector3[])(object)new Vector3[刀身点.Length]; for (int i = 0; i < 刀身点.Length; i++) { if ((Object)(object)刀身点[i] != (Object)null) { array[i] = 刀身点[i].position; continue; } return; } 历史顶点列表.Add(new 历史顶点(array, GetCurrentTime())); } private void 移除过期顶点对() { float currentTime = GetCurrentTime(); for (int num = 历史顶点列表.Count - 1; num >= 0; num--) { if (currentTime - 历史顶点列表[num].创建时间 > 每段网格存在时间) { 历史顶点列表.RemoveAt(num); } } } private void 更新网格() { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: 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_01c8: 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_01d0: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) if (历史顶点列表.Count == 0 && 当前帧刀身点位置 == null) { 刀光拖尾网格.Clear(); return; } int num = 刀身点.Length; int count = 历史顶点列表.Count; int num2 = count; bool flag = 保留当前帧为永久顶点 && 当前帧刀身点位置 != null; if (flag) { num2++; } if (num2 < 2) { 刀光拖尾网格.Clear(); return; } Vector3[] array = (Vector3[])(object)new Vector3[num2 * num]; Vector2[] array2 = (Vector2[])(object)new Vector2[num2 * num]; Color[] array3 = (Color[])(object)new Color[num2 * num]; int[] array4 = new int[(num2 - 1) * (num - 1) * 6]; float currentTime = GetCurrentTime(); Matrix4x4 worldToLocalMatrix = ((Component)this).transform.worldToLocalMatrix; for (int i = 0; i < count; i++) { 历史顶点 历史顶点 = 历史顶点列表[i]; float num3 = currentTime - 历史顶点.创建时间; float num4 = num3 / 每段网格存在时间; for (int j = 0; j < num; j++) { int num5 = i * num + j; Vector3 val = 历史顶点.刀身点位置[j]; Vector3 val2 = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint3x4(val); array[num5] = val2; float num6 = (float)i / (float)(num2 - 1); float num7 = (float)j / (float)(num - 1); array2[num5] = new Vector2(num6, num7); array3[num5] = 拖尾颜色渐变.Evaluate(num4); } } if (flag) { int num8 = num2 - 1; for (int k = 0; k < num; k++) { int num9 = num8 * num + k; Vector3 val3 = 当前帧刀身点位置[k]; Vector3 val4 = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyPoint3x4(val3); array[num9] = val4; float num10 = 1f; float num11 = (float)k / (float)(num - 1); array2[num9] = new Vector2(num10, num11); array3[num9] = 拖尾颜色渐变.Evaluate(0f); } } int num12 = 0; for (int l = 0; l < num2 - 1; l++) { for (int m = 0; m < num - 1; m++) { int num13 = l * num + m; int num14 = l * num + m + 1; int num15 = (l + 1) * num + m; int num16 = (l + 1) * num + m + 1; array4[num12++] = num13; array4[num12++] = num15; array4[num12++] = num14; array4[num12++] = num15; array4[num12++] = num16; array4[num12++] = num14; } } 刀光拖尾网格.Clear(); 刀光拖尾网格.vertices = array; 刀光拖尾网格.triangles = array4; 刀光拖尾网格.uv = array2; 刀光拖尾网格.colors = array3; 刀光拖尾网格.RecalculateNormals(); 刀光拖尾网格.RecalculateBounds(); } private void OnDrawGizmosSelected() { //IL_004e: 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_008d: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_028a: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) if (历史顶点列表 == null) { return; } for (int i = 0; i < 历史顶点列表.Count; i++) { 历史顶点 历史顶点 = 历史顶点列表[i]; float num = 1f - (float)i / (float)历史顶点列表.Count; Gizmos.color = new Color(1f, 0.5f, 0f, num); for (int j = 0; j < 历史顶点.刀身点位置.Length; j++) { Gizmos.DrawSphere(历史顶点.刀身点位置[j], 0.03f); if (j > 0) { Gizmos.DrawLine(历史顶点.刀身点位置[j - 1], 历史顶点.刀身点位置[j]); } } if (i > 0) { 历史顶点 历史顶点2 = 历史顶点列表[i - 1]; Gizmos.color = new Color(0f, 1f, 0f, num * 0.5f); for (int k = 0; k < 历史顶点.刀身点位置.Length; k++) { Gizmos.DrawLine(历史顶点2.刀身点位置[k], 历史顶点.刀身点位置[k]); } } } if (保留当前帧为永久顶点 && 当前帧刀身点位置 != null) { Gizmos.color = Color.red; for (int l = 0; l < 当前帧刀身点位置.Length; l++) { Gizmos.DrawSphere(当前帧刀身点位置[l], 0.05f); if (l > 0) { Gizmos.DrawLine(当前帧刀身点位置[l - 1], 当前帧刀身点位置[l]); } } if (历史顶点列表.Count > 0) { 历史顶点 历史顶点3 = 历史顶点列表[历史顶点列表.Count - 1]; Gizmos.color = Color.yellow; for (int m = 0; m < 当前帧刀身点位置.Length; m++) { Gizmos.DrawLine(历史顶点3.刀身点位置[m], 当前帧刀身点位置[m]); } } } if ((Object)(object)拖尾中心点 != (Object)null) { Gizmos.color = Color.cyan; Gizmos.DrawSphere(拖尾中心点.position, 0.08f); if (刀身点 != null && 刀身点.Length != 0 && (Object)(object)刀身点[0] != (Object)null) { Gizmos.color = new Color(0f, 1f, 1f, 0.5f); Gizmos.DrawLine(拖尾中心点.position, 刀身点[0].position); } } } } public class 添加向心力 : MonoBehaviour { public Rigidbody 此刚体; private Transform 围绕物体; public Transform 力点; public float 轨道力 = 30f; public float 向心力 = 100f; private Unit 此单位; private Vector3 力方向 = Vector3.up; private bool 启动 = false; private Vector3 存储位置; private void Start() { if ((Object)(object)此刚体 == (Object)null) { 此刚体 = ((Component)this).GetComponent(); } 此单位 = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)此单位 != (Object)null && (Object)(object)此单位.data != (Object)null && (Object)(object)此单位.data.mainRig != (Object)null) { 围绕物体 = ((Component)此单位.data.mainRig).transform; } } private void Update() { //IL_003c: 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_004c: 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_0055: 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_0061: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0094: 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_00b1: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)围绕物体) && Object.op_Implicit((Object)(object)此刚体) && 启动) { Vector3 val = 围绕物体.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; 此刚体.AddForce(normalized * 向心力 * Time.deltaTime, (ForceMode)5); Vector3 val2 = ((Component)this).transform.position - 存储位置; if (((Vector3)(ref val2)).magnitude > 0.01f) { val = Vector3.Cross(力方向, val2); Vector3 normalized2 = ((Vector3)(ref val)).normalized; 此刚体.AddForceAtPosition(normalized2 * 轨道力 * Time.deltaTime, 力点.position, (ForceMode)5); } } } public void 启动旋转() { //IL_0008: 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_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) 存储位置 = ((Component)this).transform.position; 力方向 = 根据力点单位和目标单位获取旋转方向(); 启动 = true; } public void 停止旋转() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) 启动 = false; if ((Object)(object)此刚体 != (Object)null) { 此刚体.angularVelocity = Vector3.zero; } } private Vector3 根据力点单位和目标单位获取旋转方向() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_009e: 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_0042: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_00d4: 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_0101: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)此单位 == (Object)null || (Object)(object)此单位.data == (Object)null || (Object)(object)此单位.data.targetData == (Object)null) { return Vector3.up; } Vector3 val = 此单位.data.targetData.mainRig.position - 此单位.data.mainRig.position; Vector3 val2 = 力点.position - 此单位.data.mainRig.position; if (((Vector3)(ref val)).magnitude < 0.01f || ((Vector3)(ref val2)).magnitude < 0.01f) { return Vector3.up; } Vector3 val3 = Vector3.Cross(val, val2); float num = 0.01f; if (val3.y > num) { Debug.Log((object)"左侧,顺时针"); return -Vector3.up; } if (val3.y < 0f - num) { Debug.Log((object)"右侧,逆时针"); return Vector3.up; } Debug.Log((object)"在线上,使用默认方向"); return -Vector3.up; } private void OnDrawGizmosSelected() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0085: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)力点 != (Object)null && (Object)(object)围绕物体 != (Object)null) { Gizmos.color = Color.red; Gizmos.DrawWireSphere(力点.position, 0.2f); Gizmos.color = Color.blue; Gizmos.DrawLine(((Component)this).transform.position, 围绕物体.position); if (启动) { Gizmos.color = Color.green; Vector3 val = Vector3.Cross(力方向, Vector3.up); Gizmos.DrawRay(力点.position, val * 2f); } } } } public class 生成单位 : MonoBehaviour { public UnitBlueprint 生成d单位; public bool 复制自身 = true; public float 偏移 = 1f; private Team 队伍信息 = (Team)0; private void Start() { //IL_0020: 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) Unit component = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)component != (Object)null) { 队伍信息 = component.Team; if (复制自身) { 生成d单位 = component.unitBlueprint; } } } public void 随机生成在左右() { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005d: 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) //IL_0065: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00eb: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0, 1); if ((double)num > 0.5) { Vector3 val = -((Component)this).transform.right * 偏移; Vector3 val2 = ((Component)this).transform.position + new Vector3(0f, 0f, val.z); 生成d单位.Spawn(val2, Quaternion.identity, 队伍信息, 1f, (UnitPoolInfo?)null); } if ((double)num <= 0.5) { Vector3 val3 = ((Component)this).transform.right * 偏移; Vector3 val4 = ((Component)this).transform.position + new Vector3(0f, 0f, val3.z); 生成d单位.Spawn(val4, Quaternion.identity, 队伍信息, 1f, (UnitPoolInfo?)null); } } } internal class 碰撞事件22 : MonoBehaviour { [SerializeField] public float 碰撞伤害 = 400f; [SerializeField] public float 伤害冷却时间 = 0.1f; [SerializeField] private LayerMask 目标层 = LayerMask.op_Implicit(16385); public bool 开启持续检测 = false; public UnityEvent 碰撞事件; private Unit 当前单位; private Team 当前队伍; private bool 是否启用 = false; private Dictionary 上次伤害时间 = new Dictionary(); private void Start() { //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) 当前单位 = ((Component)this).GetComponentInParent(); if ((Object)(object)当前单位 == (Object)null) { TeamHolder componentInParent = ((Component)this).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { 当前队伍 = ((Component)this).GetComponentInParent().team; } else { 当前队伍 = (Team)0; } } else { 当前队伍 = 当前单位.data.team; } } private void OnTriggerEnter(Collider other) { if (是否启用 && IsInTargetLayer(((Component)other).gameObject)) { 尝试造成伤害(other); } } private void OnTriggerStay(Collider other) { if (开启持续检测 && 是否启用 && IsInTargetLayer(((Component)other).gameObject)) { 尝试造成伤害(other); } } public void 设置启用(bool s = true) { 是否启用 = s; } private bool IsInTargetLayer(GameObject obj) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return ((1 << obj.layer) & LayerMask.op_Implicit(目标层)) != 0; } private void 尝试造成伤害(Collider other) { //IL_0012: 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_008e: Unknown result type (might be due to invalid IL or missing references) DataHandler componentInParent = ((Component)other).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && componentInParent.team != 当前队伍 && !componentInParent.Dead) { UnityEvent obj = 碰撞事件; if (obj != null) { obj.Invoke(); } if (!上次伤害时间.TryGetValue(other, out var value) || !(Time.time - value < 伤害冷却时间)) { ((Damagable)componentInParent.healthHandler).TakeDamage(碰撞伤害, ((Component)other).transform.position, (Unit)null, (DamageType)0); Debug.Log((object)$"对 {((Object)((Component)other).gameObject).name} 造成了 {碰撞伤害} 点伤害"); 上次伤害时间[other] = Time.time; } } } private void OnTriggerExit(Collider other) { 上次伤害时间.Remove(other); } } public class 离开父级211 : MonoBehaviour { private GameObject 原父级; private void Start() { Transform parent = ((Component)this).transform.parent; 原父级 = ((parent != null) ? ((Component)parent).gameObject : null); ((Component)this).transform.SetParent((Transform)null); if ((Object)(object)原父级 != (Object)null) { 父级销毁监听器 父级销毁监听器2 = 原父级.AddComponent<父级销毁监听器>(); 父级销毁监听器2.初始化(this); } } public void 父级被销毁() { Object.Destroy((Object)(object)((Component)this).gameObject); } } public class 父级销毁监听器 : MonoBehaviour { private 离开父级211 目标脚本; public void 初始化(离开父级211 脚本) { 目标脚本 = 脚本; } private void OnDestroy() { if ((Object)(object)目标脚本 != (Object)null) { 目标脚本.父级被销毁(); } } } public class 前往unit父级 : MonoBehaviour { private void Start() { ((Component)this).transform.SetParent(((Component)this).transform.root); } } } namespace HeMoDingDingMod.unity脚本.脚本1 { [ExecuteInEditMode] [RequireComponent(typeof(Camera))] public class 流动雾后处理 : MonoBehaviour { public enum FogShape { Cube, Sphere, Cylinder } [Serializable] public class FogVolume { public string volumeName = "New Fog Volume"; public FogShape shape = FogShape.Cube; public Transform volumeTransform; public Vector3 size = Vector3.one; public Color fogColor = Color.white; [Range(0f, 1f)] public float density = 0.1f; [Range(0f, 1f)] public float edgeSoftness = 0.2f; public bool useLighting = true; public float lightIntensity = 1f; [Range(0f, 10f)] public int priority = 0; } public Material fogMaterial; [Header("Global Fog Settings")] public Color globalFogColor = Color.gray; [Range(0f, 0.1f)] public float globalFogDensity = 0.01f; [Header("Local Fog Volumes")] public List fogVolumes = new List(); [Header("Quality")] [Range(16f, 256f)] public int maxStepCount = 64; public bool enableNoise = true; [Header("Anti-Aliasing")] [Range(0f, 2f)] public float jitterStrength = 1f; [Range(1f, 3f)] public int sampleCount = 2; [Header("Skybox Fix")] public float skyboxMaxDistance = 99f; [Range(0.5f, 2f)] public float skyboxFogIntensity = 0.95f; [Header("Debug")] public bool showVolumeBounds = true; public Color gizmoColor = new Color(1f, 1f, 1f, 0.3f); private Camera cam; private MaterialPropertyBlock propertyBlock; private void Start() { //IL_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown cam = ((Component)this).GetComponent(); Camera obj = cam; obj.depthTextureMode = (DepthTextureMode)(obj.depthTextureMode | 1); propertyBlock = new MaterialPropertyBlock(); } private void OnEnable() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) cam = ((Component)this).GetComponent(); if ((Object)(object)cam != (Object)null) { Camera obj = cam; obj.depthTextureMode = (DepthTextureMode)(obj.depthTextureMode | 1); } } private void OnDrawGizmos() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00dd: 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_00ec: 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_010d: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_019d: Unknown result type (might be due to invalid IL or missing references) if (!showVolumeBounds) { return; } foreach (FogVolume fogVolume in fogVolumes) { if (!((Object)(object)fogVolume.volumeTransform == (Object)null)) { Gizmos.color = new Color(fogVolume.fogColor.r, fogVolume.fogColor.g, fogVolume.fogColor.b, gizmoColor.a); Matrix4x4 matrix = Gizmos.matrix; switch (fogVolume.shape) { case FogShape.Cube: Gizmos.matrix = Matrix4x4.TRS(fogVolume.volumeTransform.position, fogVolume.volumeTransform.rotation, fogVolume.size); Gizmos.DrawWireCube(Vector3.zero, Vector3.one); Gizmos.DrawCube(Vector3.zero, Vector3.one * 0.1f); break; case FogShape.Sphere: Gizmos.matrix = Matrix4x4.TRS(fogVolume.volumeTransform.position, fogVolume.volumeTransform.rotation, fogVolume.size); Gizmos.DrawWireSphere(Vector3.zero, 0.5f); Gizmos.DrawSphere(Vector3.zero, 0.05f); break; case FogShape.Cylinder: { Gizmos.matrix = Matrix4x4.TRS(fogVolume.volumeTransform.position, fogVolume.volumeTransform.rotation, Vector3.one); float radius = fogVolume.size.x * 0.5f; float y = fogVolume.size.y; DrawWireCylinder(Vector3.zero, radius, y); break; } } Gizmos.matrix = matrix; } } } private void DrawWireCylinder(Vector3 center, float radius, float height) { //IL_000c: 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_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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0025: 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_002f: 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_00d0: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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) float num = height * 0.5f; int num2 = 16; Vector3 val = center + Vector3.up * num; Vector3 val2 = center - Vector3.up * num; Vector3 val3 = default(Vector3); Vector3 val4 = default(Vector3); Vector3 val5 = default(Vector3); Vector3 val6 = default(Vector3); for (int i = 0; i < num2; i++) { float num3 = (float)i / (float)num2 * (float)Math.PI * 2f; float num4 = (float)((i + 1) % num2) / (float)num2 * (float)Math.PI * 2f; ((Vector3)(ref val3))..ctor(Mathf.Cos(num3) * radius, num, Mathf.Sin(num3) * radius); ((Vector3)(ref val4))..ctor(Mathf.Cos(num4) * radius, num, Mathf.Sin(num4) * radius); ((Vector3)(ref val5))..ctor(Mathf.Cos(num3) * radius, 0f - num, Mathf.Sin(num3) * radius); ((Vector3)(ref val6))..ctor(Mathf.Cos(num4) * radius, 0f - num, Mathf.Sin(num4) * radius); Gizmos.DrawLine(center + val3, center + val4); Gizmos.DrawLine(center + val5, center + val6); Gizmos.DrawLine(center + val3, center + val5); } } private void OnRenderImage(RenderTexture source, RenderTexture destination) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fogMaterial == (Object)null || fogVolumes == null) { Graphics.Blit((Texture)(object)source, destination); return; } Vector4[] array = (Vector4[])(object)new Vector4[8]; Vector4[] array2 = (Vector4[])(object)new Vector4[8]; Vector4[] array3 = (Vector4[])(object)new Vector4[8]; Vector4[] array4 = (Vector4[])(object)new Vector4[8]; int num = 0; for (int i = 0; i < fogVolumes.Count && i < 8; i++) { FogVolume fogVolume = fogVolumes[i]; if (!((Object)(object)fogVolume.volumeTransform == (Object)null)) { array[num] = Vector4.op_Implicit(fogVolume.volumeTransform.position); float num2 = (float)fogVolume.shape; array2[num] = new Vector4(fogVolume.size.x, fogVolume.size.y, fogVolume.size.z, num2); array3[num] = Color.op_Implicit(fogVolume.fogColor); array4[num] = new Vector4(fogVolume.density, fogVolume.edgeSoftness, (float)fogVolume.priority, (float)(fogVolume.useLighting ? 1 : 0)); num++; } } fogMaterial.SetInt("_VolumeCount", num); if (num > 0) { fogMaterial.SetVectorArray("_VolumePositions", array); fogMaterial.SetVectorArray("_VolumeSizes", array2); fogMaterial.SetVectorArray("_VolumeColors", array3); fogMaterial.SetVectorArray("_VolumeParams", array4); } fogMaterial.SetColor("_GlobalFogColor", globalFogColor); fogMaterial.SetFloat("_GlobalFogDensity", globalFogDensity); fogMaterial.SetInt("_MaxStepCount", maxStepCount); fogMaterial.SetFloat("_EnableNoise", (float)(enableNoise ? 1 : 0)); fogMaterial.SetFloat("_JitterStrength", jitterStrength); fogMaterial.SetInt("_SampleCount", sampleCount); fogMaterial.SetFloat("_SkyboxMaxDistance", skyboxMaxDistance); fogMaterial.SetFloat("_SkyboxFogIntensity", skyboxFogIntensity); if ((Object)(object)cam != (Object)null) { Material obj = fogMaterial; Matrix4x4 val = cam.projectionMatrix * cam.worldToCameraMatrix; obj.SetMatrix("_ViewProjectionInverse", ((Matrix4x4)(ref val)).inverse); } Graphics.Blit((Texture)(object)source, destination, fogMaterial); } } public class 体积雾脚本添加 : MonoBehaviour { public Camera 目标摄像机; private 流动雾后处理 目标脚本; private void Start() { if ((Object)(object)目标摄像机 == (Object)null) { 目标摄像机 = Camera.main; } 流动雾后处理 component = ((Component)this).GetComponent<流动雾后处理>(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)"当前物体上没有找到流动雾后处理脚本!"); return; } 目标脚本 = ((Component)目标摄像机).GetComponent<流动雾后处理>(); if ((Object)(object)目标脚本 == (Object)null) { 目标脚本 = ((Component)目标摄像机).gameObject.AddComponent<流动雾后处理>(); Debug.Log((object)("成功添加流动雾后处理脚本到 " + ((Object)目标摄像机).name)); } FieldInfo[] fields = typeof(流动雾后处理).GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(目标脚本, fieldInfo.GetValue(component)); } Hmdd模组管理器.Instance.添加体积雾列表(component, this); Debug.Log((object)("成功复制所有流动雾参数到 " + ((Object)目标摄像机).name)); } private void OnDestroy() { Hmdd模组管理器.Instance.删除体积雾列表(((Component)this).GetComponent<流动雾后处理>(), this); } } [Serializable] public class 体积雾数据 { public 流动雾后处理 流动雾脚本; public 体积雾脚本添加 添加脚本; public 体积雾数据(流动雾后处理 流动雾, 体积雾脚本添加 添加) { 流动雾脚本 = 流动雾; 添加脚本 = 添加; } } public class Hmdd模组管理器 : MonoBehaviour { [CompilerGenerated] private sealed class <平滑淡出协程>d__9 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public 流动雾后处理 雾脚本; public Hmdd模组管理器 <>4__this; private float <淡出持续时间>5__1; private float <起始密度>5__2; private float <结束密度>5__3; private float <已过时间>5__4; private float 5__5; private float 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <平滑淡出协程>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <淡出持续时间>5__1 = 1f; <起始密度>5__2 = 雾脚本.globalFogDensity; <结束密度>5__3 = 0f; <已过时间>5__4 = 0f; Debug.Log((object)$"开始淡出体积雾,起始密度:{<起始密度>5__2},持续时间:{<淡出持续时间>5__1}秒"); break; case 1: <>1__state = -1; break; } if (<已过时间>5__4 < <淡出持续时间>5__1) { <已过时间>5__4 += Time.deltaTime; 5__5 = <已过时间>5__4 / <淡出持续时间>5__1; 5__6 = Mathf.SmoothStep(0f, 1f, 5__5); 雾脚本.globalFogDensity = Mathf.Lerp(<起始密度>5__2, <结束密度>5__3, 5__6); <>2__current = null; <>1__state = 1; return true; } 雾脚本.globalFogDensity = 0f; Debug.Log((object)"淡出完成,准备移除主摄像机体积雾脚本"); <>4__this.移除主摄像机体积雾脚本(); <>4__this._currentFadeCoroutine = 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(); } } private static Hmdd模组管理器 _instance; private static object _lock = new object(); public List<体积雾数据> 体积雾列表 = new List<体积雾数据>(); private Coroutine _currentFadeCoroutine; public static Hmdd模组管理器 Instance { get { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown lock (_lock) { if ((Object)(object)_instance == (Object)null) { _instance = Object.FindObjectOfType(); if ((Object)(object)_instance == (Object)null) { GameObject val = new GameObject("黑莫丁丁的模组管理器"); _instance = val.AddComponent(); Object.DontDestroyOnLoad((Object)(object)val); } } return _instance; } } } public void 添加体积雾列表(流动雾后处理 流动雾脚本, 体积雾脚本添加 添加脚本) { if (!体积雾列表.Exists((体积雾数据 item) => (Object)(object)item.添加脚本 == (Object)(object)添加脚本)) { 体积雾列表.Add(new 体积雾数据(流动雾脚本, 添加脚本)); Debug.Log((object)$"添加体积雾到管理器,当前列表数量:{体积雾列表.Count}"); if (_currentFadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_currentFadeCoroutine); _currentFadeCoroutine = null; } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { 流动雾后处理 component = ((Component)main).GetComponent<流动雾后处理>(); if ((Object)(object)component != (Object)null) { component.globalFogDensity = component.globalFogDensity; } } } else { Debug.LogWarning((object)"该体积雾脚本已经在管理器中!"); } } public void 删除体积雾列表(流动雾后处理 流动雾脚本, 体积雾脚本添加 添加脚本) { 体积雾数据 体积雾数据2 = 体积雾列表.Find((体积雾数据 x) => (Object)(object)x.添加脚本 == (Object)(object)添加脚本); if (体积雾数据2 != null) { 体积雾列表.Remove(体积雾数据2); Debug.Log((object)$"删除体积雾从管理器,当前列表数量:{体积雾列表.Count}"); if (体积雾列表.Count == 0) { 开始平滑淡出体积雾(); } } else { Debug.LogWarning((object)"在管理器中未找到要删除的体积雾脚本"); } } private void 开始平滑淡出体积雾() { Camera main = Camera.main; if (!((Object)(object)main != (Object)null)) { return; } 流动雾后处理 component = ((Component)main).GetComponent<流动雾后处理>(); if ((Object)(object)component != (Object)null) { if (_currentFadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_currentFadeCoroutine); } _currentFadeCoroutine = ((MonoBehaviour)this).StartCoroutine(平滑淡出协程(component)); } else { Debug.LogWarning((object)"主摄像机上未找到流动雾后处理脚本"); } } [IteratorStateMachine(typeof(<平滑淡出协程>d__9))] private IEnumerator 平滑淡出协程(流动雾后处理 雾脚本) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <平滑淡出协程>d__9(0) { <>4__this = this, 雾脚本 = 雾脚本 }; } private void 移除主摄像机体积雾脚本() { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { 流动雾后处理 component = ((Component)main).GetComponent<流动雾后处理>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); Debug.Log((object)"所有体积雾已删除,已移除主摄像机上的流动雾后处理脚本"); } } } public void 清空所有体积雾() { if (体积雾列表.Count > 0) { 体积雾列表.Clear(); 开始平滑淡出体积雾(); Debug.Log((object)"已清空所有体积雾,开始淡出效果"); } } public void 立即清空所有体积雾() { if (_currentFadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_currentFadeCoroutine); _currentFadeCoroutine = null; } 体积雾列表.Clear(); 移除主摄像机体积雾脚本(); Debug.Log((object)"已立即清空所有体积雾并移除主摄像机脚本"); } public int 获取体积雾数量() { return 体积雾列表.Count; } public bool 包含体积雾(体积雾脚本添加 添加脚本) { return 体积雾列表.Exists((体积雾数据 item) => (Object)(object)item.添加脚本 == (Object)(object)添加脚本); } public List<流动雾后处理> 获取所有流动雾脚本() { List<流动雾后处理> list = new List<流动雾后处理>(); foreach (体积雾数据 item in 体积雾列表) { list.Add(item.流动雾脚本); } return list; } public void 设置淡出持续时间(float 持续时间) { Debug.Log((object)$"淡出持续时间设置为:{持续时间}秒"); } private void OnDestroy() { if (_currentFadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_currentFadeCoroutine); } 立即清空所有体积雾(); } } } namespace HeMoDingDingMod.unity脚本.检测相关类.基类 { public class 地面检测实例化物体 : MonoBehaviour { public bool 允许旋转 = true; public Vector3 获取地面位置(Vector3 测试位置, float 检测高度 = 10f, int 地面层级 = 512) { //IL_0003: 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_0011: 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) //IL_0025: 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_0049: 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_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(测试位置.x, 测试位置.y + 检测高度, 测试位置.z); float num = 检测高度 * 3f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, num, 地面层级)) { return ((RaycastHit)(ref val2)).point; } return new Vector3(测试位置.x, 测试位置.y - 检测高度 * 0.5f, 测试位置.z); } public void 实例化物体(GameObject obj) { //IL_0009: 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_001d: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) GameObject val = Object.Instantiate(obj, 获取地面位置(((Component)this).transform.position), Quaternion.identity); if (允许旋转) { Transform transform = val.transform; transform.rotation *= Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f); } TeamHolder.AddTeamHolder(val, ((Component)this).gameObject); } public void 实例化物体2(GameObject obj, Vector3 位置) { //IL_0003: 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_0013: 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_0040: 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) GameObject val = Object.Instantiate(obj, 获取地面位置(位置), Quaternion.identity); if (允许旋转) { Transform transform = val.transform; transform.rotation *= Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f); } TeamHolder.AddTeamHolder(val, ((Component)this).gameObject); } } public class 碰撞检测获取单位基类定制版本 : MonoBehaviour { public enum 施加方式 { 对敌方, 全部, 对自己和对于, 仅自己 } public enum 检测方式 { 物体, 单位 } public enum 检测形状类型 { 球形, 盒形 } public UnitEffectBase 效果设置; [Header("检测形状设置")] public 检测形状类型 检测形状 = 检测形状类型.球形; [Header("球形检测参数")] public float 检测半径 = 6f; [Header("盒状检测参数")] public Vector3 检测范围 = new Vector3(3f, 2f, 3f); public bool 跟随物体旋转 = false; [Header("其他设置")] public LayerMask 检测层; private Unit 存储单位; public 施加方式 效果施加对应 = 施加方式.对敌方; private Team 队伍信息; public 检测方式 sss = 检测方式.单位; protected virtual void Start() { //IL_0027: 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) //IL_0047: 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) if (sss == 检测方式.单位) { 存储单位 = ((Component)this).GetComponentInParent(); 队伍信息 = 存储单位.data.team; } if (sss == 检测方式.物体) { 队伍信息 = ((Component)this).GetComponentInParent().team; } Debug.Log((object)"碰撞检测获取单位基类定制版本:完成初始化"); } public void 开始检测() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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) Collider[] array = 执行形状检测(); if (array == null || array.Length == 0) { Debug.Log((object)"未检测到任何单位!!"); 完成所有检测(存储单位, null); return; } List list = new List(); for (int i = 0; i < array.Length; i++) { Unit component = ((Component)((Component)array[i]).transform.root).GetComponent(); if ((Object)(object)component == (Object)null) { Debug.Log((object)"检测层没有unit组件"); } else { if (component.data.Dead) { continue; } bool flag = false; switch (效果施加对应) { case 施加方式.对敌方: flag = component.data.team != 队伍信息; break; case 施加方式.全部: flag = true; break; case 施加方式.对自己和对于: flag = component.data.team == 队伍信息; break; case 施加方式.仅自己: { Unit componentInParent = ((Component)this).GetComponentInParent(); flag = (Object)(object)component == (Object)(object)componentInParent; break; } } if (!flag) { continue; } list.Add(component); if (Object.op_Implicit((Object)(object)效果设置)) { UnitEffectBase val = UnitEffectBase.AddEffectToTarget(((Component)((Component)array[i]).transform).gameObject, 效果设置); if ((Object)(object)val == (Object)null) { val = Object.Instantiate(效果设置, ((Component)array[i]).transform); ((Component)val).transform.SetPositionAndRotation(((Component)array[i]).transform.position, Quaternion.identity); TeamHolder.AddTeamHolder(((Component)val).gameObject, ((Component)this).gameObject); val.DoEffect(); } else { val.Ping(); } 完成单次检测(val, 存储单位, component, ((Component)((Component)this).transform).gameObject); } else { 完成单次检测(null, 存储单位, component, ((Component)((Component)this).transform).gameObject); } } } 完成所有检测(存储单位, list.ToArray()); } private Collider[] 执行形状检测() { //IL_001e: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0051: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0093: 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_0079: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) switch (检测形状) { case 检测形状类型.球形: return Physics.OverlapSphere(((Component)this).transform.position, 检测半径, LayerMask.op_Implicit(检测层)); case 检测形状类型.盒形: { Vector3 position = ((Component)this).transform.position; Quaternion val = Quaternion.identity; if (跟随物体旋转) { val = Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f); } return Physics.OverlapBox(position, 检测范围 * 0.5f, val, LayerMask.op_Implicit(检测层)); } default: return Physics.OverlapSphere(((Component)this).transform.position, 检测半径, LayerMask.op_Implicit(检测层)); } } public virtual void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { } public virtual void 完成所有检测(Unit 召唤者, Unit[] 受影响者) { } private void OnDrawGizmos() { //IL_0027: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_008c: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_00fa: 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_0149: Unknown result type (might be due to invalid IL or missing references) if (!((Behaviour)this).enabled) { return; } Gizmos.color = new Color(0f, 1f, 0f, 0.3f); switch (检测形状) { case 检测形状类型.球形: Gizmos.DrawSphere(((Component)this).transform.position, 检测半径); Gizmos.color = Color.green; Gizmos.DrawWireSphere(((Component)this).transform.position, 检测半径); break; case 检测形状类型.盒形: { Matrix4x4 matrix = Gizmos.matrix; if (跟随物体旋转 && Application.isPlaying) { Gizmos.matrix = Matrix4x4.TRS(((Component)this).transform.position, Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f), Vector3.one); Gizmos.DrawCube(Vector3.zero, 检测范围); Gizmos.color = Color.green; Gizmos.DrawWireCube(Vector3.zero, 检测范围); } else { Gizmos.DrawCube(((Component)this).transform.position, 检测范围); Gizmos.color = Color.green; Gizmos.DrawWireCube(((Component)this).transform.position, 检测范围); } Gizmos.matrix = matrix; break; } } } } public class 检测目标并操作父类 : MonoBehaviour { public enum 单位检测逻辑 { 召唤物, 技能 } private Unit 此单位; public 单位检测逻辑 获取方式 = 单位检测逻辑.技能; protected virtual void Start() { if (获取方式 == 单位检测逻辑.技能) { 此单位 = ((Component)((Component)this).transform.root).GetComponent(); if ((Object)(object)此单位 == (Object)null) { Debug.LogError((object)("检测目标并操作父类: 在 " + ((Object)((Component)this).transform.root).name + " 上未找到 Unit 组件")); return; } } if (获取方式 == 单位检测逻辑.召唤物) { TeamHolder component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { 此单位 = component.spawner.GetComponent(); } if ((Object)(object)此单位 == (Object)null) { Debug.LogError((object)"未找到 Unit 组件"); } } } public void 进行目标检测() { if ((Object)(object)此单位 == (Object)null) { Debug.LogError((object)"检测目标并操作父类: 此单位未初始化"); return; } DataHandler data = 此单位.data; if ((Object)(object)data == (Object)null) { Debug.LogError((object)("检测目标并操作父类: " + ((Object)此单位).name + " 的 data 为空")); return; } DataHandler targetData = data.targetData; 检测操作逻辑(此单位, data, targetData); } public virtual void 检测操作逻辑(Unit 此单位, DataHandler 此单位数据, DataHandler 目标单位数据) { if ((Object)(object)此单位 == (Object)null || (Object)(object)此单位数据 == (Object)null) { Debug.LogError((object)"检测目标并操作父类: 检测操作逻辑参数无效"); } } } public class 触发器碰撞伤害基类 : MonoBehaviour { public float 碰撞伤害 = 400f; public float 伤害冷却时间 = 0.1f; public LayerMask 目标层 = LayerMask.op_Implicit(16385); public UnityEvent 检测到进入碰撞体事件; private Unit 当前单位; private Team 当前队伍; private Dictionary 上次伤害时间 = new Dictionary(); private void Start() { //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) 当前单位 = ((Component)this).GetComponentInParent(); if ((Object)(object)当前单位 == (Object)null) { TeamHolder componentInParent = ((Component)this).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { 当前队伍 = ((Component)this).GetComponentInParent().team; } else { 当前队伍 = (Team)0; } } else { 当前队伍 = 当前单位.data.team; } } private void OnTriggerEnter(Collider other) { if (IsInTargetLayer(((Component)other).gameObject)) { UnityEvent obj = 检测到进入碰撞体事件; if (obj != null) { obj.Invoke(); } 尝试造成伤害(other); } } private void OnTriggerStay(Collider other) { if (IsInTargetLayer(((Component)other).gameObject)) { 尝试造成伤害(other); } } private bool IsInTargetLayer(GameObject obj) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return ((1 << obj.layer) & LayerMask.op_Implicit(目标层)) != 0; } private void 尝试造成伤害(Collider other) { //IL_0012: 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_0076: Unknown result type (might be due to invalid IL or missing references) DataHandler componentInParent = ((Component)other).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && componentInParent.team != 当前队伍 && !componentInParent.Dead && (!上次伤害时间.TryGetValue(other, out var value) || !(Time.time - value < 伤害冷却时间))) { ((Damagable)componentInParent.healthHandler).TakeDamage(碰撞伤害, ((Component)other).transform.position, (Unit)null, (DamageType)0); 碰撞逻辑(other, componentInParent, 当前单位); 上次伤害时间[other] = Time.time; } } private void OnTriggerExit(Collider other) { 上次伤害时间.Remove(other); } protected virtual void 碰撞逻辑(Collider other, DataHandler 目标单位, Unit 这个单位) { } } public class 碰撞检测获取单位基类 : MonoBehaviour { public enum 施加方式 { 对敌方, 全部, 对自己和对于, 仅自己 } public enum 检测方式 { 物体, 单位 } public UnitEffectBase 效果设置; public float 检测半径 = 6f; public LayerMask 检测层; private Unit 存储单位; public 施加方式 效果施加对应 = 施加方式.对敌方; private Team 队伍信息; public 检测方式 sss = 检测方式.单位; protected virtual void Start() { //IL_0027: 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) //IL_0047: 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) if (sss == 检测方式.单位) { 存储单位 = ((Component)this).GetComponentInParent(); 队伍信息 = 存储单位.data.team; } if (sss == 检测方式.物体) { 队伍信息 = ((Component)this).GetComponentInParent().team; } } public void 开始检测() { //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_00b1: 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_00d1: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 检测半径, LayerMask.op_Implicit(检测层)); if (array.Length == 0) { 完成所有检测(存储单位, null); return; } List list = new List(); for (int i = 0; i < array.Length; i++) { Unit componentInParent = ((Component)array[i]).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || componentInParent.data.Dead) { continue; } bool flag = false; switch (效果施加对应) { case 施加方式.对敌方: flag = componentInParent.data.team != 队伍信息; break; case 施加方式.全部: flag = true; break; case 施加方式.对自己和对于: flag = componentInParent.data.team == 队伍信息; break; case 施加方式.仅自己: { Unit componentInParent2 = ((Component)this).GetComponentInParent(); flag = (Object)(object)componentInParent == (Object)(object)componentInParent2; break; } } if (!flag) { continue; } list.Add(componentInParent); if (Object.op_Implicit((Object)(object)效果设置)) { UnitEffectBase val = UnitEffectBase.AddEffectToTarget(((Component)((Component)array[i]).transform).gameObject, 效果设置); if ((Object)(object)val == (Object)null) { val = Object.Instantiate(效果设置, ((Component)array[i]).transform); ((Component)val).transform.SetPositionAndRotation(((Component)array[i]).transform.position, Quaternion.identity); TeamHolder.AddTeamHolder(((Component)val).gameObject, ((Component)this).gameObject); val.DoEffect(); } else { val.Ping(); } 完成单次检测(val, 存储单位, componentInParent, ((Component)((Component)this).transform).gameObject); } else { 完成单次检测(null, 存储单位, componentInParent, ((Component)((Component)this).transform).gameObject); } } 完成所有检测(存储单位, list.ToArray()); } public virtual void 完成单次检测(UnitEffectBase 效果实例, Unit 召唤者, Unit 受影响者, GameObject 召唤物体) { } public virtual void 完成所有检测(Unit 召唤者, Unit[] 受影响者) { } private void OnDrawGizmos() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = new Color(0f, 1f, 0f, 0.3f); Gizmos.DrawSphere(((Component)this).transform.position, 检测半径); Gizmos.color = Color.green; Gizmos.DrawWireSphere(((Component)this).transform.position, 检测半径); } } } namespace HeMoDingDingMod.unity脚本.新版动画机 { public class 动画播放器1322121 : MonoBehaviour { [Header("动画组件设置")] [Tooltip("如果为空,会自动查找组件")] public Animator 动画控制器; [Tooltip("如果使用Animation组件,请在此赋值")] public Animation 旧版动画; [Header("默认动画设置")] [Tooltip("默认进入时播放的动画名")] public string 默认动画名; [Tooltip("是否在开始时播放默认动画")] public bool 启动时播放默认动画 = true; private void Start() { if ((Object)(object)动画控制器 == (Object)null) { 动画控制器 = ((Component)this).GetComponent(); } if ((Object)(object)旧版动画 == (Object)null) { 旧版动画 = ((Component)this).GetComponent(); } if (启动时播放默认动画 && !string.IsNullOrEmpty(默认动画名)) { 播放(默认动画名); } } public void 播放(string 动画名称) { if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.Play(动画名称, 0, 0f); Debug.Log((object)("播放动画 (Animator): " + 动画名称)); } else if ((Object)(object)旧版动画 != (Object)null) { 旧版动画.Stop(动画名称); 旧版动画.Play(动画名称); Debug.Log((object)("播放动画 (Animation): " + 动画名称)); } else { Debug.LogWarning((object)("未找到任何动画组件,无法播放动画: " + 动画名称)); } } public void 立即播放(string 动画名称, int 过渡层 = 0, float 开始时间归一化 = 0f) { if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.Play(动画名称, 过渡层, 开始时间归一化); Debug.Log((object)("立即播放动画 (Animator): " + 动画名称)); } else if ((Object)(object)旧版动画 != (Object)null) { 旧版动画.Play(动画名称, (PlayMode)4); Debug.Log((object)("立即播放动画 (Animation): " + 动画名称)); } else { Debug.LogWarning((object)("未找到任何动画组件,无法立即播放: " + 动画名称)); } } public void 淡入播放(string 动画名称, float 过渡时间 = 0.3f) { if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.CrossFade(动画名称, 过渡时间); Debug.Log((object)("淡入播放动画 (Animator): " + 动画名称)); } else if ((Object)(object)旧版动画 != (Object)null) { 旧版动画.CrossFade(动画名称, 过渡时间); Debug.Log((object)("淡入播放动画 (Animation): " + 动画名称)); } else { Debug.LogWarning((object)("未找到任何动画组件,无法淡入播放: " + 动画名称)); } } public void 暂停() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.speed = 0f; Debug.Log((object)"动画已暂停 (Animator)"); } else { if (!((Object)(object)旧版动画 != (Object)null)) { return; } foreach (AnimationState item in 旧版动画) { AnimationState val = item; val.speed = 0f; } Debug.Log((object)"动画已暂停 (Animation)"); } } public void 继续() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.speed = 1f; Debug.Log((object)"动画已继续 (Animator)"); } else { if (!((Object)(object)旧版动画 != (Object)null)) { return; } foreach (AnimationState item in 旧版动画) { AnimationState val = item; val.speed = 1f; } Debug.Log((object)"动画已继续 (Animation)"); } } public void 停止() { if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.StopPlayback(); Debug.Log((object)"动画已停止 (Animator)"); } else if ((Object)(object)旧版动画 != (Object)null) { 旧版动画.Stop(); Debug.Log((object)"动画已停止 (Animation)"); } } public void 设置速度(float 速度倍率) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.speed = 速度倍率; Debug.Log((object)$"设置动画速度: {速度倍率}x (Animator)"); } else { if (!((Object)(object)旧版动画 != (Object)null)) { return; } foreach (AnimationState item in 旧版动画) { AnimationState val = item; val.speed = 速度倍率; } Debug.Log((object)$"设置动画速度: {速度倍率}x (Animation)"); } } public void 设置布尔(string 参数名, bool 值) { if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.SetBool(参数名, 值); Debug.Log((object)$"设置布尔参数: {参数名} = {值}"); } else { Debug.LogWarning((object)"Animator组件不存在,无法设置布尔参数"); } } public void 触发(string 参数名) { if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.SetTrigger(参数名); Debug.Log((object)("触发参数: " + 参数名)); } else { Debug.LogWarning((object)"Animator组件不存在,无法触发"); } } public void 设置整数(string 参数名, int 值) { if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.SetInteger(参数名, 值); Debug.Log((object)$"设置整数参数: {参数名} = {值}"); } else { Debug.LogWarning((object)"Animator组件不存在,无法设置整数参数"); } } public void 设置浮点(string 参数名, float 值) { if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.SetFloat(参数名, 值); Debug.Log((object)$"设置浮点参数: {参数名} = {值}"); } else { Debug.LogWarning((object)"Animator组件不存在,无法设置浮点参数"); } } public void 重置触发器(string 参数名) { if ((Object)(object)动画控制器 != (Object)null) { 动画控制器.ResetTrigger(参数名); Debug.Log((object)("重置触发器: " + 参数名)); } else { Debug.LogWarning((object)"Animator组件不存在,无法重置触发器"); } } public bool 是否在播放(string 动画名称) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)动画控制器 != (Object)null) { AnimatorStateInfo currentAnimatorStateInfo = 动画控制器.GetCurrentAnimatorStateInfo(0); return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName(动画名称); } if ((Object)(object)旧版动画 != (Object)null) { return 旧版动画.IsPlaying(动画名称); } return false; } } public class 角色动画跟随工具 : MonoBehaviour { [Serializable] private struct Pose { public Vector3 position; public Quaternion rotation; public Pose(Vector3 pos, Quaternion rot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_000a: Unknown result type (might be due to invalid IL or missing references) position = pos; rotation = rot; } } private class 骨骼映射 { public Transform 身体骨骼; public Transform 动画骨骼; public Vector3 初始位置偏移; public Quaternion 初始旋转偏移; public 骨骼映射(Transform body, Transform anim) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0047: 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_0052: 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_005c: Unknown result type (might be due to invalid IL or missing references) 身体骨骼 = body; 动画骨骼 = anim; if ((Object)(object)body != (Object)null && (Object)(object)anim != (Object)null) { 初始位置偏移 = body.position - anim.position; 初始旋转偏移 = Quaternion.Inverse(anim.rotation) * body.rotation; } } public void 更新跟随(float 位置速度, float 旋转速度, bool 平滑) { //IL_002d: 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_003d: 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_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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_0067: 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_0074: 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_0098: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)身体骨骼 == (Object)null) && !((Object)(object)动画骨骼 == (Object)null)) { Vector3 val = 动画骨骼.position + 初始位置偏移; Quaternion val2 = 动画骨骼.rotation * 初始旋转偏移; if (平滑) { 身体骨骼.position = Vector3.Lerp(身体骨骼.position, val, 位置速度 * Time.deltaTime); 身体骨骼.rotation = Quaternion.Slerp(身体骨骼.rotation, val2, 旋转速度 * Time.deltaTime); } else { 身体骨骼.position = 动画骨骼.position; 身体骨骼.rotation = 动画骨骼.rotation; } } } } [Header("身体骨骼部位")] private Transform myHead; private Transform myTorso; private Transform myHip; private Transform myRightArm; private Transform myRightHand; private Transform myLeftArm; private Transform myLeftHand; private Transform myRightLeg; private Transform myRightKnee; private Transform myLeftLeg; private Transform myLeftKnee; [Header("动画模型目标")] public Transform 动画模型头部; public Transform 动画模型躯干; public Transform 动画模型hip; public Transform 动画模型右大臂; public Transform 动画模型右小臂; public Transform 动画模型左大臂; public Transform 动画模型左小臂; public Transform 动画模型右大腿; public Transform 动画模型右小腿; public Transform 动画模型左大腿; public Transform 动画模型左小腿; [Header("跟随设置")] public float 跟随速度 = 15f; public float 位置跟随速度 = 10f; public bool 使用平滑跟随 = true; private Unit 此单位; private UnitRig 单位骨骼; private Rigidbody[] 身体刚体组; private Dictionary 初始姿态 = new Dictionary(); private bool 是否在跟随 = false; private List<骨骼映射> 骨骼映射表 = new List<骨骼映射>(); private void Start() { 初始化骨骼引用(); 初始化骨骼映射(); } private void Update() { if (是否在跟随) { 执行跟随(); } } private void 初始化骨骼引用() { 此单位 = ((Component)this).GetComponentInParent(); if ((Object)(object)此单位 == (Object)null) { Debug.LogError((object)"未找到Unit组件"); return; } 单位骨骼 = ((Component)此单位).GetComponent(); if ((Object)(object)单位骨骼 == (Object)null) { Debug.LogError((object)"未找到UnitRig组件"); return; } DataHandler data = 此单位.data; object obj; if (data == null) { obj = null; } else { RigidbodyHolder allRigs = data.allRigs; obj = ((allRigs != null) ? allRigs.AllRigs : null); } 身体刚体组 = (Rigidbody[])obj; myHead = 单位骨骼.m_neck; myTorso = 单位骨骼.m_torso; myHip = 单位骨骼.m_waist; myRightArm = 单位骨骼.m_armRight; myRightHand = 单位骨骼.m_wristRight; myLeftArm = 单位骨骼.m_armLeft; myLeftHand = 单位骨骼.m_wristLeft; myRightLeg = 单位骨骼.m_legRight; myRightKnee = 单位骨骼.m_footRight; myLeftLeg = 单位骨骼.m_legLeft; myLeftKnee = 单位骨骼.m_footLeft; } private void 初始化骨骼映射() { 骨骼映射表.Clear(); 添加骨骼映射(myHead, 动画模型头部); 添加骨骼映射(myTorso, 动画模型躯干); 添加骨骼映射(myHip, 动画模型hip); 添加骨骼映射(myRightArm, 动画模型右大臂); 添加骨骼映射(myRightHand, 动画模型右小臂); 添加骨骼映射(myLeftArm, 动画模型左大臂); 添加骨骼映射(myLeftHand, 动画模型左小臂); 添加骨骼映射(myRightLeg, 动画模型右大腿); 添加骨骼映射(myRightKnee, 动画模型右小腿); 添加骨骼映射(myLeftLeg, 动画模型左大腿); 添加骨骼映射(myLeftKnee, 动画模型左小腿); } private void 添加骨骼映射(Transform 身体骨骼, Transform 动画骨骼) { if ((Object)(object)身体骨骼 != (Object)null && (Object)(object)动画骨骼 != (Object)null) { 骨骼映射表.Add(new 骨骼映射(身体骨骼, 动画骨骼)); } } private void 保存当前姿态() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) 初始姿态.Clear(); foreach (骨骼映射 item in 骨骼映射表) { if ((Object)(object)item.身体骨骼 != (Object)null) { 初始姿态[item.身体骨骼] = new Pose(item.身体骨骼.position, item.身体骨骼.rotation); } } } private void 设置刚体状态(bool 是否动力学) { if (身体刚体组 == null) { return; } Rigidbody[] array = 身体刚体组; foreach (Rigidbody val in array) { if ((Object)(object)val != (Object)null) { val.isKinematic = 是否动力学; } } } public void 开始跟随() { if (!是否在跟随) { 保存当前姿态(); 设置刚体状态(是否动力学: true); 是否在跟随 = true; Debug.Log((object)"开始动画跟随"); } } public void 停止跟随() { if (是否在跟随) { 是否在跟随 = false; 恢复初始姿态(); 设置刚体状态(是否动力学: false); Debug.Log((object)"停止动画跟随"); } } public void 立即停止() { 是否在跟随 = false; 设置刚体状态(是否动力学: false); } private void 恢复初始姿态() { //IL_0039: 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) foreach (KeyValuePair item in 初始姿态) { if ((Object)(object)item.Key != (Object)null) { item.Key.position = item.Value.position; item.Key.rotation = item.Value.rotation; } } } private void 执行跟随() { foreach (骨骼映射 item in 骨骼映射表) { item.更新跟随(位置跟随速度, 跟随速度, 使用平滑跟随); } } public void 设置跟随速度(float 新速度) { 跟随速度 = Mathf.Max(0.1f, 新速度); } public void 设置位置跟随速度(float 新速度) { 位置跟随速度 = Mathf.Max(0.1f, 新速度); } public void 切换平滑跟随(bool 启用) { 使用平滑跟随 = 启用; } public bool 是否在跟随中() { return 是否在跟随; } public void 重新初始化映射() { 初始化骨骼映射(); } public void 立即对齐() { bool flag = 使用平滑跟随; 使用平滑跟随 = false; 执行跟随(); 使用平滑跟随 = flag; } private void OnDestroy() { if (是否在跟随) { 设置刚体状态(是否动力学: false); } } } } namespace HeMoDingDingMod.unity脚本.事件相关 { public class aaa事件管理器12 : MonoBehaviour { [CompilerGenerated] private sealed class <延迟执行协程>d__12 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public aaa事件管理器12 <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <延迟执行协程>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.延迟时间); <>1__state = 1; return true; case 1: { <>1__state = -1; UnityEvent 延迟执行的事件 = <>4__this.延迟执行的事件; if (延迟执行的事件 != null) { 延迟执行的事件.Invoke(); } <>4__this.当前延迟协程 = 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(); } } [CompilerGenerated] private sealed class <延迟执行协程>d__13 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float 自定义延迟时间; public aaa事件管理器12 <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <延迟执行协程>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(自定义延迟时间); <>1__state = 1; return true; case 1: { <>1__state = -1; UnityEvent 延迟执行的事件 = <>4__this.延迟执行的事件; if (延迟执行的事件 != null) { 延迟执行的事件.Invoke(); } <>4__this.当前延迟协程 = 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(); } } [CompilerGenerated] private sealed class <间隔执行协程>d__16 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public aaa事件管理器12 <>4__this; private int <当前次数>5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <间隔执行协程>d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <当前次数>5__1 = 0; break; case 1: { <>1__state = -1; UnityEvent 间隔执行的事件 = <>4__this.间隔执行的事件; if (间隔执行的事件 != null) { 间隔执行的事件.Invoke(); } <当前次数>5__1++; break; } } if (<当前次数>5__1 < <>4__this.执行次数) { <>2__current = (object)new WaitForSeconds(<>4__this.间隔时间); <>1__state = 1; return true; } <>4__this.当前间隔协程 = 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(); } } [CompilerGenerated] private sealed class <间隔执行协程>d__17 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float 自定义间隔时间; public int 自定义执行次数; public aaa事件管理器12 <>4__this; private int <当前次数>5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <间隔执行协程>d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <当前次数>5__1 = 0; break; case 1: { <>1__state = -1; UnityEvent 间隔执行的事件 = <>4__this.间隔执行的事件; if (间隔执行的事件 != null) { 间隔执行的事件.Invoke(); } <当前次数>5__1++; break; } } if (<当前次数>5__1 < 自定义执行次数) { <>2__current = (object)new WaitForSeconds(自定义间隔时间); <>1__state = 1; return true; } <>4__this.当前间隔协程 = 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(); } } [Header("延迟执行设置")] public UnityEvent 延迟执行的事件; public float 延迟时间 = 2f; public bool 在启动时执行延迟事件 = false; [Header("间隔执行设置")] public UnityEvent 间隔执行的事件; public float 间隔时间 = 1f; public int 执行次数 = 5; public bool 在启动时开始间隔执行 = false; private Coroutine 当前延迟协程; private Coroutine 当前间隔协程; private void Start() { if (在启动时执行延迟事件) { 开始延迟执行(); } if (在启动时开始间隔执行) { 开始间隔执行(); } } public void 开始延迟执行() { 停止延迟执行(); 当前延迟协程 = ((MonoBehaviour)this).StartCoroutine(延迟执行协程()); } public void 开始延迟执行(float 自定义延迟时间) { 停止延迟执行(); 当前延迟协程 = ((MonoBehaviour)this).StartCoroutine(延迟执行协程(自定义延迟时间)); } [IteratorStateMachine(typeof(<延迟执行协程>d__12))] private IEnumerator 延迟执行协程() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <延迟执行协程>d__12(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<延迟执行协程>d__13))] private IEnumerator 延迟执行协程(float 自定义延迟时间) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <延迟执行协程>d__13(0) { <>4__this = this, 自定义延迟时间 = 自定义延迟时间 }; } public void 开始间隔执行() { 停止间隔执行(); 当前间隔协程 = ((MonoBehaviour)this).StartCoroutine(间隔执行协程()); } public void 开始间隔执行(float 自定义间隔时间, int 自定义执行次数) { 停止间隔执行(); 当前间隔协程 = ((MonoBehaviour)this).StartCoroutine(间隔执行协程(自定义间隔时间, 自定义执行次数)); } [IteratorStateMachine(typeof(<间隔执行协程>d__16))] private IEnumerator 间隔执行协程() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <间隔执行协程>d__16(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<间隔执行协程>d__17))] private IEnumerator 间隔执行协程(float 自定义间隔时间, int 自定义执行次数) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <间隔执行协程>d__17(0) { <>4__this = this, 自定义间隔时间 = 自定义间隔时间, 自定义执行次数 = 自定义执行次数 }; } public void 停止延迟执行() { if (当前延迟协程 != null) { ((MonoBehaviour)this).StopCoroutine(当前延迟协程); 当前延迟协程 = null; } } public void 停止间隔执行() { if (当前间隔协程 != null) { ((MonoBehaviour)this).StopCoroutine(当前间隔协程); 当前间隔协程 = null; } } public void 停止所有执行() { ((MonoBehaviour)this).StopAllCoroutines(); 当前延迟协程 = null; 当前间隔协程 = null; } public void 开始所有执行() { 开始延迟执行(); 开始间隔执行(); } } public class 辅助事件触发器 : MonoBehaviour { public bool 是否启用 = true; public UnityEvent 启用事件; public void 启动事件() { if (是否启用) { UnityEvent obj = 启用事件; if (obj != null) { obj.Invoke(); } } } public void 设置启用(bool d = false) { 是否启用 = d; } } public class 共享事件触发器 : MonoBehaviour { public UnityEvent 共享事件1号; public UnityEvent 共享事件2号; public UnityEvent 共享事件3号; public UnityEvent 共享事件4号; public UnityEvent[] 共享事件数组; private 共享事件触发器[] 所有共享事件; private void Start() { 所有共享事件 = ((Component)((Component)this).transform.root).GetComponentsInChildren<共享事件触发器>(); } public void 激活所有共享事件组() { for (int i = 0; i < 所有共享事件.Length; i++) { UnityEvent obj = 所有共享事件[i].共享事件1号; if (obj != null) { obj.Invoke(); } UnityEvent obj2 = 所有共享事件[i].共享事件2号; if (obj2 != null) { obj2.Invoke(); } UnityEvent obj3 = 所有共享事件[i].共享事件3号; if (obj3 != null) { obj3.Invoke(); } UnityEvent obj4 = 所有共享事件[i].共享事件4号; if (obj4 != null) { obj4.Invoke(); } } } public void 激活指定共享事件组(int d = 1) { if (d == 1) { for (int i = 0; i < 所有共享事件.Length; i++) { UnityEvent obj = 所有共享事件[i].共享事件1号; if (obj != null) { obj.Invoke(); } } } if (d == 2) { for (int j = 0; j < 所有共享事件.Length; j++) { UnityEvent obj2 = 所有共享事件[j].共享事件2号; if (obj2 != null) { obj2.Invoke(); } } } if (d == 3) { for (int k = 0; k < 所有共享事件.Length; k++) { UnityEvent obj3 = 所有共享事件[k].共享事件3号; if (obj3 != null) { obj3.Invoke(); } } } if (d != 4) { return; } for (int l = 0; l < 所有共享事件.Length; l++) { UnityEvent obj4 = 所有共享事件[l].共享事件4号; if (obj4 != null) { obj4.Invoke(); } } } public void 激活所有共享事件数组() { for (int i = 0; i < 所有共享事件.Length; i++) { if (所有共享事件[i].共享事件数组 == null) { continue; } for (int j = 0; j < 所有共享事件[i].共享事件数组.Length; j++) { UnityEvent obj = 所有共享事件[i].共享事件数组[j]; if (obj != null) { obj.Invoke(); } } } } public void 激活所有共享事件数组中指定索引(int 索引) { for (int i = 0; i < 所有共享事件.Length; i++) { if (所有共享事件[i].共享事件数组 != null && 索引 >= 0 && 索引 < 所有共享事件[i].共享事件数组.Length) { UnityEvent obj = 所有共享事件[i].共享事件数组[索引]; if (obj != null) { obj.Invoke(); } } } } public void 激活所有共享事件数组中前N个(int 数量) { for (int i = 0; i < 所有共享事件.Length; i++) { if (所有共享事件[i].共享事件数组 == null) { continue; } int num = Mathf.Min(数量, 所有共享事件[i].共享事件数组.Length); for (int j = 0; j < num; j++) { UnityEvent obj = 所有共享事件[i].共享事件数组[j]; if (obj != null) { obj.Invoke(); } } } } } } namespace HeMoDingDingMod.ECS { [UpdateAfter(typeof(UpdateBarrier))] [UpdateBefore(typeof(PreLateUpdateBarrier))] public class 大力转飞后撤步 : JobComponentSystem { private struct Filter { public EntityArray Entities; public ComponentDataArray Velocities; [ReadOnly] public ComponentDataArray Ranges; [ReadOnly] public ComponentDataArray TargetDatas; [ReadOnly] public ComponentDataArray HasTargetTags; [ReadOnly] public ComponentDataArray<重装亡灵后撤步> 重装亡灵后撤步; [ReadOnly] public SubtractiveComponent IsInPool; public readonly int Length; } private struct Job : IJobParallelFor { public EntityArray Entities; public ComponentDataArray Velocities; [ReadOnly] public ComponentDataArray Ranges; [ReadOnly] public ComponentDataArray TargetDatas; [ReadOnly] public ComponentDataArray HasTargetTags; [ReadOnly] public SubtractiveComponent IsInPool; public Concurrent CommandBuffer; public void Execute(int index) { //IL_0008: 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_0015: 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_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_002f: 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_0039: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0088: Unknown result type (might be due to invalid IL or missing references) Entity val = ((EntityArray)(ref Entities))[index]; Velocity val2 = Velocities[index]; Range val3 = Ranges[index]; if (!(HasTargetTags[index].Target == Entity.Null) && TargetDatas[index].TargetInPreferredRange == 1) { val2.Value = new float3(0f, 0f, -10f); ((Concurrent)(ref CommandBuffer)).SetComponent(index, val, val2); } } } [Inject] private Filter m_filter; [Inject] private PreLateUpdateBarrier m_barrier; protected override JobHandle OnUpdate(JobHandle inputDeps) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0022: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0065: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_008c: 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_0094: Unknown result type (might be due to invalid IL or missing references) EntityCommandBuffer val = ((BarrierSystem)m_barrier).CreateCommandBuffer(); Job job = default(Job); job.Entities = m_filter.Entities; job.Ranges = m_filter.Ranges; job.Velocities = m_filter.Velocities; job.HasTargetTags = m_filter.HasTargetTags; job.TargetDatas = m_filter.TargetDatas; job.CommandBuffer = ((EntityCommandBuffer)(ref val)).ToConcurrent(); return IJobParallelForExtensions.Schedule(job, m_filter.Length, 12, inputDeps); } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct 重装亡灵后撤步 : IMovementComponent, IComponentData { } }