多轮审查和修复

This commit is contained in:
2026-05-12 15:34:08 +08:00
parent f55d2a57c3
commit ebbbb7332e
805 changed files with 838724 additions and 1905 deletions

View File

@@ -0,0 +1,52 @@
using UnityEditor;
using UnityEngine;
using BaseGames.World;
namespace BaseGames.Editor
{
/// <summary>
/// 为 DestructibleTile 和 DirectionalDestructible 在 Scene 视图中绘制 Gizmo。
/// 红色实心矩形 = 可破坏状态;灰色叉号 = 已破坏(编辑时无法判断,故始终显示可破坏状态)。
/// </summary>
[CustomEditor(typeof(DestructibleTile), true)]
public class DestructibleTileEditor : UnityEditor.Editor
{
[DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy)]
private static void DrawGizmo(DestructibleTile tile, GizmoType gizmoType)
{
if (tile == null) return;
var col = tile.GetComponent<Collider2D>();
Bounds bounds = col != null ? col.bounds : new Bounds(tile.transform.position, Vector3.one * 0.5f);
bool isSelected = (gizmoType & GizmoType.InSelectionHierarchy) != 0;
// 可破坏物:橙红色边框;选中时更亮
Gizmos.color = isSelected
? new Color(1f, 0.35f, 0.1f, 0.85f)
: new Color(1f, 0.35f, 0.1f, 0.45f);
Gizmos.DrawWireCube(bounds.center, bounds.size);
// 内部半透明填充
Gizmos.color = new Color(1f, 0.35f, 0.1f, 0.08f);
Gizmos.DrawCube(bounds.center, bounds.size);
// 中心锤子符号(用 GUI label 显示)
Handles.Label(
bounds.center + Vector3.up * (bounds.extents.y + 0.15f),
"💥",
new GUIStyle(GUI.skin.label) { fontSize = 10, alignment = TextAnchor.MiddleCenter });
}
public override void OnInspectorGUI()
{
DrawDefaultInspector();
EditorGUILayout.Space(4);
EditorGUILayout.HelpBox(
"GizmoScene 视图中橙红色边框 = 可破坏物。\n" +
"子类 DirectionalDestructible 会额外显示攻击方向箭头。",
MessageType.None);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9ccbc749bcda1104ba82ec725c43e7cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: