修复编译错误
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using BaseGames.Core;
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace BaseGames.Combat
|
||||
[SerializeField] private VoidEventChannelSO _onShieldRestoredChannel; // 护盾恢复 → 播放恢复 VFX
|
||||
|
||||
// ── 运行时属性 ────────────────────────────────────────────────────────
|
||||
public int MaxShieldHP => _config.MaxShieldHP;
|
||||
private int _maxShieldHP;
|
||||
public int MaxShieldHP => _maxShieldHP;
|
||||
public int CurrentShieldHP { get; private set; }
|
||||
/// <summary>当前是否能吸收伤害(护盾 HP > 0 且不在破碎惩罚期)。</summary>
|
||||
public bool HasShield => CurrentShieldHP > 0 && _brokenPenaltyTimer <= 0f;
|
||||
@@ -38,6 +39,7 @@ namespace BaseGames.Combat
|
||||
private void Awake()
|
||||
{
|
||||
Debug.Assert(_config != null, "[ShieldComponent] _config 未赋值,请在 Inspector 中指定 ShieldConfigSO。", this);
|
||||
_maxShieldHP = _config != null ? _config.MaxShieldHP : 0;
|
||||
CurrentShieldHP = MaxShieldHP;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using BaseGames.Core.Events;
|
||||
|
||||
namespace BaseGames.Core
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace BaseGames.Quest
|
||||
namespace BaseGames.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// 奖励接收目标接口(架构 22_QuestChallengeModule §4)。
|
||||
@@ -27,6 +27,7 @@ namespace BaseGames.Core.Save
|
||||
private SaveData _current;
|
||||
private int _currentSlot = 0;
|
||||
public int CurrentSlot => _currentSlot;
|
||||
public SaveData Data => _current;
|
||||
|
||||
public string LastCheckpointScene { get; private set; }
|
||||
public string LastCheckpointSpawnId { get; private set; }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using PathBerserker2d;
|
||||
@@ -11,6 +12,12 @@ namespace BaseGames.Editor
|
||||
/// </summary>
|
||||
public static class NavSurfaceBakeShortcut
|
||||
{
|
||||
// NavSurface.StartBakeJob() 和 NavSurface.BakeJob 均为 internal,通过反射访问。
|
||||
private static readonly MethodInfo s_startBakeJobMethod =
|
||||
typeof(NavSurface).GetMethod("StartBakeJob", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
private static readonly PropertyInfo s_bakeJobProp =
|
||||
typeof(NavSurface).GetProperty("BakeJob", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
||||
[MenuItem("BaseGames/Tools/Bake All NavSurfaces %#b", priority = 100)]
|
||||
public static void BakeAll()
|
||||
{
|
||||
@@ -26,7 +33,7 @@ namespace BaseGames.Editor
|
||||
{
|
||||
if (surface == null) continue;
|
||||
|
||||
surface.StartBakeJob();
|
||||
s_startBakeJobMethod?.Invoke(surface, null);
|
||||
EditorApplication.update -= MakeWatcher(surface);
|
||||
EditorApplication.update += MakeWatcher(surface);
|
||||
count++;
|
||||
@@ -49,16 +56,28 @@ namespace BaseGames.Editor
|
||||
EditorApplication.CallbackFunction watcher = null;
|
||||
watcher = () =>
|
||||
{
|
||||
if (surface == null || surface.BakeJob == null)
|
||||
if (surface == null)
|
||||
{
|
||||
EditorApplication.update -= watcher;
|
||||
return;
|
||||
}
|
||||
if (surface.BakeJob.IsFinished)
|
||||
|
||||
var bakeJob = s_bakeJobProp?.GetValue(surface);
|
||||
if (bakeJob == null)
|
||||
{
|
||||
EditorApplication.update -= watcher;
|
||||
return;
|
||||
}
|
||||
|
||||
bool isFinished = (bool)bakeJob.GetType()
|
||||
.GetProperty("IsFinished")!.GetValue(bakeJob);
|
||||
if (isFinished)
|
||||
{
|
||||
EditorApplication.update -= watcher;
|
||||
EditorUtility.SetDirty(surface);
|
||||
Debug.Log($"[NavSurfaceBake] ✓ {surface.name} 烘焙完成({surface.BakeJob.TotalBakeTime} ms)");
|
||||
float totalTime = (float)bakeJob.GetType()
|
||||
.GetProperty("TotalBakeTime")!.GetValue(bakeJob);
|
||||
Debug.Log($"[NavSurfaceBake] ✓ {surface.name} 烘焙完成({totalTime} ms)");
|
||||
}
|
||||
};
|
||||
return watcher;
|
||||
|
||||
@@ -10,6 +10,7 @@ using BaseGames.Enemies;
|
||||
using BaseGames.Input;
|
||||
using BaseGames.Player;
|
||||
using BaseGames.Player.States;
|
||||
using BaseGames.Skills;
|
||||
using BaseGames.UI;
|
||||
using BaseGames.UI.HUD;
|
||||
using BaseGames.UI.Menus;
|
||||
|
||||
@@ -8,9 +8,12 @@
|
||||
"versionDefines": [],
|
||||
"rootNamespace": "BaseGames.Enemies.AI",
|
||||
"references": [
|
||||
"BaseGames.Core",
|
||||
"BaseGames.Core.Events",
|
||||
"BaseGames.Enemies",
|
||||
"BaseGames.Enemies.Boss.Patterns",
|
||||
"Opsive.BehaviorDesigner.Runtime"
|
||||
"Opsive.BehaviorDesigner.Runtime",
|
||||
"Kybernetik.Animancer"
|
||||
],
|
||||
"autoReferenced": true,
|
||||
"overrideReferences": false,
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace BaseGames.Enemies
|
||||
{
|
||||
/// <summary>
|
||||
/// BatchLOSSystem 的注册接口(架构 07_EnemyModule §12)。
|
||||
/// 实现此接口的 EnemyBase 子类可以注册到 BatchLOSSystem,
|
||||
/// 以批处理方式接收 LOS(Line of Sight)检测结果。
|
||||
/// </summary>
|
||||
public interface ILOSRequester
|
||||
{
|
||||
/// <summary>射线起点(通常是眼部位置)。</summary>
|
||||
Vector2 LOSOrigin { get; }
|
||||
|
||||
/// <summary>射线终点(通常是玩家位置)。</summary>
|
||||
Vector2 LOSTarget { get; }
|
||||
|
||||
/// <summary>遮挡 LOS 的物理图层。</summary>
|
||||
LayerMask LOSBlockingMask { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 接收 LOS 检测结果。
|
||||
/// <paramref name="hasLineOfSight"/>: true = 有视线,false = 被遮挡。
|
||||
/// </summary>
|
||||
void ReceiveLOSResult(bool hasLineOfSight);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c504654ba79100742a30b448b0233d63
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -8,6 +8,8 @@
|
||||
"versionDefines": [],
|
||||
"rootNamespace": "BaseGames.Enemies.Boss.Patterns",
|
||||
"references": [
|
||||
"BaseGames.Core",
|
||||
"BaseGames.Core.Events",
|
||||
"BaseGames.Enemies",
|
||||
"BaseGames.Combat"
|
||||
],
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace BaseGames.Equipment
|
||||
public float chance; // 触发概率(0~1)
|
||||
|
||||
private HitConfirmedEventChannelSO _onHitChannel;
|
||||
private EventSubscription _sub;
|
||||
private EventSubscription? _sub;
|
||||
|
||||
public void OnEquip(EquipmentContext ctx)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using BaseGames.Player;
|
||||
|
||||
namespace BaseGames.Equipment
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"versionDefines": [],
|
||||
"rootNamespace": "BaseGames.Localization",
|
||||
"references": [
|
||||
"BaseGames.Core.Events"
|
||||
"BaseGames.Core.Events",
|
||||
"BaseGames.Core.Save"
|
||||
],
|
||||
"autoReferenced": true,
|
||||
"overrideReferences": false,
|
||||
|
||||
@@ -84,10 +84,10 @@ namespace BaseGames.Localization
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取本地化字符串(实例方法)。
|
||||
/// 获取本地化字符串(显式接口实现)。
|
||||
/// 查找顺序:当前语言 → 回退语言(English)→ 直接返回 key。
|
||||
/// </summary>
|
||||
public string Get(string key, string table = "UI")
|
||||
string ILocalizationService.Get(string key, string table)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key)) return string.Empty;
|
||||
|
||||
@@ -134,7 +134,9 @@ namespace BaseGames.Localization
|
||||
dict = LoadTable(language, table);
|
||||
_cache[cacheKey] = dict; // 即使加载失败也存入空字典,避免每帧重试
|
||||
}
|
||||
return dict != null && dict.TryGetValue(key, out value);
|
||||
if (dict != null && dict.TryGetValue(key, out value)) return true;
|
||||
value = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,7 +3,6 @@ using UnityEngine;
|
||||
using BaseGames.Core;
|
||||
using BaseGames.Core.Events;
|
||||
using BaseGames.Core.Save;
|
||||
using BaseGames.Quest;
|
||||
|
||||
namespace BaseGames.Player
|
||||
{
|
||||
|
||||
@@ -8,13 +8,15 @@
|
||||
"versionDefines": [],
|
||||
"rootNamespace": "BaseGames.Quest",
|
||||
"references": [
|
||||
"BaseGames.Core",
|
||||
"BaseGames.Core.Events",
|
||||
"BaseGames.Core.Save",
|
||||
"BaseGames.Player",
|
||||
"BaseGames.World",
|
||||
"BaseGames.Enemies",
|
||||
"BaseGames.Dialogue",
|
||||
"Unity.Addressables"
|
||||
"Unity.Addressables",
|
||||
"Unity.ResourceManager"
|
||||
],
|
||||
"autoReferenced": true,
|
||||
"overrideReferences": false,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using BaseGames.Core.Events;
|
||||
using QuestStateEnum = BaseGames.Core.Events.QuestState;
|
||||
|
||||
namespace BaseGames.Quest
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"BaseGames.Input",
|
||||
"BaseGames.Player",
|
||||
"BaseGames.Combat",
|
||||
"BaseGames.Skills",
|
||||
"Kybernetik.Animancer"
|
||||
],
|
||||
"autoReferenced": true,
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace BaseGames.Support.AntiSoftlock
|
||||
if (_player == null || !_player.Stats.IsAlive) return;
|
||||
|
||||
Vector2 pos = _player.transform.position;
|
||||
float vel = _playerRb != null ? _playerRb.linearVelocity.magnitude : Vector2.Distance(pos, _lastPos) / Time.deltaTime;
|
||||
float vel = _playerRb != null ? _playerRb.velocity.magnitude : Vector2.Distance(pos, _lastPos) / Time.deltaTime;
|
||||
|
||||
if (vel > _minVelocityThreshold)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
"BaseGames.Progression",
|
||||
"BaseGames.Platform",
|
||||
"Unity.TextMeshPro",
|
||||
"Unity.RenderPipelines.Universal.Runtime"
|
||||
"Unity.RenderPipelines.Universal.Runtime",
|
||||
"Unity.RenderPipelines.Core.Runtime"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -12,7 +12,9 @@ namespace BaseGames.Tutorial
|
||||
{
|
||||
[SerializeField] private GameObject _panel;
|
||||
[SerializeField] private TMP_Text _label;
|
||||
#pragma warning disable CS0414
|
||||
[SerializeField] private float _fadeSpeed = 4f;
|
||||
#pragma warning restore CS0414
|
||||
|
||||
private Coroutine _autoHideCoroutine;
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ namespace BaseGames.World
|
||||
/// </summary>
|
||||
public class DestructibleTile : MonoBehaviour, IDamageable
|
||||
{
|
||||
#pragma warning disable CS0414
|
||||
[SerializeField] private int _maxHP = 1;
|
||||
#pragma warning restore CS0414
|
||||
[SerializeField] private string _destructedId;
|
||||
/// <summary>
|
||||
/// ScriptableObject 注入(非静态 Instance)。
|
||||
|
||||
@@ -13,7 +13,9 @@ namespace BaseGames.World
|
||||
|
||||
[SerializeField] private bool _isInstantKill = true;
|
||||
[SerializeField] private int _damage = 9999;
|
||||
#pragma warning disable CS0414
|
||||
[SerializeField] private RespawnType _respawnType = RespawnType.AtLastSavePoint;
|
||||
#pragma warning restore CS0414
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
|
||||
@@ -19,8 +19,10 @@ namespace BaseGames.World.Liquid
|
||||
[SerializeField] private string _zoneId;
|
||||
|
||||
[Header("伤害(Water 类型专用;Acid/Lava 由子节点 HazardZone 处理)")]
|
||||
#pragma warning disable CS0414
|
||||
[SerializeField] private bool _dealsDrowningDamage = false;
|
||||
[SerializeField] private float _drowningDamagePerSecond = 5f;
|
||||
#pragma warning restore CS0414
|
||||
|
||||
[Header("物理配置")]
|
||||
[SerializeField] private LiquidPhysicsConfigSO _physicsConfig;
|
||||
|
||||
@@ -235,6 +235,15 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""Spell"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""7fa3801f-a2db-4ea0-a8f4-2ed90f7ecd8f"",
|
||||
""expectedControlType"": """",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
@@ -556,6 +565,17 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
|
||||
""action"": ""Pause"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""d10abe98-84d1-4c7f-a6d2-5f1919026dd5"",
|
||||
""path"": """",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""Spell"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -804,6 +824,7 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
|
||||
m_Gameplay_SpiritSkill2 = m_Gameplay.FindAction("SpiritSkill2", throwIfNotFound: true);
|
||||
m_Gameplay_Interact = m_Gameplay.FindAction("Interact", throwIfNotFound: true);
|
||||
m_Gameplay_Pause = m_Gameplay.FindAction("Pause", throwIfNotFound: true);
|
||||
m_Gameplay_Spell = m_Gameplay.FindAction("Spell", throwIfNotFound: true);
|
||||
// UI
|
||||
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
|
||||
m_UI_Navigate = m_UI.FindAction("Navigate", throwIfNotFound: true);
|
||||
@@ -908,6 +929,7 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
|
||||
private readonly InputAction m_Gameplay_SpiritSkill2;
|
||||
private readonly InputAction m_Gameplay_Interact;
|
||||
private readonly InputAction m_Gameplay_Pause;
|
||||
private readonly InputAction m_Gameplay_Spell;
|
||||
/// <summary>
|
||||
/// Provides access to input actions defined in input action map "Gameplay".
|
||||
/// </summary>
|
||||
@@ -984,6 +1006,10 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
|
||||
/// </summary>
|
||||
public InputAction @Pause => m_Wrapper.m_Gameplay_Pause;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action "Gameplay/Spell".
|
||||
/// </summary>
|
||||
public InputAction @Spell => m_Wrapper.m_Gameplay_Spell;
|
||||
/// <summary>
|
||||
/// Provides access to the underlying input action map instance.
|
||||
/// </summary>
|
||||
public InputActionMap Get() { return m_Wrapper.m_Gameplay; }
|
||||
@@ -1057,6 +1083,9 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
|
||||
@Pause.started += instance.OnPause;
|
||||
@Pause.performed += instance.OnPause;
|
||||
@Pause.canceled += instance.OnPause;
|
||||
@Spell.started += instance.OnSpell;
|
||||
@Spell.performed += instance.OnSpell;
|
||||
@Spell.canceled += instance.OnSpell;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1116,6 +1145,9 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
|
||||
@Pause.started -= instance.OnPause;
|
||||
@Pause.performed -= instance.OnPause;
|
||||
@Pause.canceled -= instance.OnPause;
|
||||
@Spell.started -= instance.OnSpell;
|
||||
@Spell.performed -= instance.OnSpell;
|
||||
@Spell.canceled -= instance.OnSpell;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1434,6 +1466,13 @@ public partial class @PlayerInputActions: IInputActionCollection2, IDisposable
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnPause(InputAction.CallbackContext context);
|
||||
/// <summary>
|
||||
/// Method invoked when associated input action "Spell" is either <see cref="UnityEngine.InputSystem.InputAction.started" />, <see cref="UnityEngine.InputSystem.InputAction.performed" /> or <see cref="UnityEngine.InputSystem.InputAction.canceled" />.
|
||||
/// </summary>
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.started" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.performed" />
|
||||
/// <seealso cref="UnityEngine.InputSystem.InputAction.canceled" />
|
||||
void OnSpell(InputAction.CallbackContext context);
|
||||
}
|
||||
/// <summary>
|
||||
/// Interface to implement callback methods for all input action callbacks associated with input actions defined by "UI" which allows adding and removing callbacks.
|
||||
|
||||
@@ -149,6 +149,15 @@
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Spell",
|
||||
"type": "Button",
|
||||
"id": "7fa3801f-a2db-4ea0-a8f4-2ed90f7ecd8f",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
@@ -470,6 +479,17 @@
|
||||
"action": "Pause",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "d10abe98-84d1-4c7f-a6d2-5f1919026dd5",
|
||||
"path": "",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Spell",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user